swagger-api / swagger-api/swagger-parser

Wrongly adding extensions field on root level

Open
#1,971 0 comments 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

I'm currently using swagger-parser to transform Swagger 2.0 Specification to a OpenAPI 3.0.

The problem with the conversion is that it oddly add a new field (extensions) at the root level and inside of it the extension, instead of adding the extension ("x-original-swagger-version") at the root level

"openapi": "3.0.1",
"paths": {...},
"components": {...},
"extensions" : {
    "x-original-swagger-version" : "2.0"
  }

There is some configuration that I'm missing or it is something that is backed up by the standard?

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 by reproducing the Swagger 2.0 to OpenAPI 3.0 conversion described in the issue and inspect how the root-level extension is represented. The work is done when "x-original-swagger-version" appears directly at the OpenAPI document root rather than under an "extensions" field.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.