swagger-api / swagger-api/swagger-parser

Unable to resolve reference attribute in multiple yaml files

Open
#1,235 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

Hi
We have multiple yaml (a.yaml and b.yaml) file and we have $ref from one attribute which defined in another file. We have one attribute in a.yaml whose type is defined in b.yaml. Our expectation is to parse yaml files and find the attribute type ;

We are parsing using swagger-parse
OpenAPI openAPI = new OpenAPIV3Parser().read("/opt/SwaggerParser/a.yaml")

and tried also OpenAPI openAPI = new OpenAPIV3Parser().read("/opt/SwaggerParser/").

Both the approach fails to achieve expected result. Appreciate for any suggestion.

Thanks

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the case using a.yaml and b.yaml, where an attribute in a.yaml references a type defined in b.yaml, and compare both OpenAPIV3Parser.read(...) calls shown in the report. Trace external-reference resolution from those entry points and verify that the parsed attribute exposes its referenced type; the issue is done when the multi-file YAML case resolves consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.