HonoH
Hono15mo ago
PaulRudin

Openapi query params

I'm experimenting with openapi docs. I have:
const paramsSchema = z.object({
  entry_id: z.string().openapi({
    param: {
      name: "entry_id",
      in: "path",
    },
    example: "42",
  }),
  event_id: z.string().openapi({
    param: {
      name: "event_id",
      in: "path",
    },
    example: "99",
  }),
  fixtures_event_id: z.string().optional().openapi({
    param: {
      name: "fixtures_event_id",
      in: "query",
    }
  })
});

const route = createRoute({
  method: "get",
  path: "/",
  request: {
    params: paramsSchema,
  },
  responses: {
    200: {
      content: {
        "application/json": {
          schema: PicksResponse,
        },
      },
      description: "get the picks",
    },
  },
});

But this gives:
{"message":"Conflicting location for parameter fixtures_event_id","data":{"key":"in","values":["path","query"]}}

I'm not sure where it's getting the "path" bit for this query param?
Was this page helpful?