Skip to content

Support the empty string as an enumeration value#4450

Merged
wing328 merged 1 commit intoswagger-api:masterfrom
kevinoid:empty-string-enum-value
Jan 6, 2017
Merged

Support the empty string as an enumeration value#4450
wing328 merged 1 commit intoswagger-api:masterfrom
kevinoid:empty-string-enum-value

Conversation

@kevinoid
Copy link
Copy Markdown
Contributor

When a string enumeration has the empty string as one of its available values, the generated code for many languages is invalid because the empty string can not be used as an identifier. As with numbers and symbols, provide a mapping to an English name which can be used as a replacement. In this case, "empty" for the empty string/empty value.

Reviewer Note: I have updated all of the languages that I could find and updated the samples by running ./bin/run-all-petstore and everything looks good. However, I have been unable to get Travis CI to run on my repo due to `nexus.codehaus.org: Unknown host nexus.codehaus.org and I was unable to run the integration tests on my machine. So some additional sanity checking would be greatly appreciated.

When a string enumeration has the empty string as one of its available
values, the generated code for many languages is invalid because the
empty string can not be used as an identifier.  As with numbers and
symbols, provide a mapping to an English name which can be used as a
replacement.  In this case, "empty" for the empty string/empty value.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jan 6, 2017

@kevinoid thanks for the contribution to cover this additional edge case. The change looks good to me.

@wing328 wing328 merged commit df0c54d into swagger-api:master Jan 6, 2017
@kevinoid
Copy link
Copy Markdown
Contributor Author

kevinoid commented Jan 6, 2017

@wing328 Great. Thanks for reviewing and merging it!

davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
When a string enumeration has the empty string as one of its available
values, the generated code for many languages is invalid because the
empty string can not be used as an identifier.  As with numbers and
symbols, provide a mapping to an English name which can be used as a
replacement.  In this case, "empty" for the empty string/empty value.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
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.

2 participants