Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8266
Closed
Open
Issue created Dec 24, 2020 by Administrator@rootContributor

[BUG] 5.0.0 breaks generator if servers url relative

Created by: UnleashSpirit

Hi recently switch from openapi-generator-maven-plugin@4.3.1 to 5.0.0 and the generation of my swagger did not work anymore.

After hours of search, I finaly found that it was mu servers > url value that breaked the generation. Of course my swagger is valid according to https://apitools.dev/swagger-parser/online/ (and many others). And also specification : https://swagger.io/specification/#server-object

Field Name Type Description
url string REQUIRED. A URL to the target host. This URL supports Server Variables and MAY be relative

Step to reproduce :

Take the classic petstore : https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore.yaml Change

servers:
  - url: http://petstore.swagger.io/v1

To

servers:
  - url: /v1

Run

java -jar openapi-generator-cli.jar generate -i <path_to/petstore.yaml> -g spring

Breaks with error (unclear at all) com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'openapi': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')

I guess it breaks all generator cause it also break validate command.

Assignee
Assign to
Time tracking