ffflabs
ffflabs

Reputation: 17501

Where can I find / modify Loopbackjs model metadata?

As you might now, Loopbackjs framework displays a swagger-based explorer interface exposing your API endpoints and briefly explaining the methods. The problem it's that this interface it a little too much interactive.

I need to provide an api-docs (ish) documentation for my API, and I'm currently adding @annotations in /common/models js files, but I suspect I'm reinventing the wheel here. For swagger-ui / loopback-explorer to display its interface, the endpoints must be already exposing some kind of metadata, right?

I'd like to get that and complete it with description, examples, custom status codes and without "try it" buttons. The users that will see this wouldn't appreciate so much interactivity.

Upvotes: 1

Views: 902

Answers (1)

tonyStrong
tonyStrong

Reputation: 188

You can access the "swagger" for your LoopBack Models by clicking the "raw" button at the far right of any Model in LoopBack Explorer and you'll see the swagger JSON that describes you Model.

If you really want to customize your API explorer interface, check out this article:

http://www.podstud.io/blog/angular-swagger-jacking/

Then you'd access the Model Swagger Resources and provide any sort of slick interface you want...

Hope this starts you in the right direction...

Upvotes: 2

Related Questions