-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
allow list models and json params and display subTypes #53
Comments
Regarding model definition, there's no need for that. Even in JSON/JS there's a distinct difference between an object and a list. An object is represented by {} and a list by []. Models represent objects and not lists. Regarding the "json" type - if you declare that the operation's "consumes" field is "application/json", it basically tells the user that the model needs to be represented in a JSON format. As for swagger-ui, if you've noticed a bug where the support for subtypes is lacking, please open an issue on https://github.com/wordnik/swagger-ui and it will get fixed. Does this answer your requirements? |
Hey webron, Thank you for the quick answer. 1.) We want to use model lists to define this case: MyListClassA: { MyListClassA: { We have nested arrays and we think this would be the cleanest solution to model this with swagger. 2.) We really like the "Try it!" button from swagger-ui, but it doesn't produce the correct output for our application though the "consumes" field is "application/json". Our application requires JSON objects in the POST body and we still think the "json" paramType is necessary. How should the button react if the "consumes" field is "[application/json, text/html]"? With a "json" param type it would even be possible to have some query params and some others JSON encoded in the POST body. 3.) Sure the requirement to display the properties of parent models would need to go to swagger-ui. We were looking for someone from the community who is happy to earn some money with this, solve all three problems at once and push the results into the respective repositories. Kind regards, |
You can do that right now. However, keep in mind this is not a list of lists but rather a list of objects containing a list in them (basically, the difference between [[...], [...], [...]] and [{[...]}, {[...]}, {[...]}]). Currently, nested arrays ([[...], [...], [...]]) are not supported by Swagger, though there's a ticket on it.
|
Hi webron, The speed of your responses is amazing and I'm very pleased with it. for 1) you are right with your guess. We had a typo in our example, which is very annoying considering the example's size. I don't understand why you say "you can do this right now". As far as I know a model currently cannot have "items", but only can have "properties". The idea of "items" is to have a class representing [...], thus an array with $ref to this class would be [[...], ..., [...]]. Wouldn't this be a great way to introduce nested arrays into swagger without nesting complex types? for 2) I understand that the solution may be on swagger-ui side by providing a better interpretation of the consumes field (maybe in combination with paramType "body"?). This said we will contact @fehguy for the two swagger-ui improvements. Have I been able to explain my idea of an "items" field in model object for nested array? |
|
ok, thank you so much for your help. switching to swagger-ui ... |
Hi,
We would love to use swagger for our API documentation, but there are 3 shortcomings that don't make this work:
We are ready to pay someone from the community to provide the following extensions and kindly ask for offers. Please provide the correct place for this request if you consider swagger-spec as an incorrect place.
Provide the following extensions to swagger and create pull requests on github:
The text was updated successfully, but these errors were encountered: