GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Boolean options not parsed correctly on schematics cli · Issue #12150 · angular/angular-cli

Boolean options not parsed correctly on schematics cli #12150

New issue
Copy link
New issue
Copy link
Closed
#22779
Closed
Boolean options not parsed correctly on schematics cli#12150
#22779
Copy link
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
Backlog

Description

@alexeagle
alexeagle
opened on Sep 4, 2018
Issue body actions

From @TinyMan on January 14, 2018 17:11

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Area

- [x] devkit
- [ ] schematics

Versions

> node --version
v8.9.4
> npm --version
5.6.0
> ver
Microsoft Windows [version 10.0.16299.192]

> npm list -g --depth=0
+-- UNMET PEER DEPENDENCY @angular-devkit/[email protected]
+-- @angular-devkit/[email protected]
+-- @angular/[email protected]
+-- @schematics/[email protected]
+-- @types/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

npm ERR! peer dep missing: @angular-devkit/[email protected], required by @schematics/[email protected]
npm ERR! peer dep missing: @angular-devkit/[email protected], required by @schematics/[email protected]
npm ERR! peer dep missing: @angular-devkit/[email protected], required by @schematics/[email protected]

Repro steps

> schematics @schematics/angular:module --name test --routing true

The log given by the failure

Schematic input does not validate against the Schema: {"name":"test","routing":"true","path":"app","sourceDir":"src","routingScope":"Child","spec":true,"flat":false,"commonModule":true}
Errors:
  .routing should be boolean

Desired functionality

Boolean options should be parsed.
Right now it is true if only --routing is specified but it fails with --routing false or --routing true.
For --routing option it is not really a problem because by default it is false: we can set it to true with --routing.
However it is blocking for custom schematics with boolean option that defaults to true: we can't set it to false.

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 minimist assigns the string "true" or "false" to the option hence the error.

Copied from original issue: angular/devkit#393

Reacted by Michael Prentice, Vladislav Volkov, softoika, Mathias Boeck, Brian Via, Ben Congdon, Brian Mikinski, wolmeister, Dheepan Raju, janv93 and 1 more

Activity

  1. alexeagle
    added
    comp: angular-devkit/schematics
    freq3: high
    severity3: broken
    type: bug
    on Sep 4, 2018
  2. ngbot
    modified the milestone: needsTriage on Sep 4, 2018
  3. filipesilva
    added
    area: @angular-devkit/schematics
    type: bug/fix
    and removed
    comp: angular-devkit/schematics
    on Sep 7, 2018
  4. ngbot
    modified the milestones: needsTriage, Backlog on Sep 7, 2018
  5. filipesilva
    removed
    type: bug
    on Sep 7, 2018
  6. dxvladislavvolkov commented on Sep 25, 2018

    @dxvladislavvolkov
    dxvladislavvolkov
    on Sep 25, 2018
    More actions

    Any news about this?

  7. musou1500 commented on Sep 27, 2018

    @musou1500
    musou1500
    on Sep 27, 2018
    More actions

    How about using coerceTypes option?
    here is a coercion rules https://github.com/epoberezkin/ajv/blob/master/COERCION.md

    The 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'));
  8. alan-agius4
    added
    area: @angular-devkit/schematics-cli
    freq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarely
    and removed
    area: @angular-devkit/schematics
    freq3: high
    on Dec 2, 2019
  9. dgp1130
    added
    triage #1
    on May 26, 2020
  10. dgp1130
    closed this as completedin #22779on Mar 2, 2022
  11. dgp1130
    added a commit that references this issue on Mar 2, 2022

    refactor(@angular-devkit/schematics-cli): replace parser with yargs-p…

    This issue will close once commit 5330d52 is merged into the 'main' branch.
    5330d52
  12. angular-automatic-lock-bot commented on Apr 2, 2022

    @angular-automatic-lock-bot
    angular-automatic-lock-botBot
    on Apr 2, 2022
    More actions

    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.

  13. angular-automatic-lock-bot
    locked and limited conversation to collaborators on Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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

    Type

    No type

    Projects

    No projects

      Milestone

      • BacklogNo due date

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.