-
Notifications
You must be signed in to change notification settings - Fork 9k
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
subTypes not displayed in model #1526
Comments
You're using an old version of the Swagger specification and some the conversion to 2.0 may not work properly. You can try the v2.0.24 tag which may have better results, but IIRC, there was never really support for sub types in older versions. |
I'm compiled latest version from master. |
I tried with v2.0.24 and 1.2 specification but still didn't work so i tried converting. I converted my code to new spec version (2.0) and 2.1.1 version but still getting model withouth inherited entitys:
|
The support for |
Duplicate of #723 |
@pofuk what you're seeing actually is what I would expect. Since you're missing a bit of information I'm making one assumption. In your input, you're using the If you changed the input model to, say That said, what are you expecting? Or did I get it wrong regarding the input type? |
As I understand the spec if you specify a discriminator your types get treated as a polymorphic hierarchy and therefore the subtypes This is already implemented in the |
I need it subTypes and allowOf in my swagger-editor |
@AlbertoLeon It seems as though the feature was lost (or intentionally left out) when switching the branching model because it was implemented in the dev-branch but does not seem to have been merged to the master branch. I asked about this on the google group but unfortunately got no answer. |
Hi. Any news on this? Haven't seen any working examples of use of discriminator with the swagger-ui. |
👍 |
Was anyone able to test |
@geggvarona I use a custom built version of that branch when it was still around. The implementation displayed the type of the superclass as the merged properties of the subclasses (all optional) |
|
In my project I tried version 2.2.5 of swagger-ui. As I see it this issue is still present and relevant. If you reference a super type that uses the |
Same for me. Subtypes or not shown. |
I see the same issue with swagger-ui 2.2.6, I only see the definitions from the $ref in allOf |
Are there any plan's timeline to support this feature also in swagger ui? |
@zhimoda do you have an example of a project that doesn't use a discriminator that renders properly with the swagger-ui? I'm having trouble getting subtypes working without discriminators in the swagger-ui as well. |
+1 polymorphism is fairly important to show otherwise it's effectively incomplete documentation |
currently facing the same issue |
1 similar comment
currently facing the same issue |
The issue is still exist in the newer version 3.0.2 |
I cannot create accurate API documentation without this feature! |
I am attempting to use the discriminator and allOf features for polymorphism. The response model does not show the subtypes, and in the models you can see the subtypes but they all have the same name as the supertype (and doesn't display the description I've set for the the subtype so the user has no way of knowing which subtype it is). You can see this happen with the example from the spec and in this issue #2438 As others have stated, this is a very important issue that I hope gets resolved. It still exists as of the docker-pulled version from yesterday, May 18th (presumably 3.0.10). NOTE: Trying it in SwaggerHug does display the names of the subtype correctly, however the description in each subtype still doesn't show (even if there is no description defined in the supertype), and no mention of subtypes in responses. |
To set everyone's expectations - we're currently not actively working on resolving this one. We're focused on adding support for the next version of the spec where additional JSON Schema constructs are added (anyOf, oneOf, not). We're hoping to resolve such rendering issues in that cycle, however, it won't be simple. |
Hi folks, I'm running into the same issue, and am thinking of implementing a fix for my needs. Based on the last comment on this thread, I understand you all aren't prioritizing fixing this currently, but would you be able to review and merge a PR if I submit one? If so, do you have any suggestions on the best approach to implement a fix? I'm not too familiar with the codebase, but my current thinking is something along the lines of:
The one thing I'm not sure of how to handle is that, from what I understand of the code, it seems like parameters are currently assumed to have a single |
@zainkhalid yeah, adding support to it is not going to be easy (yet not impossible). It might be easier to do with OAS3 support. @shockey might be able to give you some pointers. |
Yup, that makes sense, but I've got a short timeframe + pre-existing codebases to contend with, which is why I'm trying to see if I can get it to work with the 2.0 spec.
That would be great! |
Some news about when it will be implemented? |
Its been 6 years, kids born when this issue was first raised are soon old enough to fix it themselves. |
So said kids would be able to fix it themselves but you can't? 😉 |
I think there’s more truth to that than I want to recognise |
I'm no six year old :D, but I can consolidate this issue with #2438. Closing in favour of that one. |
Hi!
I have service and model definition:
SERVICE:
MODEL:
But model is not displayed in UI:
Found issue #300 that's closed and it's related to response class. Is request model still an issue?
The text was updated successfully, but these errors were encountered: