swagger-api / swagger-api/swagger-parser

ResolverFully doesn't resolve arrays recursively

Open
#994 1 comment 1 reaction 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

The logic in ResolverFully seems to be flawed:
https://github.com/swagger-api/swagger-parser/blob/a4a06670d805997f8f8b7e51b6104729118ae697/modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/ResolverFully.java#L301-L305
If array's items schema is a reference, it's resolved. If it isn't, then nothing is done (we're getting items from the array, then setting them back. Hmm…)
But the case when array's items schema is an array, object or a composed schema, which contain references, is unhandled; those references are never resolved.
I propose removing this check and replacing it with arrayModel.setItems(resolveSchema(arrayModel.getItems())), which will take care of resolving the references.

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

Start in modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/ResolverFully.java around lines 301-305 and trace how array item schemas are resolved. Verify the behavior for array, object, and composed item schemas that contain references; done means those nested references are resolved recursively.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.