swagger-api / swagger-api/swagger-parser
Properties order lost while converting from v2 to v3
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
While both v2 and v3 models store properties in LinkedHashMaps, io.swagger.v3.parser.converter.SwaggerConverter#convert(Property schema) uses a HashMap as temporary storage, losing the properties order.
This is for version 2.0.6 but I can see issue still there on master: https://github.com/swagger-api/swagger-parser/blob/a3d3a4207ded6414573ea4d2986024f931f364f9/modules/swagger-parser-v2-converter/src/main/java/io/swagger/v3/parser/converter/SwaggerConverter.java#L924
Thanks
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
Start in modules/swagger-parser-v2-converter/src/main/java/io/swagger/v3/parser/converter/SwaggerConverter.java at the convert(Property schema) code around line 924. Trace the temporary property storage and verify that conversion preserves the input property order, including for the version 2.0.6 case described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100