Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit a44d76a

Browse files
Broccofilipesilva
authored andcommitted
fix(@schematics/angular): Validate to prevent additional properties
fixes angular/angular-cli#10722
1 parent c596614 commit a44d76a

File tree

19 files changed

+40
-23
lines changed

19 files changed

+40
-23
lines changed

packages/schematics/angular/app-shell/index.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
import * as ts from 'typescript';
1818
import {
1919
WorkspaceProject,
20-
WorkspaceSchema,
2120
WorkspaceTool,
2221
} from '../../../angular_devkit/core/src/workspace/workspace-schema';
2322
import { Schema as ComponentOptions } from '../component/schema';
@@ -171,12 +170,16 @@ function addUniversalTarget(options: AppShellOptions): Rule {
171170
// Copy options.
172171
const universalOptions = {
173172
...options,
174-
name: options.universalProject,
175173
};
176174

177175
// Delete non-universal options.
178176
delete universalOptions.universalProject;
179177
delete universalOptions.route;
178+
delete universalOptions.name;
179+
delete universalOptions.outDir;
180+
delete universalOptions.root;
181+
delete universalOptions.index;
182+
delete universalOptions.sourceDir;
180183

181184
return schematic('universal', universalOptions)(host, context);
182185
};

packages/schematics/angular/app-shell/schema.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
"description": "Route path used to produce the app shell.",
1818
"default": "shell"
1919
},
20-
21-
22-
2320
"name": {
2421
"type": "string",
2522
"format": "html-selector",
@@ -101,5 +98,6 @@
10198
"required": [
10299
"clientProject",
103100
"universalProject"
104-
]
101+
],
102+
"additionalProperties": false
105103
}

packages/schematics/angular/application/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@
6363
"description": "Do not add dependencies to package.json."
6464
}
6565
},
66-
"required": []
66+
"required": [],
67+
"additionalProperties": false
6768
}

packages/schematics/angular/class/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
"default": ""
3737
}
3838
},
39-
"required": []
39+
"required": [],
40+
"additionalProperties": false
4041
}

packages/schematics/angular/component/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,6 @@
100100
"description": "Specifies if declaring module exports the component."
101101
}
102102
},
103-
"required": []
103+
"required": [],
104+
"additionalProperties": false
104105
}

packages/schematics/angular/directive/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,6 @@
7070
"description": "Specifies if declaring module exports the directive."
7171
}
7272
},
73-
"required": []
73+
"required": [],
74+
"additionalProperties": false
7475
}

packages/schematics/angular/e2e/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
},
3131
"required": [
3232
"relatedAppName"
33-
]
33+
],
34+
"additionalProperties": false
3435
}

packages/schematics/angular/enum/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
}
2727
}
2828
},
29-
"required": []
29+
"required": [],
30+
"additionalProperties": false
3031
}

packages/schematics/angular/guard/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,6 @@
3636
}
3737
}
3838
},
39-
"required": []
39+
"required": [],
40+
"additionalProperties": false
4041
}

packages/schematics/angular/interface/schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@
3939
}
4040
}
4141
},
42-
"required": []
42+
"required": [],
43+
"additionalProperties": false
4344
}

0 commit comments

Comments
 (0)