swagger-api / swagger-api/swagger-parser
Referenced schemas in callback responses are not resolved [Regression in 2.1.19]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with openapi.yaml and operation.yaml using ParseOptions.setResolve(true) and OpenAPIParser.readLocation. Compare behavior between versions 2.1.18 and 2.1.19, then trace resolution of the callback response's schema reference. Done means the resolved result contains components.schemas.Response as in the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100