-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[java] Enum in array of array #66
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I could not use the gist provided by @msjoshi in the original issue swagger-api/swagger-codegen#7918 because of #50. So I tested this PR with this OpenAPI version 2 Specification:
|
4 tasks
jmini
added a commit
to jmini/openapi-experiments
that referenced
this pull request
May 18, 2018
wing328
approved these changes
May 18, 2018
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performed some tests and the result is good.
Conflicts: modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelEnumTest.java
jmini
added a commit
to jmini/openapi-experiments
that referenced
this pull request
May 18, 2018
jimschubert
added a commit
to jimschubert/openapi-generator
that referenced
this pull request
May 23, 2018
* master: (36 commits) jaxrs-cxf-cdi: fix outer enum (OpenAPITools#131) Move bash argv opt to end of ags line in scripts (OpenAPITools#124) Reduce CI logging (OpenAPITools#119) Download elm dependencies without prompting user. (OpenAPITools#118) [aspnetcore] Make the use of Swashbuckle optional (OpenAPITools#110) DefaultGenerator: fix NullPointerException (OpenAPITools#109) [Java] use html entities in javadoc of generated code (OpenAPITools#106) Update PULL_REQUEST_TEMPLATE.md [java] Enum in array of array (OpenAPITools#66) Rename datatype to dataType in CodegenProperty (OpenAPITools#69) update elm test to compile all elm files (OpenAPITools#95) Fix Petstore example for Elm (OpenAPITools#96) Update Docker documentation (OpenAPITools#97) CaseFormatLambda has been added, params for Rest-assured client has been refactored (OpenAPITools#91) Update integration.md [Clojure] Add util method to set the api-context globally (OpenAPITools#93) [JaxRS-Java] issue with implFolder on windows, and required fields generation for containers (OpenAPITools#88) Set parameters allowableValues dynamically (OpenAPITools#65) Meta: set version for "build-helper-maven-plugin" (OpenAPITools#89) Fix javadoc issues in "openapi-generator" module (OpenAPITools#84) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for #16
This PR introduces
CodegenProperty.mostInnerItems
andCodegenParameter.mostInnerItems
that gives always the most inner items type when arrays are contained in arrays.OAS2 (extract):
Example in Java:
The
CodegenProperty
created fororder
defines the typeList<List<OrderEnum>>
.Before this PR, if you want to access the
CodegenProperty
corresponding to the enum you need to doitems.items
(because we have an array of array of enum). The problem is that you do not know how many time you need to loop. If you just have a simple array of enum it will beitems
In the Java code you often see this pattern:
To find the most inner items CodegenProperty
This PR introduces
mostInnerItems
that you can call at top level (you should checkisContainer
) and that gives you theitems
you are looking for (the one corresponding toOrderEnum
in the example)