Open artsiommiksiuk opened 4 days ago
Defining operation object doesn't allow refs in responses:
export const BadRequestResponseZ = registry.registerComponent("responses", "BadRequest", { description: "BadRequest", content: { "application/json": { schema: ErrorSchema, } } }); const getUser = (): RouteConfig => ({ summary: "Get user of an organization", tags, method: "get", operationId: "getOrganizationUser", path: "/organization/{organizationId}/users", request: { params: z.object({ organizationId: z.string().uuid(), }) }, responses: { "400": { '$ref': '#/components/responses/BadRequest' }, } }),
I see BadRequest registered in components.responses, but neither hardcoded, or referenced properly components allowed on RouteConfig. Not on typing level (TS error), neither in runtime (400 response simply discarded from the output).
My fault. I overlooked the place where I've been testing this.
Typing is not allowing to write something as BadRequestResponseZ.ref though.
Defining operation object doesn't allow refs in responses:
I see BadRequest registered in components.responses, but neither hardcoded, or referenced properly components allowed on RouteConfig. Not on typing level (TS error), neither in runtime (400 response simply discarded from the output).