OpenAPITools / OpenAPITools/openapi-generator

[BUG][Typescript]Generating from multiple yaml files creates conflicting Configuration classes

Open
#10,886 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • [ N/A ] What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Hi all. I have a list of yaml files, and i want to generate code for each one of them, and then push that code to separate repositories. My main app imports all these repos and this is where I get a conflict for Configuration and ConfigurationParameters. I'm using typescript-axios as the generator, and I didn't find a way to either exclude the config part from being generated at generator config level, or adding a suffix / prefix to the generated classes (also, at a generator config level).

openapi-generator version

2.3.7

Generation Details
Steps to reproduce
  1. have a project with 2 or more yaml files
  2. add 2 typescript-axios generators, each with the output pointing to a different folder
  3. run openapi-generator-cli with something like openapi-generator-cli generate
  4. check the generated folders and observe configuration.ts in both, with the same content
Suggest a fix

There are options for adding suffixes to models and apis, but no option of adding a suffix to configuration files, or omitting them entirely

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 typescript-axios generator entry point and reproduce the issue using two YAML files and separate openapi-generator-cli generate runs. Check how configuration.ts and ConfigurationParameters are emitted and how generator options are defined. Done means generated projects can avoid conflicting configuration classes or give them distinct configurable names.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.