openapi-changes icon indicating copy to clipboard operation
openapi-changes copied to clipboard

`--ext-refs` is not working properly

Open mrstegeman opened this issue 9 months ago • 5 comments

This new flag was added (per my request in #186) in a894170. However, it doesn't seem to be working properly.

Here's a stripped down openapi.yaml to test with:

openapi: 3.0.3
paths:
  /metrics:
    post:
      tags:
        - metrics
      summary: Upload metrics.
      description: Proxies metrics to Prometheus and any other configured sinks.
      operationId: uploadMetrics
      parameters:
        - $ref: '#/components/parameters/XRequestIdHeaderParameter'
      responses:
        '204':
          $ref: '#/components/responses/NoContent'
components:
  schemas:
    Text:
      type: string
      description: Text string.
  responses:
    NoContent:
      description: No Content
      headers:
        x-request-id:
          $ref: '#/components/headers/x-request-id'
  parameters:
    XRequestIdHeaderParameter:
      description: |-
        Unique request ID. If one is not provided, it will be generated automatically and returned in the
        response headers. The request ID is useful when tracing logs.
      name: x-request-id
      in: header
      required: false
      schema:
        $ref: '#/components/schemas/Text'
  headers:
    x-request-id:
      description: Unique request ID, useful when tracing logs.
      required: false
      schema:
        $ref: '#/components/schemas/Text'
➜   openapi-changes summary -n --ext-refs -b ./openapi.yaml ./openapi.yaml
2025-02-19 21:51:24 ERROR unable to locate reference anywhere in the rolodex reference: #/components/headers/x-request-id
2025-02-19 21:51:24 ERROR unable to locate reference anywhere in the rolodex reference: #/components/headers/x-request-id
ERROR: cannot resolve reference `#/components/headers/x-request-id`, it's missing: $.components.headers['x-request-id'] [25:11]
ERROR: cannot resolve reference `#/components/headers/x-request-id`, it's missing: $.components.headers['x-request-id'] [25:11]
Error: cannot resolve reference `#/components/headers/x-request-id`, it's missing: $.components.headers['x-request-id'] [25:11]
cannot resolve reference `#/components/headers/x-request-id`, it's missing: $.components.headers['x-request-id'] [25:11]

mrstegeman avatar Feb 25 '25 18:02 mrstegeman

I think this is related to the issue that i posted here: https://github.com/pb33f/openapi-changes/issues/190

lupor avatar Feb 25 '25 19:02 lupor

Ah yes, I think you're right!

mrstegeman avatar Feb 25 '25 19:02 mrstegeman

fixed in v0.0.76

daveshanley avatar Feb 26 '25 03:02 daveshanley

@daveshanley This is still not working on 0.0.76. I'm getting the exact same error output.

mrstegeman avatar Feb 26 '25 17:02 mrstegeman

Damn, sorry wil re-investigate.

daveshanley avatar Feb 26 '25 21:02 daveshanley