swagger-api / swagger-api/swagger-parser

Properties order lost while converting from v2 to v3

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

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

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-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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.