OpenAPITools / OpenAPITools/openapi-generator
[REQ] Generate one avro-schema file from OpenAPI's multiple components
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I'm using kafkajs which requires to create avsc files explicitly, thanks to avro-schema implementation I can generate the avsc files from an OpenAPI file... but my OpenAPI contains hundreds of components (#/components/schemas/XXX), as a consequence openapi-generator generates hundreds of avsc files...
Describe the solution you'd like
Today I use this command:
$OPENAPI_GENERATOR generate -i $SOURCE_PATH -g $DESTINATION_FORMAT -o $DESTINATION_PATH --additional-properties packageName=$PACKAGE_NAME
=> This generates as much avsc files as OpenAPI components in the OpenAPI file, but I only need a single MyRootComponent.avsc from my OpenAPI (#/components/schemas/MyRootComponent)
I would like to say which is my root OpenAPI component with a rootComponent parameter:
$OPENAPI_GENERATOR generate -i $SOURCE_PATH -g $DESTINATION_FORMAT -o $DESTINATION_PATH --additional-properties packageName=$PACKAGE_NAME rootComponent=MyRootComponent
=> This would generate a single MyRootComponent.avsc file that embbeds all the required OpenAPI components directly inside the MyRootComponent record
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
Start with the linked avro-schema generator documentation and reproduce the shown command against an OpenAPI document containing multiple components. The change is complete when a rootComponent option such as MyRootComponent produces one MyRootComponent.avsc containing all required components instead of one file per component.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100