Skip to content

Missing headers in responses when generating clients #2011

Description

@MrwanBaghdad

Hey team! I have been trying out oapi-codegen, and it's a fantastic tool. Thanks a lot for putting this effort in.

While trying it out, I have discovered an interesting behaviour that I would like to determine if it's a bug or a design decision.

When generating a client from a spec that define headers as part of it's response, the generated client response skips the aforementioned headers in the generated response struct.

Example yaml

openapi: 3.0.2
info:
  version: "0.0.1"
paths:
  /foo:
    get:
      responses:
        200:
          description: "endpoint"
          headers:
            "bar":
              schema:
                type: string
          content:
            application/json:
              schema: 
                $ref: "#/components/schemas/data"
components:
  schemas:
    data:
      type: object
      properties:
        foo:
          type: string

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions