swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Referenced schemas in callback responses are not resolved [Regression in 2.1.19]

Open simon-spinner opened this issue 1 year ago • 0 comments

Input Given the following OpenAPI specs:

openapi.yaml

openapi: 3.0.2
info:
  title: But
  version: 1.0.0
paths:
    '/resource':
      $ref: operation.yaml#/paths/~1resource

operation.yaml

openapi: 3.0.2
info:
  title: But
  version: 1.0.0
paths:
  '/resource':
    get:
      operationId: Operation
      responses:
        '200':
          description: Operation was Successfull and the below response structure is returned
      callbacks:
        SomeCallback:
          '/callback':
            get:
              responses:
                '200':
                  description: Success
                  content:
                    application/json:
                      schema:
                        $ref: '#/components/schemas/Response'
components:
  schemas:
    Response:
      type: object
      properties:
        name:
          type: string

parsing with

var options = new ParseOptions();
options.setResolve(true);
var result = new OpenAPIParser().readLocation("openapi.yaml", null, options);

Expected result: The result contains the Response schema in components.schemas.

Observed result: The Response schema is missing. This worked as expected until including 2.1.18 and is broken afterwards.

simon-spinner avatar Jul 10 '24 08:07 simon-spinner