Skip to content

Create override for array schema default value when using the spring …#894

Open
jason-cohen wants to merge 1 commit intoOpenAPITools:masterfrom
jason-cohen:bugfix/spring_generator_array_schema
Open

Create override for array schema default value when using the spring …#894
jason-cohen wants to merge 1 commit intoOpenAPITools:masterfrom
jason-cohen:bugfix/spring_generator_array_schema

Conversation

@jason-cohen
Copy link
Contributor

@jason-cohen jason-cohen commented Aug 24, 2018

…codegen.

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • @bbdouglas @JFCote @sreeshas @jfiala @lukoyanov @cbornet @jeff9finger

Description of the PR

Fix #890

Note

There is an issue with the swagger-parser (swagger-api/swagger-parser#814) where an empty string for the default field is parsed as null. This fix won't achieve the desired effect until that issue is resolved and released.

@JFCote
Copy link
Member

JFCote commented Aug 27, 2018

@jason-cohen LGTM. Just a question: If swagger-parser fixes the issue, will it create a regression or it will still work regardless?
Thanks for the PR!

@jason-cohen
Copy link
Contributor Author

@JFCote I had a bit of a back-and-forth with the members of swagger-parser, and I think this PR would need to be revised. Simply performing getDefault().toString() will probably not work, as the parsed schema will probably be of type List<> and not String. This is my presumption based on what I believe the fix for the swagger-parser will be, but I could be wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java][Spring] Optional query parameter of type array-string doesn't respect defaults

4 participants