Skip to content

Conversation

@sreeshas
Copy link
Contributor

@sreeshas sreeshas commented Feb 8, 2017

…to boolean.

CodegenOperation and CodegenProperty classes have boolean fields instead of Boolean.
This fix changes Boolean fields of CodegenParameter and CodegenResponse to boolean as well.

Boolean fields are not necessary. Other classes interacting with them have to check for null
before interacting with them which is unnecessary and leads to ugly code.

PR checklist

  • [x ] Read the contribution guildelines.
  • [ x] Ran the shell/batch 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)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

CodegenOperation and CodegenProperty classes have boolean fields instead of Boolean.
This fix changes Boolean fields of CodegenParameter and CodegenResponse to boolean as well.

Boolean fields are not necessary. Other classes interacting with them have to check for null
before interacting with them which is unnecessary and leads to ugly code.

…to boolean.

CodegenOperation and CodegenProperty classes have boolean fields instead of Boolean.
This fix changes Boolean fields of CodegenParameter and CodegenResponse to boolean as well.

Boolean fields are not necessary. Other classes interacting with them have to check for null
before interacting with them which is unnecessary and leads to ugly code.
@fehguy
Copy link
Contributor

fehguy commented Feb 8, 2017

But I think it's not the same in the templates

{{booleanValue}} with null => "". With a boolean, false => "false" and true => "true"

@sreeshas
Copy link
Contributor Author

sreeshas commented Feb 8, 2017

@fehguy I checked them with templates. It is the same behavior.
I also ran all tests and they worked fine.

I mean booleanValue is used in the form of if else construct instead of printing its value.

{{#booleanValue}} do this{{/booleanValue} {{^booleanValue}} else do something else {{/booleanValue}}

@wing328
Copy link
Contributor

wing328 commented Feb 13, 2017

@sreeshas I ran some tests and don't see any change to the auto-generated code due to this PR.

@wing328 wing328 merged commit 9cf147f into swagger-api:master Feb 13, 2017
@wing328 wing328 added this to the v2.2.2 milestone Feb 13, 2017
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
…to boolean. (swagger-api#4747)

CodegenOperation and CodegenProperty classes have boolean fields instead of Boolean.
This fix changes Boolean fields of CodegenParameter and CodegenResponse to boolean as well.

Boolean fields are not necessary. Other classes interacting with them have to check for null
before interacting with them which is unnecessary and leads to ugly code.
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.

3 participants