We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The openapi({ example: null }} is not take into account.
openapi({ example: null }}
const UserSchema = z .object({ id: z.string().openapi({ example: "1212121" }) }) .openapi("User"); const UserInputSchema = z .object({ name: z.string().openapi({ example: "John Doe" }), age: z.number().nullish().openapi({ example: null }) // <-- null }) .openapi("User"); registry.registerPath({ method: "post", path: "/users", summary: "Create a user", request: { body: { description: "Retrosynthesis request", content: { "application/json": { schema: UserInputSchema } } } }, responses: { 200: { description: "Object with user data.", content: { "application/json": { schema: UserSchema } } } } });
Will generate:
/users: post: summary: Create a user requestBody: description: Retrosynthesis request content: application/json: schema: allOf: - $ref: "#/components/schemas/User" - properties: name: type: string example: John Doe age: type: - number - "null" required: - name responses: "200": description: Object with user data. content: application/json: schema: $ref: "#/components/schemas/User"
The field "age" do not contains example like the field "name".
I expect to have this
/users: post: summary: Create a user requestBody: description: Retrosynthesis request content: application/json: schema: allOf: - $ref: "#/components/schemas/User" - properties: name: type: string example: John Doe age: type: - number - "null" example: null required: - name responses: "200": description: Object with user data. content: application/json: schema: $ref: "#/components/schemas/User"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The
openapi({ example: null }}
is not take into account.Will generate:
The field "age" do not contains example like the field "name".
I expect to have this
The text was updated successfully, but these errors were encountered: