feathersjs-ecosystem / feathers-swagger

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

Bug: Cannot Overwrite Schemes when uiIndex = true #167

Closed wipro-ivan closed 4 years ago

wipro-ivan commented 4 years ago

(First please check that this issue is not already solved as described here)

Describe the bug When using feathers-swagger with uiIndex set to true (automatic generation of swagger documentation), I try to set my schemes in my app.js swagger configuration by adding schemes:['http','https'] to the config data. However this doesn't apply to the documentation.

To Reproduce app.configure(swagger({ docsPath: '/docs', uiIndex: true, //no need for src/docs.html to be included info:{ title:'*** API', description:'Swagger documentation for **** API' }, ignore:{ tags:['authentication'] }, schemes:['http','https'] }

Then refresh app and go to basepath/docs, only HTTP shows:

image

Expected behavior I refresh my app go to basepath/docs and see HTTP and HTTPS in the swagger documentation site schemes dropdown System configuration

Additional context Add any other context about the problem here.

Mairu commented 4 years ago

Well the 'to reproduce' code is really not well-formatted, but It looks like a config for feathers-swagger before version 1.0.

For feathers-swagger >= 1.0 you have to put your specification related changes into a specs property of the config.

app.configure(swagger({
  docsPath: '/docs',
  uiIndex: true,
  //no need for src/docs.html to be included
  specs: {
    info:{ title:'*** API', description:'Swagger documentation for **** API' },
    schemes:['http','https']
  },
  ignore:{ tags:['authentication'] }
}
wipro-ivan commented 4 years ago

Well the 'to reproduce' code is really not well-formatted, but It looks like a config for feathers-swagger before version 1.0.

For feathers-swagger >= 1.0 you have to put your specification related changes into a specs property of the config.

app.configure(swagger({
  docsPath: '/docs',
  uiIndex: true,
  //no need for src/docs.html to be included
  specs: {
    info:{ title:'*** API', description:'Swagger documentation for **** API' },
    schemes:['http','https']
  },
  ignore:{ tags:['authentication'] }
}

Thank you so much! Yeah you're right about me using an old version of code, I got that feathers swagger config code from a code snippet that was in an issue from a while back.

I used your method and it worked perfectly

wipro-ivan commented 4 years ago

Not a bug