OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[x] Have you provided a full/minimal spec to reproduce the issue?
[ ] Have you validated the input using an OpenAPI validator (example)?
[x] What's the version of OpenAPI Generator used?
[x] Have you search for related issues/PRs?
[x] What's the actual output vs expected output?
[ ] [Optional] Bounty to sponsor the fix (example)
Description
YAML fails to generated python code; JSON for the same spec works.
I think this has to do with the *id/&id references not being valid, but the YAML passes the validator. The same JSON works fine (see both below).
Errors:
openapi-generator generate -v -i test-schema.yaml -g python --package-name test -o test
[main] INFO o.o.c.config.CodegenConfigurator -
VERBOSE MODE: ON. Additional debug options are injected
- [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen
- [debugModels] prints models passed to the template engine
- [debugOperations] prints operations passed to the template engine
- [debugSupportingFiles] prints additional data passed to the template engine
Exception in thread "main" org.openapitools.codegen.SpecValidationException: There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 2, Warning count: 0
Errors:
-attribute paths.'/_/api/users/{username}/'(put).requestBody.content.'application/x-www-form-urlencoded'.schema is not of type `object`
-attribute paths.'/_/api/users/{username}/'(put).requestBody.content.'multipart/form-data'.schema is not of type `object`
at org.openapitools.codegen.config.CodegenConfigurator.toContext(CodegenConfigurator.java:480)
at org.openapitools.codegen.config.CodegenConfigurator.toClientOptInput(CodegenConfigurator.java:507)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:423)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
Bug Report Checklist
[x] Have you provided a full/minimal spec to reproduce the issue?
[ ] Have you validated the input using an OpenAPI validator (example)?
[x] What's the version of OpenAPI Generator used?
[x] Have you search for related issues/PRs?
[x] What's the actual output vs expected output?
[ ] [Optional] Bounty to sponsor the fix (example)
Description
YAML fails to generated python code; JSON for the same spec works.
I think this has to do with the
*id/&id
references not being valid, but the YAML passes the validator. The same JSON works fine (see both below).Errors:
openapi-generator version
OpenAPI declaration file content or url
Given this YAML:
And the JSON:
Generation Details
openapi-generator generate -v -i schema.yaml -g python --package-name test_package -o api
Steps to reproduce
Run the above YAML through openapi-generator.
Related issues/PRs
https://github.com/encode/django-rest-framework/issues/7479
Suggest a fix