Examples in the referenced paths are parsed differently than those in non-referenced paths.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start with the failing tests in the linked swagger-parser-sample repository and compare how the V1 referenced operations and the non-referenced V2 are parsed. Trace the corresponding OpenAPI example handling in swagger-parser, then verify that equivalent examples produce JSON objects consistently in both cases.
Written by the indexing model from the issue text.
Description
Hello,
When using OpenAPI Specification where the operations of an endpoint are being referenced using another file, the examples are parsed as strings rather than objects in the absence of a reference.
As observed in the image above, the only distinction is that the operations under /products are referenced in V1, whereas no such reference exists in V2. When flattened out both V1 and V2 are identical. However, the example value and example type do not match when these specifications are parsed.
Expected Behavior
The examples in both V1 and V2 should be parsed consistently as JSON Object.
Actual Behavior
In V1, where the operations are referenced:
V1 Example Value: {id=1, name=XYZ Product, inventory=100}
V1 Example Value Type: class java.util.LinkedHashMap
In V2, where no reference exists:
V2 Example Value: {"id":"1","name":"XYZ Product","inventory":100}
V2 Example Value Type: class com.fasterxml.jackson.databind.node.ObjectNode
Sample Project
I have created a sample repository demonstrating this issue with the failing tests, which can be accessed here, Thank you for your attention to this matter.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
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.
More from swagger-api/swagger-parser
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swagger-api/swagger-parser#2386 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
swagger-api/swagger-parser#2168 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
swagger-api/swagger-parser#1922 · 2 comments · 1 reaction ·
-
[Bug]: Regression: resolveFully fails when components key does not match external file basename OpenBug
Difficulty 4/5 3-5 days Newbie friendliness 58/100
swagger-api/swagger-parser#2399 · 3 comments ·
-
Bug
Difficulty 4/5 3-5 days Newbie friendliness 48/100
swagger-api/swagger-parser#2395 ·
All issues in swagger-api/swagger-parser
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100