swagger-api / swagger-api/swagger-parser

OpenAPI v2 converter - Two identical schemas are not equals

Open
#779 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

Hello,
first, thank you very much for this tool.

I'm trying to parse two equivalent schemas, one in swagger 2.0, the other in openapi 3.0 :
swagger 2.0 : https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/yaml/petstore.yaml
openapi 3.0 : https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml

I'm using this dependencies :

        <dependency>
            <groupId>io.swagger.parser.v3</groupId>
            <artifactId>swagger-parser-v3</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>io.swagger.parser.v3</groupId>
            <artifactId>swagger-parser-v2-converter</artifactId>
            <version>2.0.1</version>
        </dependency>

But it seems that the two OpenAPI are not equals.
For example, in POST /pets operation, query parameters limit are differents :
the swagger 2.0 parameter class is io.swagger.v3.oas.models.parameters.Parameter but the openapi 3.0 parameter class is io.swagger.v3.oas.models.parameters.QueryParameter.
And there is same kind of problem with Schemas : ObjectSchema vs Schema.

It is a normal behavior ?

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 with the swagger-parser-v2-converter 2.0.1 conversion of the linked Swagger 2.0 and OpenAPI 3.0 petstore examples. Compare the POST /pets limit parameter and schema model classes, including Parameter versus QueryParameter and ObjectSchema versus Schema. Done means establishing whether these type differences are expected or require consistent output, with a regression test if behavior should change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.