Description
The generator currently produces the following output for -DdebugSupportingFiles:
"servers" : [ {
"url" : "http://petstore.swagger.io:{port}/{basePath}",
"description" : "The production API server",
"variables" : {
"port" : {
"default" : "8443",
"enum" : [ "8443", "443" ]
},
"basePath" : {
"default" : "v2"
}
}
} ],
for the following input:
openapi: 3.0.0
servers:
- url: 'http://petstore.swagger.io:{port}/{basePath}'
description: The production API server
variables:
port:
enum:
- '8443'
- '443'
default: '8443'
basePath:
default: v2
(full spec
AFAIK mustache does not allow iterating objects (Correct me if I'm wrong - I tried a lot of different combinations and couldn't get it to work).
This is problematic because the entries of variables are user defined, so they can't be referenced in the template by hardcoding variable names.
Problem Example:
I wanted to write a template which generates a class for each server with one setter per variable e.g. setBasePath(path: string) and setPort(port: 8443 | 443)
openapi-generator version: 3.0.0
Command line used for generation
-DdebugSupportingFiles with any language.
Suggest a fix/enhancement
Change the variables object to an array of objects, each containing a name property.
"servers" : [ {
"url" : "http://petstore.swagger.io:{port}/{basePath}",
"description" : "The production API server",
"variables" : [
{
"name": "port",
"default" : "8443",
"enum" : [ "8443", "443" ]
},
{
"name": "basePath",
"default" : "v2"
}
]
} ],
Description
The generator currently produces the following output for
-DdebugSupportingFiles:for the following input:
(full spec
AFAIK mustache does not allow iterating objects (Correct me if I'm wrong - I tried a lot of different combinations and couldn't get it to work).
This is problematic because the entries of
variablesare user defined, so they can't be referenced in the template by hardcoding variable names.Problem Example:
I wanted to write a template which generates a class for each server with one setter per variable e.g.
setBasePath(path: string)andsetPort(port: 8443 | 443)openapi-generator version: 3.0.0
Command line used for generation
-DdebugSupportingFileswith any language.Suggest a fix/enhancement
Change the variables object to an array of objects, each containing a
nameproperty.