Skip to content

Cookie parameter support #46

@folklorelabs

Description

@folklorelabs

Hi -- it appears that this library currently only supports the following parameter types: query, path, header, and body based on what I'm seeing in the source code. Was it an intentional decision to not include cookie parameters? If not would it be possible to add support?

Here's an example for reference.

Swagger doc OpenAPI example endpoint:

{
  ...
  "/v1/testUserData/{locale}": {
    "get": {
      "tags": [
        "test-controller"
      ],
      "summary": "A summary of the test user endpoint",
      "description": "A description of the test user endpoint.",
      "operationId": "getTestUserData",
      "parameters": [
        {
          "name": "AUTH_TOKEN",
          "in": "cookie",
          "description": "Auth Cookie",
          "content": {
            "*/*": {
              "schema": {
                "type": "string"
              }
            }
          }
        },
        {
          "name": "locale",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "responses": {
        "200": {
          "description": "Success",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TestResponse"
              }
            }
          }
        }
      }
    }
  },
  ...
}
...

typed-openapi output based on the Swagger doc OpenAPI example above:

...
export type get_GetTestUserData = typeof get_GetTestUserData;
export const get_GetTestUserData = {
  method: z.literal("GET"),
  path: z.literal("/v1/testUserData/{locale}"),
  parameters: z.object({
    path: z.object({
      locale: z.string(),
    }),
  }),
  response: TestResponse,
};
...

As you can see it is stripping out the AUTH_TOKEN parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions