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

fix js identifiers containing dashes #315

Merged
merged 2 commits into from
Aug 23, 2022

Conversation

4rthem
Copy link
Contributor

@4rthem 4rthem commented Dec 13, 2021

Q A
Branch? main
Tickets
License MIT
Doc PR

With the following entity:

resources:
  App\Entity\FooBar:
    shortName: foo-bar

typescript template outputs invalid JS:

type foo-bar {
   // ...
}

The following PR replaces dashes to underscores to produce valid JS code.

@4rthem 4rthem changed the title typescript generator: normalize js identifiers fix js identifiers containing dashes Dec 13, 2021
@alanpoulain
Copy link
Member

Thanks for this PR.
I've made a little change: when the field name is an invalid identifier, it will be quoted instead.

@alanpoulain alanpoulain merged commit b9555f7 into api-platform:main Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants