[csharp] Support inheritance instead of duplicating parent properties in derived classes#5922
[csharp] Support inheritance instead of duplicating parent properties in derived classes#5922wing328 merged 30 commits intoswagger-api:masterfrom manuc66:feature/csharp-subtypes
Conversation
This includes supportsInheritance only for the client codegen at the moment, because setting in AbstractCSharpCodegen would require the change to be tested in all derived generators, possibly including similar template changes to this commit's.
…degen/tree/csharp/3829 and leverage https://github.com/manuc66/JsonSubTypes for subtype deserialization
…into feature/csharp-subtypes2 # Conflicts: # modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache
…codegen into feature/csharp-subtypes2 # Conflicts: # modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java # modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache
- bin/csharp-petstore-all.sh && bin/security/csharp-petstore.sh - bin/csharp-dotnet2-petstore.sh && bin/csharp-petstore.sh && bin/csharp-petstore-netcore-project.sh && bin/csharp-petstore-net-standard.sh && bin/csharp-property-changed-petstore.sh
+ fix the csharp-property-changed-petstore.bat
…f the current schema
|
Seems the Travis error is not related to this changeset, could the build be re-triggered ? |
|
|
||
| namespace JsonSubTypes | ||
| { | ||
| // Copyright 2017 Emmanuel Counasse |
There was a problem hiding this comment.
@manuc66 Can we remove the copyright note and license here? The auto-generated code in any languages should be unlicensed by default.
There was a problem hiding this comment.
I chose to include the small library as source code instead of an independently licensed package dependency that would have increase constraints both on the consumer and producer side. I thought it would not be a problem as I saw that copyright notices exist in other generated files.
However, I think the copyright notice could be removed as long a little notice explain that it came from 'https://github.com/manuc66/JsonSubTypes'.
What do you think about it?
There was a problem hiding this comment.
@manuc66 What about putting down something similar to
?|
@manuc66 don't worry about the Travis error. I'll restart it and test locally if it's still failing. (C# related tests are covered by AppVeyor) |
|
cc @jimschubert |
…re-all.bat add missing file to trigger it on windows
|
Conflicts solved |
|
@manuc66 I performed a few more tests and the result is good. Thanks for the contribution. |
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)2.3.0branch for breaking (non-backward compatible) changes.Description of the PR
Took the work done in PR #4080: "[csharp] Don't duplicate parent properties in derived classes".
Fixed the generated code for:
ToJson()instead of hidingtypeNameFixed some ".bat":
csharp-dotnet2-petstore.bat was missingcsharp-property-changed-petstore.batdid not contains the right arguments vs the.shversionIncluded an leveraged a helper library in order to de-serialize a child class with
Newtonsoft.Json, the original library is hosted here: https://github.com/manuc66/JsonSubTypes (this feature is not available inNewtonsoft.Json, see: JamesNK/Newtonsoft.Json#1331