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
  • Merge requests
  • !1034

[all] Add leading slash in path if missing

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jmini/add_leading_slash_if_missing into master Sep 14, 2018
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 3

Created by: jmini

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • Copied the technical committee: @OpenAPITools/generator-core-team @OpenAPITools/openapi-generator-collaborators (change in core)

Description of the PR

From https://github.com/OpenAPITools/openapi-generator/pull/967#issuecomment-418602467 and #997.

This PR adds the leading / if it is missing in the path definition.


More details:

This spec is not valid:

openapi: '3.0.1'
info:
  title: ping test
  version: '1.0'
servers:
  - url: 'http://localhost:8000/api'
paths:
  ping/me:
    get:
      operationId: pingGet
      responses:
        '201':
          description: OK

Because the path ping/me do not conform to this rule:

The field name MUST begin with a slash.

See the OpenAPI Specification 3.0.1.

Some editors like Swagger online editor or the KaiZen-Editor are reporting errors, but Swagger-Parser does not.

Some templates uses {{{basePathWithoutHost}}}{{{path}}}.

  • Before this PR it will generate http://localhost:8000/apiping/me (incorrect)
  • After this PR it will generate http://localhost:8000/api/ping/me (correct)
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jmini/add_leading_slash_if_missing