swagger-api / swagger-api/swagger-parser
Externally defined subtypes are not resolved when referenced through the root
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
Given the setup below, the parser only resolves Animal and AnimalFarmEntry. The parser should also resolve Cat and Dog.
api.yaml
openapi: 3.0.0
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
paths:
/farm:
get:
summary: Get the animal farm.
description: Optional extended description in Markdown.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: 'schema.yaml#/components/schemas/AnimalFarm'
schema.yaml
components:
schemas:
Dog:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
Cat:
allOf:
- $ref: '#/components/schemas/Animal'
- type: object
properties:
breed:
type: string
Animal:
type: object
discriminator:
propertyName: className
required:
- className
properties:
className:
type: string
color:
type: string
default: red
AnimalFarm:
type: array
items:
$ref: '#/components/schemas/AnimalFarmEntry'
AnimalFarmEntry:
type: object
properties:
animal:
$ref: "#/components/schemas/Animal"
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 the referenced api.yaml and schema.yaml files, then trace the parser's external-reference resolution from AnimalFarm through Animal. Verify the completed behavior by checking that both Cat and Dog are resolved when referenced through the root schema.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100