swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.56k stars 8.96k forks source link

Inline schemas or model name alias #954

Closed glennjones closed 9 years ago

glennjones commented 9 years ago

Hi

I look after the https://github.com/glennjones/hapi-swagger plug-in. One of the most common issues hit by devs building APIs with hapi.js is that they use differing parameters/response model which they wish to give the same name.

So they use the same model name but dependant on the type of request. i.e. a PUT returns a full model with a lots of properties and DELETE returns just the id property. Basically they return subsets of a common model. This is also true for parameters models as POST and PUT may require subsets of a common model.

I would really like to be able to inline schemas or in some way alias model naming to achieve the above. There is an outstanding issue with inline schemas https://github.com/swagger-api/swagger-js/issues/189 - is there an alternative I could use?

This is a bit of a blocker to me updating the plug-in to v2.0 - is there a way to alias a model name so the alias name shows in the ui

fehguy commented 9 years ago

this will be under swagger-js. Will report back on this shortly (and thanks for the hapi plugin, it's great!)

webron commented 9 years ago

@glennjones - since inline schemas are now supported, is this still an issue?

fehguy commented 9 years ago

please reopen if still an issue, @glennjones