Closed RickEyre closed 3 years ago
Hi, there are many approaches, the simplest would be to use the refs option of a service(.docs) to set refs for the different request and responses (check the readme for the available options) that you could have defined in the schemas/definitions section before.
In this example the sortParameter (which is currently missing from the docs and types) is set, https://github.com/feathersjs-ecosystem/feathers-swagger/blob/179fa50856c785e9984ae02847bae3d083fc3ca0/example/openapi-v3/multi.js
Alternatively you could directly set the schema (or ref) of a specific method using the property path setting functionality like here: https://github.com/feathersjs-ecosystem/feathers-swagger/blob/179fa50856c785e9984ae02847bae3d083fc3ca0/example/openapi-v3/definitions.js#L44-L54
For a get response that would be
operations: {
get: {
'responses.200.content.application/json.schema': {
type: 'object',
properties: { ... }
}
}
}
For more complex cases you have to know how the target openapi specification should look like.
Awesome, thank you!
Is there an easy way / recommended way for modifying the request / response schemas for each method in a service? Out of the box it seems to support only two definitions - singular and array.