Skip to content
New issue

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

When headers are referenced using the $ref invalid type is generated #1879

Open
DefCon-007 opened this issue Feb 4, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@DefCon-007
Copy link
Contributor

If a header is referenced using the $ref and it points to the parameters of a different request, then the generated type for the corresponding header is invalid.

To test, following test schema can be used. Here type for Content-Type in RequestBHeaders will be N0 which should be string.

openapi: 3.0.3
info:
  title: Example API
  version: 1.0.0
paths:
  /requestA:
    post:
      summary: Request A
      operationId: requestA
      parameters:
        - name: Content-Type
          in: header
          description: Specifies the content type of your request. Should always be set to application/json if a body is provided.
          schema:
            description: The expected content type.
            type: string
            pattern: ^application\/json$
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                message:
                  type: string
      responses:
        '200':
          description: Successful response

  /requestB:
    post:
      summary: Request B
      operationId: requestB
      parameters:
        - $ref: "#/paths/~1requestA/post/parameters/0"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
      responses:
        '200':
          description: Successful response
@melloware melloware added the bug Something isn't working label Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants