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)