-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Nx does not respect types defined in schema.json #1952
Comments
@ZachJW34 That sounds like a good idea. We should add an e2e test to cover this ( |
ZachJW34
added a commit
to ZachJW34/nx
that referenced
this issue
Oct 19, 2019
ZachJW34
added a commit
to ZachJW34/nx
that referenced
this issue
Oct 19, 2019
vsavkin
pushed a commit
that referenced
this issue
Oct 31, 2019
Doginal
pushed a commit
to Doginal/nx
that referenced
this issue
Nov 7, 2019
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Expected Behavior
Running a custom schematic using
npm run workspace-schematic -- custom-schematic --routing false
with a schema.json ofshould run without error.
Current Behavior
The schematic fails with error:
Steps to Reproduce
Create a custom schematic that has a boolean property that defaults to true and overwrite the property to false on the command line.
Context
The AngularCLI implements its own parser for command line inputs. Nx uses
yargs
and the handoff the the parsedyargs
args to the AngularCLI for running schematics does not mesh well. The reason the schematic fails is therouting
boolean is parsed as'false'
, a string rather than a boolean.This can be remedied by always having boolean properties default to
false
in the schema.json and passing just the flag i.e.npm run workspace-schematic -- custom-schematic --routing
, but this is limiting. This problem compounds if schematic schemas are more complex. For example, it is not possible to pass an array without comma delimiting it and splitting the string.The boolean problem can be fixed by reading the schema.json associated with the schematic being run and adding the properties with
type === boolean
to theyargs-parser
config seen here. This isn't a perfect solution, but building an equivalency between nx and the angular cli is a bit involved.Let me know what you think. I can submit a PR fixing the boolean problem.
The text was updated successfully, but these errors were encountered: