Skip to content

Parser: Schematics options camelCase coercion #13544

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

Closed
nickofthyme opened this issue Jan 29, 2019 · 3 comments · Fixed by #22779
Closed

Parser: Schematics options camelCase coercion #13544

nickofthyme opened this issue Jan 29, 2019 · 3 comments · Fixed by #22779
Labels
area: @angular-devkit/schematics-cli feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature Issue that requests a new feature
Milestone

Comments

@nickofthyme
Copy link

🚀 Feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
- [x] schematics

Description

When passing arguments to schematics as options, I would like to be able to pass a dash-case option (i.e. ---dry-run) and get the camelCase equivalent (i.e. dryRun) in the options passed to my schematic.

Currently, if I pass the option option-one as a dash-case argument...

schematics my-collection:my-schematic --option-one=test

The factory function will receive the following options object...

{
    "option-one": "test"
}

Furthermore, if I were to pass both the dash-case and camelCase equivalent of the same argument like so...

schematics my-collection:my-schematic --option-one=test1 --optionOne=test2

The factory function will receive the following options object...

{
    "option-one": "test1",
    "optionOne": "test2"
}

This is not only very confusing but also inconsistent with the base schematics options such as --dry-run. Meaning that the following two commands are analogous...

schematics my-collection:my-schematic --dry-run=true
schematics my-collection:my-schematic --dryRun=true

Thereby treating dry-run as dryRun. I don't see a great use case for allowing two arguments of different cases to coexist.

Describe the solution you'd like

Option 1

Coerce all options argument to camelCase.

Option 2

Smart case corecursion of all options argument based on options schema.

Describe alternatives you've considered

Checking for both dash-case and camelCase options and resolving each option manually based on expected options schema.

@alan-agius4 alan-agius4 added feature Issue that requests a new feature area: @angular-devkit/schematics labels Jan 29, 2019
@ngbot ngbot bot added this to the Backlog milestone Jan 29, 2019
@alan-agius4 alan-agius4 changed the title Schematics options camelCase coercion Parser: Schematics options camelCase coercion Jan 9, 2020
@angular-robot
Copy link
Contributor

angular-robot bot commented Feb 1, 2022

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Feb 1, 2022
@ngbot ngbot bot modified the milestones: Backlog, needsTriage Feb 1, 2022
@angular-robot
Copy link
Contributor

angular-robot bot commented Feb 21, 2022

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

@angular-robot angular-robot bot added feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors and removed feature: votes required Feature request which is currently still in the voting phase labels Feb 21, 2022
dgp1130 pushed a commit that referenced this issue Mar 2, 2022
…arser

BREAKING CHANGE: camel case arguments are no longer allowed.

Closes #13544, closes #12150, closes #22173
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular-devkit/schematics-cli feature: insufficient votes Label to add when the not a sufficient number of votes or comments from unique authors feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants