feathers-swagger icon indicating copy to clipboard operation
feathers-swagger copied to clipboard

Create documentation for Feathers Custom API

Open steventanwc opened this issue 3 years ago • 1 comments

Hi,

Thank you so much for the wonderful module.

I have managed to get mongoose API running.

However, can you advise how can we setup a custom endpoint (meaning one that is not connected to any table or collection)?

Thank you in advance

Steven Tan

steventanwc avatar Jun 23 '21 09:06 steventanwc

Hi Steven,

there is nothing different when creating/using a custom service. To create a custom service you can use the generator or just create a class that does not extend a adapter class, see https://docs.feathersjs.com/api/services.html#service-methods

The documentation for a service can always be customized with the same possibilities. Checkout the documentation for that https://github.com/feathersjs-ecosystem/feathers-swagger#servicedocs

  1. You can define anything of the spec for any method, here is an example how to make changes to the find method of a service: https://github.com/feathersjs-ecosystem/feathers-swagger/blob/master/example/openapi-v3/customMethods.js#L107
  2. You can completely define the methods spec, if nothing of the defaults should be reused.
  3. If only request or response schema have to be defined, you can define that and refer to it in the refs section of the service docs.

Mairu avatar Jun 24 '21 06:06 Mairu