You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicenum CreateCompletionRequestPrompt:Codable,JSONEncodable,Hashable{case typeString(String)case type[Int]([Int])<----------------- case is suffixed with the type of the associated value
case type[String]([String])case type[[Int]]([[Int]])publicfunc encode(to encoder:Encoder)throws{varcontainer= encoder.singleValueContainer()switchself{case.typeString(let value):try container.encode(value)case.type[Int](let value):try container.encode(value)case.type[String](let value):try container.encode(value)case.type[[Int]](let value):try container.encode(value)}}publicinit(from decoder:Decoder)throws{letcontainer=try decoder.singleValueContainer()iflet value =try? container.decode(String.self){self=.typeString(value)}elseiflet value =try? container.decode([Int].self){self=.type[Int](value)}elseiflet value =try? container.decode([String].self){self=.type[String](value)}elseiflet value =try? container.decode([[Int]].self){self=.type[[Int]](value)}else{throwDecodingError.typeMismatch(Self.Type.self,.init(codingPath: decoder.codingPath, debugDescription:"Unable to decode instance of CreateCompletionRequestPrompt"))}}}
It can be trivially fixed manually by replacing the name with typeOfArrayOfString etc. but still annoying to generate faulty code each time.
…ixOpenAPITools#20560
* Add test for file reproducing OpenAPITools#20560
* Cases previously generated as "case type[Int]([Int])" become "case typeArrayOfInt([Int])"
janodev
added a commit
to janodev/openapi-generator
that referenced
this issue
Jan 31, 2025
Bug Report Checklist
Description
File example.yaml passes validation at https://validator.swagger.io/ but generates code like this:
It can be trivially fixed manually by replacing the name with typeOfArrayOfString etc. but still annoying to generate faulty code each time.
openapi-generator version
OpenAPI declaration file content or url
See https://gist.github.com/janodev/103b048498c94d5f3d44751687727a5b#file-example-yaml-L44-L68
Generation Details
Default options:
./openapi-generator-cli.sh generate -i example.yaml -g swift6 -o openai
Steps to reproduce
The text was updated successfully, but these errors were encountered: