Handle discriminator mapping non-ref name#3247
Merged
wing328 merged 1 commit intoOpenAPITools:masterfrom Jul 4, 2019
Merged
Conversation
The `mapping` property of the [Discriminator Object] is "An object to hold mappings between payload values and schema names or references." The subsequent examples in the spec have `mapping`s of both types. The `mapping` support introduced in OpenAPITools#536 only supports references. Update the code to support names (identified by lack of `/`) or references and change a test mapping to cover this case. [Discriminator Object]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#discriminatorObject Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
wing328
approved these changes
Jul 4, 2019
Member
wing328
left a comment
There was a problem hiding this comment.
LGTM. Tested locally and the result is good.
Contributor
Author
|
Great. Thanks @wing328! |
kevinoid
added a commit
to kevinoid/appveyor-swagger
that referenced
this pull request
Nov 17, 2022
openapi-generator currently does not generate valid Java code for discriminator mappings with names (instead of references). So use references instead. See OpenAPITools/openapi-generator#3247 Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
kevinoid
added a commit
to kevinoid/appveyor-swagger
that referenced
this pull request
Nov 17, 2022
openapi-generator currently does not generate valid Java code for discriminator mappings with names (instead of references). So use references instead. See OpenAPITools/openapi-generator#3247 Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
kevinoid
added a commit
to kevinoid/appveyor-swagger
that referenced
this pull request
Nov 17, 2022
openapi-generator currently does not generate valid Java code for discriminator mappings with names (instead of references). So use references instead. See OpenAPITools/openapi-generator#3247 Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
kevinoid
added a commit
to kevinoid/appveyor-swagger
that referenced
this pull request
Nov 18, 2022
openapi-generator currently does not generate valid Java code for discriminator mappings with names (instead of references). So use references instead. See OpenAPITools/openapi-generator#3247 Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
This file contains hidden or 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
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.
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh,./bin/openapi3/{LANG}-petstore.shif 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\. If contributing template-only or documentation-only changes which will change sample output, be sure to build the project first.master,4.1.x,5.0.x. Default:master.Description of the PR
The
mappingproperty of the Discriminator Object is "An object to hold mappings between payload values and schema names or references." The subsequent examples in the spec havemappings of both types. Themappingsupport introduced in #536 only supports references.This pull request updates the code to support names which are not references (identified by lack of
/) in addition to references and changes a test mapping to cover this case.Thanks for considering,
Kevin
CC: @0v1se, @jmini (from #536)
CC technical committee: @bbdouglas, @sreeshas, @jfiala, @lukoyanov, @cbornet, @jeff9finger, @karismann, @Zomzog