Search code examples
swagger-codegenopenapi-generator

How can I use useOneOfInterfaces flag in openapi-generator?


I wanted to fix a bug with openapi generator and I figured what I actually need is to set useOneOfInterfaces = True in openapi-generator/..../codegen/DefaultCodegen.java#L231

Currently I forked OpenAPITools/openapi-generator repo and manually edited that flag and rebuild openapi-generator that I'm using. Is there a way to pass this flag as a command line argument instead such that I'll be able to use the latest binary from OpenAPITools/openapi-generator? I.e.,

openapi-generator generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g ruby -o /tmp/test/ --enableUseOneOfInterfaces

Solution

  • This flag is currently only set in a single code generator, the Swift5ClientCodengen. There is no general parsing of this flag. If you'd like for this flag to be generally available feel free to submit an issue in the repository or even better add a pull request that adds parsing this flag to the DefaultCodegen.