[csharp] Fix ToJson to work with composition and polymorphism#7399
Merged
wing328 merged 4 commits intoswagger-api:masterfrom Jan 22, 2018
Merged
[csharp] Fix ToJson to work with composition and polymorphism#7399wing328 merged 4 commits intoswagger-api:masterfrom
wing328 merged 4 commits intoswagger-api:masterfrom
Conversation
Previous implementation assumed specification only supports polymorphic associations (via discrimator), although the code didn't seem to be setup correctly for that in the first place. That is, the parent object must define the discriminator (see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support), so NOT HAS parent AND HAS discriminator doesn't make sense. From a C# perspective, base classes should have the method marked virtual and derived classes should override the method. This supports both composition and polymorphic definitions.
Contributor
Author
|
/cc #@mandrean |
This was referenced Jan 13, 2018
jimschubert
added a commit
to jimschubert/swagger-codegen
that referenced
this pull request
Jan 22, 2018
* master: (133 commits) add a link to ebook (polish version) Add R namespace file (swagger-api#7467) Add Spring Petstore samples (async, java8-localdatetime) to CircleCI (swagger-api#7468) Revised core team members Ada code generator corrected: "=>" instead of "->". Fixes swagger-api#7450 (swagger-api#7456) Fixes issue swagger-api#7177 (SpringCodeGen dateLibrary "java8-localdatetime" option is ignored). (swagger-api#7178) Issue-7438 Fix that prevents generating interfaces when interfaceOnly is false. (swagger-api#7439) swagger-api#7093 - Add maven wrapper (swagger-api#7356) [csharp] Support arrays of arrays for properties and models (swagger-api#7400) [csharp] Fix ToJson to work with composition and polymorphism (swagger-api#7399) [csharp] Reference this.Configuration in client api template (swagger-api#7394) [JAX-RS][Spec] Removes throws Exception. (swagger-api#7437) Use supportsES6 flag in ts compilation for language typescript-angular (swagger-api#7408) Fix 7457: [Ada] wrong order for generated structures in *-models.ads (swagger-api#7462) Fix 7459: [Ada] wrong JSON in POST operations (swagger-api#7460) [erlang-client] Erlang request utils (swagger-api#7257) reenable pushing snapshot to maven repo Create CODE_OF_CONDUCT.md comment out update to docker image deleted unnecessary notes (swagger-api#7454) ...
viclovsky
pushed a commit
to viclovsky/swagger-codegen
that referenced
this pull request
Jan 23, 2018
…r-api#7399) * [csharp] Support composition on toJson Previous implementation assumed specification only supports polymorphic associations (via discrimator), although the code didn't seem to be setup correctly for that in the first place. That is, the parent object must define the discriminator (see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support), so NOT HAS parent AND HAS discriminator doesn't make sense. From a C# perspective, base classes should have the method marked virtual and derived classes should override the method. This supports both composition and polymorphic definitions. * [csharp] Regenerate integration test files * [csharp] Regenerate samples * [csharp] Regenerate security sample
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.shand./bin/security/{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\.3.0.0branch for changes related to OpenAPI spec 3.0. Default:master.Description of the PR
Previous implementation assumed specification only supports polymorphic
associations (via discriminator), although the code didn't seem to be
setup correctly for that in the first place. That is, the parent object
must define the discriminator (see
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#models-with-polymorphism-support),
so NOT HAS parent AND HAS discriminator doesn't make sense.
From a C# perspective, base classes should have the method marked
virtual and derived classes should override the method. This supports
both composition and polymorphic definitions.
This will resolve #7358