Skip to content

Schema validation rejects *.json files in fileReplacements (Regression in 11.0.0 & 11.0.1) #19378

Closed
@mlc-mlapis

Description

@mlc-mlapis

🐞 Bug report

Command (mark with an x)

  • build
  • serve

Is this a regression?

Yes, the previous version in which this bug was not present was: 10.2.3

Description

There are new changes in files .\node_modules\@angular-devkit\build-angular\src\browser\schema.json and .\node_modules\@angular-devkit\build-angular\src\server\schema.json that restrict using *.json files in fileReplacements operations that were always available in previous versions.

These *.json files are normally used as configuration settings in the same way as *.ts files for different environments with the advantage that they are more easily parsable as standard JSON in the different platforms than TS.

There are no reasons why the new restriction should exist, and it's also unclear why it was changed at all.

New changes are:

"properties": {
	"src": {
		"type": "string",
		"pattern": "\\.([cm]?j|t)sx?$"
	},
	"replaceWith": {
		"type": "string",
		"pattern": "\\.([cm]?j|t)sx?$"
	}
}

and previous functional version:

"properties": {
	"src": {
		"type": "string"
	},
	"replaceWith": {
		"type": "string"
	}
}

🔥 Exception or Error


Schema validation failed with the following errors:
  Data path ".fileReplacements[0]" should NOT have additional properties(replace).
  Data path ".fileReplacements[0].replace" should match pattern "\.([cm]?j|t)sx?$".
  Data path ".fileReplacements[0]" should match exactly one schema in oneOf.

🌍 Your Environment


Angular CLI: 11.0.1
Node: 12.13.1
OS: win32 x64

Angular: 11.0.0
... animations, cdk, common, compiler, compiler-cli, core
... elements, forms, language-service, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: 

Package                          Version
----------------------------------------------------------
@angular-devkit/architect 0.1001.7
@angular-devkit/architect-cli 0.1100.1
@angular-devkit/build-angular 0.1100.1
@angular-devkit/core 10.1.7
@angular-devkit/schematics 10.1.7
@angular-devkit/schematics-cli 0.1100.1
@angular/cli 11.0.1
@schematics/angular 10.1.7
@schematics/update 0.1100.1
rxjs 6.6.3
typescript 4.0.5

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions