OpenAPITools / OpenAPITools/openapi-generator

Question: type-mapping generation for import-mappings

Open
#2,380 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

I am wondering if there is any way to generate a file containing the type-mappings that were generated so that they could be passed into another api gen the is utilizing data models from the first.

I have been creating multiple oas definitions with empty paths and defined components, and then using Maven to version and manage these definitions as dependencies in other projects with oas definitions. The intended result is a collection of API definitions for different services within a specific business domain that can all share a set of common data models.

Ideally, I would only want to generate each common data model once. I believe the way to do this would be to create an import-mappings string that would map all my previously generated data model names to their corresponding class names.

But this would be tedious and error prone to maintain by hand. Is there a way to generate a file that contains these mappings that I could then pass in as an import-mappings file?

openapi-generator version

openapi-generator-maven-plugin:3.0.0

using java generator name

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

The issue names the Java generator and openapi-generator-maven-plugin; start by examining how generated type mappings and the import-mappings option are handled. Define whether an emitted mappings file can be consumed by another generation run, and verify the behavior with shared models across multiple OpenAPI definitions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.