Closed kernwig closed 1 year ago
@kernwig thank you for that. I do see this and agree that this should be fixed. I'll try and do that whenever I can. In the mean time what I can suggest is using .openapi({ param: { description: '<your-description-here>' }})
as a temporary solution
@kernwig should be fixed as part of v6.2.0.
As a side comment. I've decided to provide the description in both cases. Because from an "API" point of view:
request: {
query: z.object({
test: z.string().describe('Some parameter'), // You'd expect this to be on a parameter level
}),
},
but also
const schema = z
.string()
.describe('Some parameter')
.openapi('SomeString'); // You'd also expect the description to be a part of the schema
//...
request: {
query: z.object({ test: schema }), // You'd expect this to be on a parameter level
},
Note: having in both places should not be a problem for swagger documentation rendering and validation tools.
Let me know if there is anything else I can be helpful with.
Confirmed problem fixed. 👍 Thank you for the quick fix, and the great library!
The output OpenAPI spec does not place the description of a (query string) parameter in the right place, and thus is lost when rendered.
Example:
Results in OpenAPI spec:
The
description: Business code identifying the Client
belongs one element up, next to the parametername
andrequired
. See https://swagger.io/docs/specification/describing-parameters/As a result, the description is not rendered by Swagger UI.