angular-cli: Schema validation failed: Data path "" should NOT have additional properties

Bug Report or Feature Request (mark with an x)

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

Area

- [ ] devkit
- [x] schematics

Versions

Angular CLI: 6.0.8
Node: 8.11.2
OS: win32 x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.8
@angular-devkit/build-angular     0.6.8
@angular-devkit/build-optimizer   0.6.8
@angular-devkit/core              0.6.8
@angular-devkit/schematics        0.6.8
@angular/cli                      6.0.8
@ngtools/webpack                  6.0.8
@schematics/angular               0.6.8
@schematics/update                0.6.8
rxjs                              6.2.1
typescript                        2.7.2
webpack                           4.8.3

Repro steps

  1. Add projects/architect/<section>/options/invalid options to options in angular.json eg
    "build": {
           "builder": "@angular-devkit/build-angular:browser",
           "options": {
             "invalid": "value", 
             ...
           }
    }
    
  2. Run ng build

Actual functionality

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(invalid).

Desired functionality

Schema validation failed with the following errors:
  Data path "path/to/invalid/option" should NOT have additional properties(invalid).

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 24
  • Comments: 22 (1 by maintainers)

Most upvoted comments

For anyone having this problem while updating Ionic from 3 to 4: I had to remove “es5BrowserSupport”: true from angular.json

Apart from the error message not telling WHERE the problem is, it does tell you WHAT the problem is. I fixed one error and it gave me the next, which I fixed and so on.

Angular 11 with latest packages including "@angular-devkit/build-angular": "^0.1100.2"

For me it was my angular.json e2e lint where I had to change

from this

                "lint": {
                    "builder": "@angular-eslint/builder:lint",
                    "options": {
                        "tsConfig": "e2e/tsconfig.e2e.json",
                        "exclude": ["**/node_modules/**"]
                    }
                }

to this

                "lint": {
                    "builder": "@angular-eslint/builder:lint",
                    "options": {
                        "lintFilePatterns": ["e2e/**/*.ts", "e2e/**/*.html"]
                    }
                }

another issue showing

Schema validation failed with the following errors: Data path “” should have required property ‘tsConfig’.

In angular.json I had:

        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ],
            "tsConfig": [
              "projects/px-visualizations/tsconfig.lib.json",
              "projects/px-visualizations/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }

and got

Schema validation failed with the following errors: Data path “” should NOT have additional properties(tsConfig).

After upgrading from tslint to eslint. Luckely I was able to find this change in source control. It would be really helpful for the error to explain which invalid items are the issue.

        "lint": {
          "builder": "@angular-eslint/builder:lint",
          "options": {
            "lintFilePatterns": [
              "src/**/*.ts",
              "src/**/*.html"
            ]
          }

Fixed it. But I had no way other than guessing and reviewing source control to determine what the issue was.

I cant set allowedCommonJsDependencies as described here: https://angular.io/guide/build#configuring-commonjs-dependencies :

Schema validation failed with the following errors: Data path “” should NOT have additional properties(allowedCommonJsDependencies).

Version:

Angular CLI: 11.2.3
Node: 15.6.0
OS: darwin x64

Angular: 11.2.4
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1102.3
@angular-devkit/build-angular   0.1102.3
@angular-devkit/core            11.2.3
@angular-devkit/schematics      11.2.3
@angular/cli                    11.2.3
@schematics/angular             11.2.3
@schematics/update              0.1102.3
ng-packagr                      11.2.4
rxjs                            6.6.3
typescript                      4.0.7

I have some kind of a similar issue but when I run ng serve :

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(watch).

Furthermore there is no watch property in my angular.json

packages version of my project :

Angular CLI: 6.0.8
Node: 10.1.0
OS: darwin x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.8
@angular-devkit/build-angular      0.6.8
@angular-devkit/build-ng-packagr   0.6.8
@angular-devkit/build-optimizer    0.6.8
@angular-devkit/core               0.6.8
@angular-devkit/schematics         0.6.8
@angular/cdk                       6.3.2
@angular/cli                       6.0.8
@angular/material                  6.3.2
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.8
@schematics/angular                0.6.8
@schematics/update                 0.6.8
ng-packagr                         3.0.3
rxjs                               6.2.1
typescript                         2.7.2
webpack                            4.8.3

I posted a fix to a similar schema validation error in #14338

Based on these two answers on StackOverflow also related to schema validation errors :

  1. Updated package.json from “@angular-devkit/build-angular”: “^0.800.1” to “^0.12.4”
  2. Run npm install

See if that works.

Please note that 0.12.4 is significantly older than 0.800.1.

Check if your apps angular.json file is valid and any changes you made to that file are correct

I’m experiencing the same problem. I’m trying to run cypress as e2e test-runner. This is the config as described in de examples:

"test-cypress-app-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "ngx-cypress-builder:cypress",
          "options": {
            "devServerTarget": "test-cypress-app:serve",
            "mode": "browser"
          },
          "configurations": {
            "production": {
              "devServerTarget": "test-cypress-app:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },

I get an error :

Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(mode).

Mode is however a valid property, as seen in this example: https://github.com/isaacplmann/ngx-cypress-builder/blob/master/sample/angular.json

Angular CLI: 6.1.5
Node: 8.11.2
OS: darwin x64
Angular: 6.1.6
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.5
@angular-devkit/build-angular     0.7.5
@angular-devkit/build-optimizer   0.7.5
@angular-devkit/build-webpack     0.7.5
@angular-devkit/core              0.7.5
@angular-devkit/schematics        0.7.5
@angular/cli                      6.1.5
@ngtools/webpack                  6.1.5
@schematics/angular               0.7.5
@schematics/update                0.7.5
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.9.2