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
which is then referenced elsewhere with a simple ref:
hoststate:
$ref: '#/components/schemas/string64'
The generator completely skips hoststate, leading to errors at buildtime (go-server):
$ java -jar openapi-generator-cli.jar generate -o server/ -g go-server -i openapi-3.1.yaml
$ cd server
$ go build
go/model_host.go:24:12: undefined: Hoststate
...
... too many errors
The generated code also forgets to import "errors" and "io" leading to other build errors that can be easily worked around by manually adding the missing imports (separate issue).
By removing the string64 and directly using "string", the problem goes away, like this:
hoststate:
maxLength: 64
type: string
(leaving only the missing "errors" and "io" imports)
It's painful and less concise though to replace everywhere in the API all references to fixed length types, since they appear many times.
Description
SPEC contains (extract of the relevant parts):
which is then referenced elsewhere with a simple ref:
The generator completely skips hoststate, leading to errors at buildtime (go-server):
$ java -jar openapi-generator-cli.jar generate -o server/ -g go-server -i openapi-3.1.yaml
$ cd server
$ go build
go/model_host.go:24:12: undefined: Hoststate
...
... too many errors
The generated code also forgets to import "errors" and "io" leading to other build errors that can be easily worked around by manually adding the missing imports (separate issue).
By removing the string64 and directly using "string", the problem goes away, like this:
(leaving only the missing "errors" and "io" imports)
It's painful and less concise though to replace everywhere in the API all references to fixed length types, since they appear many times.
openapi-generator version
using latest stable version, at this time 7.12.0
OpenAPI declaration file content or url
Generation Details
java -jar openapi-generator-cli.jar generate -o server/ -g go-server -i openapi-3.1.yaml
Steps to reproduce
As per Generation Details and the OpenAPI snippet. Adding any ref to string64 does not work.
Suggest a fix
It should generate the code for all components that reference string64. Currently it silently skips all components that are a $ref to string64.
The text was updated successfully, but these errors were encountered: