Skip to content

[Kotlin] Fix model enum generation#6383

Merged
wing328 merged 1 commit intoswagger-api:masterfrom
memrange:fix_enum
Sep 1, 2017
Merged

[Kotlin] Fix model enum generation#6383
wing328 merged 1 commit intoswagger-api:masterfrom
memrange:fix_enum

Conversation

@red-hood
Copy link
Copy Markdown
Contributor

@red-hood red-hood commented Aug 27, 2017

Run postProcessModelsEnum on model enums, so that enumVars get populated,
and fix the model enum template.

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 for non-breaking changes and 3.0.0 branch for breaking (non-backward compatible) changes.

Description of the PR

see above

@red-hood
Copy link
Copy Markdown
Contributor Author

PS I was not able to determine from which context isString is resolved. Neither CodegenModel, allowableValues nor enumVars have such an attribute. Could someone point out to from which context this is taken?

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Aug 28, 2017

PS I was not able to determine from which context isString is resolved. Neither CodegenModel, allowableValues nor enumVars have such an attribute. Could someone point out to from which context this is taken?

Would adding the model debug help when generating the client?

-DdebugModels=true

@red-hood
Copy link
Copy Markdown
Contributor Author

red-hood commented Aug 28, 2017

Yes, thanks, that helped. So basically isString is not in the hierarchy of any contexts, but the quotation marks are added by toEnumValue. I updated the pull request accordingly.
Also, I noticed the petstore example does not contain any model level enums, so this bug was not triggered before. Would it make sense to add a model enum there?

Run postProcessModelsEnum on model enums, so that enumVars get populated,
and fix the model enum template.
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Aug 29, 2017

Kotlin is using modules/swagger-codegen/src/test/resources/2_0/petstore.yaml to generate Petstore client. We can use https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml, which covers a lot more edge cases (e.g. enum models, enum of integers, etc)

@wing328 wing328 merged commit adf5d64 into swagger-api:master Sep 1, 2017
wing328 added a commit that referenced this pull request Sep 1, 2017
wing328 added a commit that referenced this pull request Sep 1, 2017
…6421)

* Revert "Make the Rust codegen compile. (#6411)"

This reverts commit 60766c6.

* Revert "[Kotlin] Fix model enum generation (#6383)"

This reverts commit adf5d64.

* Revert "Global namespaces for ruby basic types (#6418)"

This reverts commit 070894d.

* Revert "add ehyche to swift tech comm"

This reverts commit 5c62ba1.

* Revert "[python-client] Thread pool fix (#6396)"

This reverts commit a28ce0b.

* Revert "update retrofit2 petstore samples"

This reverts commit 0f1a61d.

* Revert "Retrofit2: Return ResponseBody if response if file. (#6407)"

This reverts commit 481c040.
@Bijnagte
Copy link
Copy Markdown

Why was this reverted?

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Oct 22, 2017

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