Repository navigation
Boolean options not parsed correctly on schematics cli #12150
Copy link
Copy link
Closed
Labels
area: @angular-devkit/schematics-clifreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix
Milestone
Description
Activity
Any news about this?
How about using
coerceTypesoption?
here is a coercion rules https://github.com/epoberezkin/ajv/blob/master/COERCION.mdThe patch will be as follows.
diff --git a/packages/angular_devkit/core/src/json/schema/registry.ts b/packages/angular_devkit/core/src/json/schema/registry.ts index 06321af8..5638fa08 100644 --- a/packages/angular_devkit/core/src/json/schema/registry.ts +++ b/packages/angular_devkit/core/src/json/schema/registry.ts @@ -115,6 +115,7 @@ export class CoreSchemaRegistry implements SchemaRegistry { loadSchema: (uri: string) => this._fetch(uri), schemaId: 'auto', passContext: true, + coerceTypes: true }); this._ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
- addedfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyand removed
on Dec 2, 2019 - added a commit that references this issue
on Mar 2, 2022 angular-automatic-lock-bot commented
on Apr 2, 2022 More actionsThis 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.
- locked and limited conversation to collaborators
on Apr 2, 2022
Metadata
Metadata
Assignees
Labels
area: @angular-devkit/schematics-clifreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity3: brokentype: bug/fix
From @TinyMan on January 14, 2018 17:11
Bug Report or Feature Request (mark with an
x)Area
Versions
Repro steps
The log given by the failure
Desired functionality
Boolean options should be parsed.
Right now it is true if only
--routingis specified but it fails with--routing falseor--routing true.For
--routingoption it is not really a problem because by default it isfalse: we can set it totruewith--routing.However it is blocking for custom schematics with boolean option that defaults to
true: we can't set it tofalse.Mention any other details that might be useful
Only the arguments specified here are parsed as booleans:
https://github.com/angular/devkit/blob/c88d991344a910903c2178b537a919c9da2de03f/packages/angular_devkit/schematics_cli/bin/schematics.ts#L102
After this
minimistassigns the string "true" or "false" to the option hence the error.Copied from original issue: angular/devkit#393