New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
defaultValue cannot be set to empty string #43
Comments
I believe 'default' values should not be used in the client at all, since 'default' is more of a way to tell the client - "if you don't provide the information
|
By the way in the core code annotation with empty default is simply ignored: if(!param.defaultValue().isEmpty()){
defaultValue = param.defaultValue();
} |
@fehguy - your opinion? |
I agree with lugaru1234, default value should be for documentation purpose only, to simply the API client and let the API server handle it. BTW, the current ruby codegen does not handle defaultValue at all, I think this issue is not relevant anymore. And please have a loot at PR #649 for a solution of skipping an optional parameter (using default value for it). |
@xhh @lugaru1234 Yes, ideally the default value should be applied by the server. The codegen should probably not assume that the default value be passed if not supplied. |
Comments above are right. It's ugly and wrong to support defaultValue. Either fully remove defaultValue from the swagger spec, or if it stays, then don't discriminate default values like empty strings or null... the whole point with default values is they came in handy with the default ruby-generated-code as they became optional method parameters. Anyway, default Ruby code used to suck in many other places, so I guess its users' responsibility to take the example and fix it to avoid duplication and support optional parameters without default values (for example this issue can be addressed passing parameters in an opts Hash instead of separately).. |
Allow some values to be use in templates
when a parameter type is 'string' a defaultValue of '' (empty string) does not get passed to the final generated [ruby] code.
The text was updated successfully, but these errors were encountered: