-
Notifications
You must be signed in to change notification settings - Fork 2.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
JsonView support #2079
Comments
Hi, a bit of confusion. There's no philosophical reason why they're not supported--they're "just not supported" so sending a PR would be just fine. But we do need to adhere to the specification so things like I would need to think more about what you're actually proposing but please don't get me wrong--there's nothing wrong with |
See original request swagger-api#2079 The patch will create various definition models for response based on the original model, plus the JsonView, e.g., given the original model Car, and JsonView named Detail and Summary, the definition model could be Car_Summary, Car_Detail, or Car_Summary-or-Detail. The patch also support the inheritance of the JsonView, e.g., The Detail is a subtype of Summary, so any type/field annotated by Summary, should be visible to Detail view. Please refer to the JsonViewTest.java for detail. Also refer to the CarResource.java and the updated ApiListingResourceIT.java
See original request #2079 The patch will create various definition models for response based on the original model, plus the JsonView, e.g., given the original model Car, and JsonView named Detail and Summary, the definition model could be Car_Summary, Car_Detail, or Car_Summary-or-Detail. The patch also support the inheritance of the JsonView, e.g., The Detail is a subtype of Summary, so any type/field annotated by Summary, should be visible to Detail view. Please refer to the JsonViewTest.java for detail. Also refer to the CarResource.java and the updated ApiListingResourceIT.java
Dear team,
JSON views are a very convenient and powerful way to not duplicate models used by resources. Many developers already rose this point and believe Swagger should support it. However it seems that all the requests to support this feature have been turned down.
What about generating a single and individual definition entry when @JSONVIEW is detected?
For instance, taking this example below (pseudo code):
=> parsing these two resources will translate today into the following OAI JSON file:
Sadly, only one definition model will be generated after Swagger scans either serviceA or serviceB.
Would it be difficult to instead generate a 'contextualized' definition model associated to each individual service, hence 'supporting' JsonViews?
The generated OAI file could then look something like:
Please let me know what you think. Thanks.
The text was updated successfully, but these errors were encountered: