Closed isqua closed 1 year ago
Thanks for your suggestion!
There are no plans to implement it in the foreseeable future.
If you think your request could live outside Nest's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
Now I can declare a schema in the
@ApiResponse
decorator, but return data that does not correspond to it at all. E.g.:Describe the solution you'd like
It would be great if the schema could declare a type of data, and there would be type checking, that the returned data corresponds this type. E.g. in ajv
JSONSchemaType
is generic, so I could describe a schema for a specific type:I’d like to get some TS Error about mismatching, e.g.:
Teachability, documentation, adoption, migration strategy
This issue can be solved by making JSONSchema type and ApiResponse decorator generic. I’ve made some type wrappers at my project to solve the issue locally:
I’m using JSONSchemaType from ajv, but it can be solved by any generic JSON Schema types.
What is the motivation / use case for changing the behavior?
Of course, first of all I change the logic in a controller, cover the endpoint behaviour with tests and so on. And I forget to change corresponding schema, which affects the Swagger docs.