OpenAPITools / OpenAPITools/openapi-generator
[BUG] [go] does not compile: missing types: AnyOfintegerstring, AnyOfstringfloat , AnyOfstringinteger, OneOfobjectobject , AnyOfobjectobject ...
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
While generating library of vendor provider spec file, not all types are generated
AnyOfintegerstring
AnyOfstringfloat
AnyOfstringinteger
AnyOffloat
OneOfobjectobject
AnyOfstringarrayinteger
AnyOfstringboolean
AnyOfobjectobject
AnyOfReplacePatchOperationRemovePatchOperationAddPatchOperationMovePatchOperation
OneOfobjectobjectobject
openapi-generator version
Tested openapi generator clie versions 5.0.1, 5.1.1, 5.2.1, (5.[34].x crashes ) 6.0.0-SNAPSHOT (cloned master)
OpenAPI declaration file content or url
Full (vendor) version on: https://gist.github.com/iafilius/bbfe04aa5b31d9fd212a7841f71e4447
Essentials version on: https://gist.github.com/iafilius/00c025c50145542684210829bcb9813e
Generation Details
$ java -jar ../${CODEGEN} generate
-i ${SPECFILE}
-g go
-o out/
Steps to reproduce
- download specfile
- download recent openapi-generator-cli or build from master
- generate go libary as described above
- go to output dir, end try to build: go build in that folder, you may need a few 'go get ..' as indicated go build output
- watch errors like:
$ go build
# github.com/GIT_USER_ID/GIT_REPO_ID
./model_device_settings_cloud_security.go:20:23: undefined: OneOfobjectobject
./model_device_settings_cloud_security.go:41:65: undefined: OneOfobjectobject
./model_device_settings_cloud_security.go:43:13: undefined: OneOfobjectobject
./model_device_settings_cloud_security.go:51:68: undefined: OneOfobjectobject
./model_device_settings_cloud_security.go:68:65: undefined: OneOfobjectobject
./model_device_settings_ospf_area.go:20:5: undefined: AnyOfintegerstring
./model_device_settings_ospf_area.go:41:42: undefined: AnyOfintegerstring
./model_device_settings_ospf_area.go:43:11: undefined: AnyOfintegerstring
./model_device_settings_ospf_area.go:52:46: undefined: AnyOfintegerstring
./model_device_settings_ospf_area.go:69:42: undefined: AnyOfintegerstring
./model_device_settings_ospf_area.go:43:11: too many errors
Related issues/PRs
related in go:
https://github.com/OpenAPITools/openapi-generator/issues/11291
related, bug for java:
https://github.com/OpenAPITools/openapi-generator/issues/7246
related for rust:
https://github.com/OpenAPITools/openapi-generator/issues/7975
Suggest a fix
Tried to define missing types myself as interface{}, while it compiles, there are issues with nullable/omitempty
It would be nice the missing types would be generated, including the helper functions/methods to marshall etc.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the supplied vendor or essentials gist and the Java CLI command using the go generator. Start with the generated model_device_settings_cloud_security.go and model_device_settings_ospf_area.go files, then run go build in the output directory. Done means the generated library defines the reported composed types and builds without undefined-type errors while preserving nullable and omitempty behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, java, openapi
- Domain
- api, backend-api-design, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100