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] [modelPropertyNaming] when sanitized, model property name gets forced into snake_case #19352

Closed
5 of 6 tasks
davidediak opened this issue Aug 14, 2024 · 0 comments · Fixed by #19508

Comments

@davidediak
Copy link
Contributor

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 have a model property that will be sanitized e.g.

        "properties": {
          "property.name": {
            ...
          }
        }

the output will be

export interface CustomerResponse { 
    property_name: string;
}

This is clearly unfriendly, since it's lying about the openAPI contract for that given model.
What I'd expect for such cases in typescript is this result:

export interface CustomerResponse { 
    'property.name': string;
}

openapi-generator version

7.7.0 (master)

OpenAPI declaration file content or url

JSON spec

Generation Details

On master run
./run-in-docker.sh mvn package
./run-in-docker.sh generate -i spec.json -g typescript-angular --minimal-update --global-property models

you'll get a misleading interface, with a snake_cased property name.

Steps to reproduce
Related issues/PRs
Suggest a fix

I'll open a PR to fix this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment