Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][TypeScript] angular modelSuffix nested model bad import #20726

Open
1 of 2 tasks
kudarias opened this issue Feb 25, 2025 · 0 comments
Open
1 of 2 tasks

[BUG][TypeScript] angular modelSuffix nested model bad import #20726

kudarias opened this issue Feb 25, 2025 · 0 comments

Comments

@kudarias
Copy link

Bug Report Checklist

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

While you generate api with typescript-angular and you will use modelSuffix as additional property, models are generated correctly, but if it is nested model for another model, the import is generated wrongly. Suffix is generated twice at the end of path from.

Example:
modelSuffix=example

GeneratedCode:
import { MunicipalityRestDtoExample } from './municipalityRestDtoExampleExample';

openapi-generator version

openapi-generator-cli version 7.11.0

OpenAPI declaration file content or url
{
  "openapi": "3.0.1",
  "info": {
    "title": "API",
    "description": "",
    "version": "0.0.4-SNAPSHOT"
  },
  "paths": {},
  "components": {
    "schemas": {
      "MunicipalityResponseRestDto": {
        "type": "object",
        "properties": {
          "municipalities": { "type": "array", "items": { "$ref": "#/components/schemas/MunicipalityRestDto" } }
        }
      },
      "MunicipalityRestDto": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "description": "Municipality name." }
        }
      }
    }
  }
}
Generation Details

openapi-generator-cli generate -i path/to/api.json -g typescript-angular --additional-properties=modelSuffix=example -o path/to/output/api

Steps to reproduce
  1. Create JSON file from spec above
  2. Generate api with command in generation details section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant