Skip to content

Calling externalSchematics now throws an error for additionalProperties #11681

Closed
@FrozenPandaz

Description

@FrozenPandaz

Bug Report or Feature Request (mark with an x)

NOTE: I think this is a regression, as the same code worked with 6.0.x and does not work with 6.1.x

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

Command (mark with an x)

It's most likely an issue with devkit

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

Versions

jason@Jason-PC-U:~/projects/work/temp/temp/proj$ node -v && npm -v && yarn -v && ng -v
v8.11.1
6.1.0
1.7.0

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | | /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|                |___/


Angular CLI: 6.1.1
Node: 8.11.1
OS: linux x64
Angular: 6.1.0
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.1
@angular-devkit/build-angular     0.7.1
@angular-devkit/build-optimizer   0.7.1
@angular-devkit/build-webpack     0.7.1
@angular-devkit/core              0.7.1
@angular-devkit/schematics        0.7.1
@angular/cli                      6.1.1
@ngtools/webpack                  6.1.1
@schematics/angular               0.7.1
@schematics/update                0.7.1
rxjs                              6.0.0
typescript                        2.7.2
webpack                           4.9.2

Repro steps

This occurs when trying to "extend" a schematic.

options = {
  name: 'blah', <1>
  publishable: false <2>
}
externalSchematic('@schematics/angular', 'library', options), <3>
  1. Most of the options should extend the base schematic
  2. Additional options are added to the extension schematic
  3. All options are sent to the base schematic
    An error occurs when the schematic is called via externalSchematic

The log given by the failure

Schematic input does not validate against the Schema: {"inlineStyle":false,"inlineTemplate":false,"routing":false,"style":"css","skipTests":false,"skipFormat":false,"skipPackageJson":false,"name":"app1","prefix":"proj","appProjectRoot":"apps/app1","e2eProjectRoot":"apps/app1-e2e","e2eProjectName":"app1-e2e","parsedTags":[]}
Errors:

  Data path "" should NOT have additional properties(skipFormat).

Desired functionality

Option 1 - Revert to old behavior

It used to work pretty well before. The additional options were ignored. This is probably fine for externalSchematic while I understand it might be good for manual inputs.

Option 2 - Maybe a flag which disables the verification might be a good option for externalSchematics.

Option 3 - A more formal way to extend individual schematics is added.

Option 4 - Schematic libraries should export their rule which can be used without verification of inputs. This is beneficial because it could come with typing information and can be caught during compilation.

Mention any other details that might be useful

This is a regression from my point of view. The code used to work back in 6.0.x. When upgrading to 6.1.1, I am seeing this issue.

https://github.com/nrwl/nx

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions