Description
I've updated openapi-generator from 6.0.0 to 6.2.0 and this adds a requiresAuthentication-property with the value true or false, but when there are multiple security definitions, the generated code becomes something like truetruetruetrue. Which - of course - causes a compilation error :-P
openapi-generator version
Version 6.2.0
OpenAPI declaration file content or url
{
"swagger" : "2.0",
"info" : {
"description" : "Example",
"version" : "v1",
"title" : "Example",
"termsOfService" : "None",
"contact" : {
"name" : "Foo",
"url" : "https://www.example.com"
}
},
"host" : "www.example.com",
"basePath" : "/Example",
"schemes" : [ "https" ],
"produces" : [ "application/json" ],
"security" : [ {
"Ping + Oauth.OAuthImplicit" : [ "partner:read" ]
}, {
"Ping + Oauth.OAuthImplicit" : [ "partner:write" ]
}, {
"Ping + Oauth.OAuthAccessCode" : [ "partner:read" ]
}, {
"Ping + Oauth.OAuthAccessCode" : [ "partner:write" ]
}, {
"Ping + Oauth.OAuth (External)Implicit" : [ "openid" ]
}, {
"Ping + Oauth.OAuth (External)AccessCode" : [ "openid" ]
} ],
"paths" : {
"/api/{country}/v1/accounts/{accountNumber}/split-amount" : {
"put" : {
"tags" : [ "Accounts" ],
"operationId" : "Accounts_SplitAmount",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "accountNumber",
"in" : "path",
"required" : true,
"type" : "string"
}, {
"in" : "body",
"name" : "input",
"required" : true,
"schema" : {
"$ref" : "#/definitions/SplitAmountInput"
}
}, {
"name" : "country",
"in" : "path",
"required" : true,
"type" : "string",
"default" : "nl"
} ],
"responses" : {
"200" : {
"description" : "OK"
}
}
}
}
},
"securityDefinitions" : {
"Ping + Oauth.OAuthImplicit" : {
"description" : "OAuth",
"type" : "oauth2",
"authorizationUrl" : "https://www.example.com/api/oauth/authorize",
"flow" : "implicit",
"scopes" : {
"partner:read" : "",
"partner:write" : ""
}
},
"Ping + Oauth.OAuthAccessCode" : {
"description" : "OAuth",
"type" : "oauth2",
"authorizationUrl" : "https://www.example.com/api/oauth/authorize",
"tokenUrl" : "https://www.example.com/api/oauth/token",
"flow" : "accessCode",
"scopes" : {
"partner:read" : "",
"partner:write" : ""
}
},
"Ping + Oauth.OAuth (External)AccessCode" : {
"description" : "OAuth (External)",
"type" : "oauth2",
"authorizationUrl" : "https://www.example.com/api/oauth/authorize",
"tokenUrl" : "https://www.example.com/api/oauth/token",
"flow" : "accessCode",
"scopes" : {
"openid" : ""
}
},
"Ping + Oauth.OAuth (External)Implicit" : {
"description" : "OAuth (External)",
"type" : "oauth2",
"authorizationUrl" : "https://www.example.com/api/oauth/authorize",
"flow" : "implicit",
"scopes" : {
"openid" : ""
}
}
},
"definitions" : {
"SplitAmountInput" : {
"type" : "object",
"required" : [ "amount" ],
"properties" : {
"amount" : {
"type" : "number",
"format" : "decimal"
}
}
}
}
}
Generation Details
Just build it:
openapi-generator generate -i example.json -g swift5
Steps to reproduce
Look at the generated code of OpenAPIClient/Classes/OpenAPIs/APIs/AccountsAPI.swift and check the last line:
return localVariableRequestBuilder.init(
method: "PUT",
URLString: (localVariableUrlComponents?.string ?? localVariableURLString),
parameters: localVariableParameters,
headers: localVariableHeaderParameters,
requiresAuthentication: truetruetruetrue // Whut?
)
I don't think the compiler will be too kind to the mega-boolean truetruetruetrue :-D
It appears that this issue was introduced in #13321
Description
I've updated openapi-generator from 6.0.0 to 6.2.0 and this adds a
requiresAuthentication-property with the valuetrueorfalse, but when there are multiple security definitions, the generated code becomes something liketruetruetruetrue. Which - of course - causes a compilation error :-Popenapi-generator version
Version 6.2.0
OpenAPI declaration file content or url
{ "swagger" : "2.0", "info" : { "description" : "Example", "version" : "v1", "title" : "Example", "termsOfService" : "None", "contact" : { "name" : "Foo", "url" : "https://www.example.com" } }, "host" : "www.example.com", "basePath" : "/Example", "schemes" : [ "https" ], "produces" : [ "application/json" ], "security" : [ { "Ping + Oauth.OAuthImplicit" : [ "partner:read" ] }, { "Ping + Oauth.OAuthImplicit" : [ "partner:write" ] }, { "Ping + Oauth.OAuthAccessCode" : [ "partner:read" ] }, { "Ping + Oauth.OAuthAccessCode" : [ "partner:write" ] }, { "Ping + Oauth.OAuth (External)Implicit" : [ "openid" ] }, { "Ping + Oauth.OAuth (External)AccessCode" : [ "openid" ] } ], "paths" : { "/api/{country}/v1/accounts/{accountNumber}/split-amount" : { "put" : { "tags" : [ "Accounts" ], "operationId" : "Accounts_SplitAmount", "consumes" : [ "application/json" ], "produces" : [ "application/json" ], "parameters" : [ { "name" : "accountNumber", "in" : "path", "required" : true, "type" : "string" }, { "in" : "body", "name" : "input", "required" : true, "schema" : { "$ref" : "#/definitions/SplitAmountInput" } }, { "name" : "country", "in" : "path", "required" : true, "type" : "string", "default" : "nl" } ], "responses" : { "200" : { "description" : "OK" } } } } }, "securityDefinitions" : { "Ping + Oauth.OAuthImplicit" : { "description" : "OAuth", "type" : "oauth2", "authorizationUrl" : "https://www.example.com/api/oauth/authorize", "flow" : "implicit", "scopes" : { "partner:read" : "", "partner:write" : "" } }, "Ping + Oauth.OAuthAccessCode" : { "description" : "OAuth", "type" : "oauth2", "authorizationUrl" : "https://www.example.com/api/oauth/authorize", "tokenUrl" : "https://www.example.com/api/oauth/token", "flow" : "accessCode", "scopes" : { "partner:read" : "", "partner:write" : "" } }, "Ping + Oauth.OAuth (External)AccessCode" : { "description" : "OAuth (External)", "type" : "oauth2", "authorizationUrl" : "https://www.example.com/api/oauth/authorize", "tokenUrl" : "https://www.example.com/api/oauth/token", "flow" : "accessCode", "scopes" : { "openid" : "" } }, "Ping + Oauth.OAuth (External)Implicit" : { "description" : "OAuth (External)", "type" : "oauth2", "authorizationUrl" : "https://www.example.com/api/oauth/authorize", "flow" : "implicit", "scopes" : { "openid" : "" } } }, "definitions" : { "SplitAmountInput" : { "type" : "object", "required" : [ "amount" ], "properties" : { "amount" : { "type" : "number", "format" : "decimal" } } } } }Generation Details
Just build it:
Steps to reproduce
Look at the generated code of
OpenAPIClient/Classes/OpenAPIs/APIs/AccountsAPI.swiftand check the last line:I don't think the compiler will be too kind to the mega-boolean
truetruetruetrue:-DIt appears that this issue was introduced in #13321