Open joprice opened 1 year ago
the rule SIMPLIFY_ANYOF_STRING_AND_ENUM_STRING
in openapi normalizer can help handle such case: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/customization.md#openapi-normalizer
please give it a try when you've time.
Thank you. I'll try that. However, this schema does work with at least one other language's generator. I didn't run the generated java code to test it. Perhaps the java generator is less strict and actually generates an invalid result?
Java (client) generator supports anyOf but OCaml client generator doesn't yet support oneOf/anyOf. We welcome contributions to improve the Ocaml Client generator.
Bug Report Checklist
Description
The openapi specification for Stripe fails with the following error:
With a subset of the spec that contains an enum with an empty string, the following exception is thrown:
openapi-generator version
7.0.1
OpenAPI declaration file content or url
https://github.com/stripe/openapi/blob/master/openapi/spec3.json
Generation Details
Steps to reproduce
Run above command and see that it quickly fails with the first exception. Slimming down the spec to a single endpoint that has an empty string as an enum shows the second error:
An example of the enum that trips it up is:
After removing the empty enum, the generation succeeds for this single endpoint.
Related issues/PRs
Suggest a fix
For the first issue, it's unclear to me what the underlying problem is. For the second issue, it seems that empty string enums trip up the generator. I tried this with the java generator and it succeeded, so it seems to be specific to this generator.