Skip to content

Converting from openApi V2 to V3 results in invalid host url #440

@CubicrootXYZ

Description

@CubicrootXYZ

When converting from V2 to V3 the host url gets changed to sth invalid.

Example 1

OpenAPI V2:

host: "your-bot-domain.de"

After conversion to V3:

servers:
- url: https://://your-bot-domain.de/

Example 2

OpenAPI V2:

host: "https://your-bot-domain.de"

After conversion to V3:

servers:
- url: https://://https:%2F%2Fyour-bot-domain.de/

Code

Code to reproduce:

var doc openapi2.T
input, err := ioutil.ReadFile(convertFile)
if err != nil {
  panic(err)
}

err = yaml.Unmarshal(input, &doc)
if err != nil {
  os.Exit(1)
}

newDoc, err := openapi2conv.ToV3(&doc)
if err != nil {
  os.Exit(1)
}

log.Info("Writting file " + outputFile)
yaml, err := yaml.Marshal(newDoc)
  if err != nil {
}
os.WriteFile(outputFile, yaml, 0666)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions