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

Improve type conversion for executor overrides passed via CLI #11519

Closed
Phault opened this issue Aug 9, 2022 · 2 comments
Closed

Improve type conversion for executor overrides passed via CLI #11519

Phault opened this issue Aug 9, 2022 · 2 comments

Comments

@Phault
Copy link

Phault commented Aug 9, 2022

Current Behavior

If an executor has an option of type string and you want to provide it with a string containing a number such '123', then the schema validation currently stops you:

$ nx run my-app:deploy --otp='123'

> nx run my-app:deploy --otp=123

Property 'otp' does not match the schema. '123' should be a 'string'.

Expected Behavior

Nx should not convert the number-looking string to a number. It should first look at the executor's schema and then decide whether converting the type makes sense. The same goes for boolean-looking strings.

Steps to Reproduce

A minimal repo is available here: https://github.com/Phault/ngx-deploy-npm-repro-351
Running nx run my-lib:deploy --dryRun --otp 123 will output:

Property 'otp' does not match the schema. '123' should be a 'string'.

The ngx-deploy-npm:deploy executor has an optional otp string parameter, which is the right type as the current npm 2fa implementation just happens to use numbers.

The --dryRun is just a fail-safe to avoid publishing to npm in case it for some reason does work. You can omit it and the result will be the same.

Failure Logs

Environment

   Node : 16.16.0
   OS   : darwin x64
   pnpm : 7.9.0

   nx : 14.3.6
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.3.6
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.3.6
   @nrwl/eslint-plugin-nx : 14.3.6
   @nrwl/express : Not Found
   @nrwl/jest : 14.3.6
   @nrwl/js : 14.3.6
   @nrwl/linter : 14.3.6
   @nrwl/nest : Not Found
   @nrwl/next : 14.3.6
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 14.3.0
   @nrwl/nx-plugin : 14.3.6
   @nrwl/react : 14.3.6
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.3.6
   @nrwl/web : 14.3.6
   @nrwl/workspace : 14.3.6
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
   	 @jscutlery/semver: 2.25.2
   	 ngx-deploy-npm: 4.1.2
@github-actions
Copy link

github-actions bot commented Feb 9, 2023

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants