OpenAPITools / OpenAPITools/openapi-generator

[REQ] Generate one avro-schema file from OpenAPI's multiple components

Open
#14,830 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.