feathersjs-ecosystem / feathers-swagger

Add documentation to your FeatherJS services and feed them to Swagger UI.
MIT License
225 stars 63 forks source link

docs not showing before hitting explore button #193

Closed mohammadp007 closed 4 years ago

mohammadp007 commented 4 years ago

I have setup swagger and my problem is that at first when I load the page it shows me "No API definition provided." but when I hit Explore button it shows up the documents correctly. below is my configurations: App.js const app = express(feathers()) .configure(swagger({ docsPath: '/swagger', uiIndex: path.join(__dirname, '../public/swagger.html'), idType: 'string', specs: { info: { title: 'Todo back-end', description: 'Todo app api', version: '1.0.0', }, }, }));

and this is one of my services as an example: lists.docs = { definitions: { event: List, //import your own library, use the 'Model' object in this file. 'lists_list': { //this library currently configures the return documentation to look for ``${tag} list type: 'array', items: { $ref: '#/definitions/lists_list' } }, 'lists': { type: 'object', properties: { cards: { type: 'object', description: 'list of cards' }, title: { type: 'string', description: 'title of the list' }, }, items: { $ref: '#/definitions/lists' } } } };`

Mairu commented 4 years ago

You configured your own swagger.html file to be used. So in this file the json to load has to be configured correctly.

You have not configured a docsJsonPath so the docsPath should be the url used in the SwaggerUIBundle initialization.

mohammadp007 commented 4 years ago

You configured your own swagger.html file to be used. So in this file the json to load has to be configured correctly.

You have not configured a docsJsonPath so the docsPath should be the url used in the SwaggerUIBundle initialization.

What url I should use?

Mairu commented 4 years ago

For your posted config it should be '/swagger'

mohammadp007 commented 4 years ago

For your posted config it should be '/swagger'

Thank you so much, the problem solved