OpenAPI generator not following the specification regarding to schemes - PHP
Created by: thomasphansen
Description
According to the OpenAPI-Specification v2.0, for the fixed field "schemes":
The transfer protocol of the API. Values MUST be from the list: "http", "https", "ws", "wss". If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
The link below points to the swagger definition for the TripleTex API. Please, notice that the "schemes" field is NOT defined.
Swagger php generator works perfectly for this definition. This is a snippet from the lib/Configuration.php file:
class Configuration
{
# (...)
/**
* The host
*
* @var string
*/
protected $host = 'https://tripletex.no/v2';
# (...)
}
However, when I use OpenAPI generator, the Configuration class lacks the "https" information:
class Configuration
{
# (...)
/**
* The host
*
* @var string
*/
protected $host = 'tripletex.no/v2';
# (...)
}
Also, if I download the json file and run the swagger generator, it will by default add the https, while OpenAPI generator will continue to give the same output above. This is not a surprise, since there is nothing on the OpenAPI specification that would suggest this "default" behaviour - even if it is a breaking change. But the first situation (getting the scheme from the swagger definition URL) is clearly a bug...
openapi-generator version
v3.0.0
OpenAPI declaration file content or url
https://tripletex.no/v2/swagger.json
Command line used for generation
docker pull openapitools/openapi-generator-cli
docker run
--user $(id -u):$(id -g)
--rm -v ${PWD}:/local openapitools/openapi-generator-cli:v3.0.0 generate -i https://tripletex.no/v2/swagger.json
-l php
-o /local
-c /local/config.json
Steps to reproduce
- create a local config.json file, with the following content:
{
"invokerPackage": "Tripletex",
"modelPackage": "Model",
"apiPackage": "Api",
"packagePath": "",
"composerVendorName": "spysystem",
"composerProjectName": "tripletex-integration"
}
- check the generated file lib/Configuration.php for the protected $host parameter