-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[csharp] Support inheritance instead of duplicating parent properties in derived classes #5922
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@manuc66 What about putting down something similar to
swagger-codegen/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java
Line 2931 in 64df75d
* Copied from Twitter elephant bird |
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.
OK, it's done ;-)
@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.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)2.3.0
branch 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 hidingtypeName
Fixed some ".bat":
csharp-dotnet2-petstore.bat was missing
csharp-property-changed-petstore.bat
did not contains the right arguments vs the.sh
versionIncluded 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