Skip to content
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

Add models support to Swagger output #4

Closed
jmcvetta opened this issue Mar 27, 2013 · 5 comments
Closed

Add models support to Swagger output #4

jmcvetta opened this issue Mar 27, 2013 · 5 comments

Comments

@jmcvetta
Copy link

Currently the models field of an API declaration is not generated. Vestigial support is included in the RouteBuilder and swagger.Api types. The models field could be populated inside getDeclarations().

The hard part is generating the json-schema description of the models. Probably best to implement that as a separate library. It can work kinda similarly to json.Marshal().

@emicklei
Copy link
Owner

Yes, I knew this request was coming soon or later. At the time of writing, this part was not trivial to do. I will have a look at it again.

@jmcvetta
Copy link
Author

Still not trivial, I think. Implementing json-schema standard doesn't sound hard, but maybe quite a bit of tedious work. My company may be willing to hire a contractor to build this support - no guarantees tho.

@emicklei
Copy link
Owner

just begun working on a straightforward implementation using Go reflect package. See how far I can get without the full blown json schema.

@dahankzter
Copy link

there is an implementation of json schema pretty far along.

https://github.com/sigu-399/gojsonschema

@emicklei
Copy link
Owner

I am thinking about providing a way to attach externally stored models (like User.model.js) to the generated API swagger json. Then at least, there is no package dependency with gojsonschema and such a model.js can be created in any way the developer sees fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants