Open pavel-zdenek opened 6 years ago
Is it correct to say that if you replace the typealias with "type: string", the result is good again?
Sure. If UserId
is not used in the endpoints code, then its content is not relevant. If we really badly wanted to use Codables, we could do a mass replace. But we got many places of UserId
usage, it was evolving from int through string to uuid even, and we always had to change just couple of lines of code. We consider primitive typealiases useful, have more of them, and must stick with codegen 2.2 to keep them usable.
Same is happening with typescript-node
, with 2.3.3
version the alias works, but with 2.4.x
it generates an empty object (in my case the alias is to a number).
Using inline definition works, but I must copy the minimum and maximum to every use of the type, instead of reuse them with the alias.
Description
We have a handful of primitive "typealias" definitions in yaml, like so
which in codegen 2.2 produces
typealias TokenId = String
but in codegen 2.3.3 and 3.0.0 produces
which is a "void" implementation, as it does not declare any usable properties.
Swagger-codegen version
2.3.3, 3.0.0
Swagger declaration file content or url
paths
is not in focus of this issue and may be empty per OpenAPI spec, but codegen throws NPE without it.Command line used for generation
java -jar swagger-codegen-cli-x.y.z.jar generate -i swagger.yaml -l swift4 -o ./codegen
Steps to reproduce
Run codegen with the above yaml
Related issues/PRs
Possibly, vaguely, in other language(s) https://github.com/swagger-api/swagger-codegen/issues/3483 https://github.com/swagger-api/swagger-codegen/issues/4804 but mind that this was working up to 2.2, just not since 2.3 with introduction of
Codable
.Suggest a fix/enhancement
As Swift primitives are Codables right away, use
typealias
as in 2.2 ?