OpenAPITools / OpenAPITools/openapi-generator
[BUG] Description
Nobody has claimed this yet.
- 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?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When I run openapi-generator-cli the Models and containing files are being output with their names containing the full namespace of the API classes. This is very awkward to read. I'd like the output to contain only the Model name, without the namespace.
E.g for class
namespace My.NameSpace.Common.V1.Models.Dto
{
public partial class PortfolioAsset
{
// properties
The output looks like
my-namespace-common-v1-models-dto-portfolio-asset.ts
With the content of the file as
export interface MyNamespaceCommonV1ModelsDtoPortfolioAsset {
// parameters
}
I just want the file to be called portfolio-asset.ts and the content to be
export interface PortfolioAsset {
// parameters
}
How can I do this?
##### openapi-generator version
5.2.1
##### OpenAPI declaration file content or url
<!-- if it is a bug, a json or yaml that produces it.
If you post the code inline, please wrap it with
```yaml
(here your code)
(for YAML code) or
(here your code)
(for JSON code), so it becomes more readable. If it is longer than about ten lines,
please create a Gist (https://gist.github.com) or upload it somewhere else and
link it here.
-->
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix
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 by reproducing the report with openapi-generator-cli 5.2.1 using the C# namespace example and inspect the generated model filenames and TypeScript declarations. The issue does not name a source file or test, so trace the model naming path first. Done means generated files use the model name only, such as portfolio-asset.ts, and the declaration is PortfolioAsset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100