-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 client generation with anyOf, oneOf, allOf #3388
Comments
Yes, that's a known issue, though I wasn't able to find an issue to duplicate this with. |
Something new about this Issue? Some workarounds? |
I just ran into this as well, with a more complex setup |
Is there any progress on this issue? |
This is causing quite some problem when you mix Springdoc with Jackson deserialisation. Basically we have to write them manually and not use annotations for Jackson because else these oneOf() allOf() of simple polymorphism messes up the JS/TS code ... would be amazing if you could fix that! |
We're currently building out an OpenAPI specification for a legacy system (so handcrafted, no automated API generation), for use from an Angular application. We've used the
allOf
andoneOf
constructs a few times, but have just found that the NSwag generation isn't quite supportive of these.As a basic example (using constructs from the OpenAPI documentation):
Is giving us:
Notice that the
pets()
method is only accepting a strongly typedCat
instance, or anundefined
. NoDog
. If I generate classes instead of interfaces, I can see the generation using thepet_type
field to construct the correct instance from thePet
class:But the
pets()
method is still the same. It's only accepting one of the strongly typed classes.Is this expected? Is there any method of getting
allOf
,oneOf
to generate correctly with using a TypeScript client.I've seen past issues with comments that it should be working, as TypeScript is more flexible than C#, but it doesn't appear to be working for us.
Using v13.10.8.0.
The text was updated successfully, but these errors were encountered: