-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
[TYPESCRIPT-FETCH] Subclassing components using discriminators fails to convert subclasses to JSON #19524
[TYPESCRIPT-FETCH] Subclassing components using discriminators fails to convert subclasses to JSON #19524
Conversation
…using discriminators fails to convert subclasses to JSON. Added similar discriminator handling to ToJSON as was already in place for FromJSON. The actual files changed are typescript-fetch/modelGeneric.mustache and typescript-fetch/apis.mustache. Also, adjusted FromJSON a bit in an attempt to support multiple hierarchical levels of discriminators. And fixed an issue with calling FromJSON from the map() function, which caused the index parameter getting inadvertently passed as the ignoreDiscriminator parameter. Additionally, fixed failing "mvn integration-test -f samples/client/petstore/typescript-fetch/builds/prefix-parameter-interfaces/pom.xml" Moreover, added forceConsistentCasingInFileNames:false into tsconfig.json to make tests compile on OsX.
It seems to address the same issue, yes. I now realise that my changes to FromJSON being called from map() were unnecessary. And having separate ToJSON and ToJSONTyped functions would have required no changes to map() calls. Not sure how that other PR handles the case were we have a 3-level hierarchy of objects A-discriminator->B-discriminator-C.
I do not think so, as that talks about primitive types wrt. oneOf or anyOf.
Merge 13260 or this one, if they are acceptable. Possibly with changes. |
…of using ToJSONTyped instead, as that is in line with how FromJSON is already implemented.
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.
thanks!
…minators fails to convert subclasses to JSON.
@macjohnny, for your kind attention:
PR checklist
master
(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)fixes #15736
closes #13260