Skip to content

Commit e5e07ff

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular/cli): show deprecated workspace config options in IDE
With this change deprecated options in angular.json will be visible in the IDE. (cherry picked from commit 93ba050)
1 parent 6969c02 commit e5e07ff

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

tools/ng_cli_schema_generator.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ function generate(inPath, outPath) {
3939
throw new Error(`Error while resolving $ref ${value} in ${nestedSchemaPath}.`);
4040
}
4141
case '$id':
42-
case '$id':
43-
case '$schema':
4442
case 'id':
43+
case '$schema':
4544
case 'required':
45+
case 'x-prompt':
46+
case 'x-user-analytics':
4647
return undefined;
4748
default:
4849
return value;
@@ -69,7 +70,22 @@ function generate(inPath, outPath) {
6970
outPath = resolve(buildWorkspaceDirectory, outPath);
7071

7172
mkdirSync(dirname(outPath), { recursive: true });
72-
writeFileSync(outPath, JSON.stringify(schemaParsed, undefined, 2));
73+
writeFileSync(
74+
outPath,
75+
JSON.stringify(
76+
schemaParsed,
77+
(key, value) => {
78+
if (key === 'x-deprecated') {
79+
// Needed for IDEs, and will be replaced to 'deprecated' later on. This must be a boolean.
80+
// https://json-schema.org/draft/2020-12/json-schema-validation.html#name-deprecated
81+
return !!value;
82+
}
83+
84+
return value;
85+
},
86+
2,
87+
).replace(/"x-deprecated"/g, '"deprecated"'),
88+
);
7389
}
7490

7591
if (require.main === module) {

0 commit comments

Comments
 (0)