[csharp] Don't duplicate parent properties in derived classes#4080
Closed
jimschubert wants to merge 2 commits intoswagger-api:masterfrom
Closed
[csharp] Don't duplicate parent properties in derived classes#4080jimschubert wants to merge 2 commits intoswagger-api:masterfrom
jimschubert wants to merge 2 commits intoswagger-api:masterfrom
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.
Contributor
|
@jimschubert I leverage your work to add subtype inheritance support in https://github.com/manuc66/swagger-codegen/tree/feature/csharp-subtypes could you have a look ? |
Merged
3 tasks
Contributor
|
Closed via #5922 |
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)2.3.0branch for breaking (non-backward compatible) changes.Description of the PR
referring to #3829, this sets parent properties only on base types in the C# client generator. It looks like there's a similar solution in the NancyFX generator, but it didn't port correctly to
AbstractCSharpCodegen.I'd like to move logic from this PR into
AbstractCSharpCodegento be shared across generators, but I'd need to look more into how NancyFX is doing its inheritance (because it doesn't havesupportsInheritance = trueset).One of my main concerns is that the code block I have commented "Cleanup possible duplicates." may or may not indicate a bug elsewhere (wherever
readWriteVarsis used). Without this cleanup block, whensupportsInheritance = trueand I debug./bin/csharp-petstore.sh, I getreadWriteVarscontaining duplicates for all parent properties . My assumption is that thenameproperty of these codegen properties isn't being compared in a case-insensitive way, or post-processing of property names isn't being done before the sorting. I spent some time trying to track this down and couldn't find it.I was wondering if someone could:
supportsInheritance = true;to see if readWriteVars does indeed include duplicates?I plan to take another look, but it may be a week or so before I get around to it.