feathersjs-ecosystem / feathers-swagger

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

Feature: Empty view (maybe don't require a service) #173

Closed SephReed closed 4 years ago

SephReed commented 4 years ago

Is your feature request related to a problem? Please describe. I want to make docs for my endpoints. As far as I can tell, this means I must turn everything into a service. Getting passed that, it seems that everything comes with tons of incorrect documentation. I just want empty docs, and to add the fields on my own.

Describe the solution you'd like Perhaps not require a service, let users just do:

app.use("/test", {
  get: async () => "hello",
  docs: {
     // docs go here....
  }
});

And not add anything at all that the user didn't specifically describe.  No ids were mentioned.  No responses were mentioned.

Describe alternatives you've considered Building my own swagger tool from scratch.

Mairu commented 4 years ago

The lib is meant to provide docs for adapter services out of the box. Still it is possible to use it for custom services. Where it tries to reduce the amount of "boilerplate" you would have to add for every method.

If you don't like the defaults you could use your own. This is possible by using your own operationGenerators.

Have a look at the default ones provided by the lib https://github.com/feathersjs-ecosystem/feathers-swagger/blob/master/lib/v3/generator.js (or v2), if you don't want to have any content just return an empty object or an object with empty parameters, etc. (There is stuff that has to be there).