Skip to content

Commit

Permalink
fix(@schematics/angular): add additionalProperties to all schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and filipesilva committed Mar 10, 2021
1 parent a09000c commit ba6f546
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 6 deletions.
1 change: 1 addition & 0 deletions packages/schematics/angular/app-shell/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "Angular AppShell Options Schema",
"type": "object",
"description": "Generates an app shell for running a server-side version of an app.",
"additionalProperties": false,
"long-description": "./app-shell-long.md",
"properties": {
"clientProject": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "Angular Application Options Schema",
"type": "object",
"description": "Generates a new basic app definition in the \"projects\" subfolder of the workspace.",
"additionalProperties": false,
"properties": {
"projectRoot": {
"description": "The root directory of the new app.",
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/class/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "Angular Class Options Schema",
"type": "object",
"description": "Creates a new generic class definition in the given or default project.",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/component/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "Angular Component Options Schema",
"type": "object",
"description": "Creates a new generic component definition in the given or default project.",
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/directive/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "Angular Directive Options Schema",
"type": "object",
"description": "Creates a new generic directive definition in the given or default project.",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/e2e/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularE2eApp",
"title": "Angular e2e Application Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Generates a new, generic end-to-end test definition for the given or default project.",
"long-description": "e2e-long.md",
"properties": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/enum/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "Angular Enum Options Schema",
"type": "object",
"description": "Generates a new, generic enum definition for the given or default project.",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/guard/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"title": "Angular Guard Options Schema",
"type": "object",
"description": "Generates a new, generic route guard definition in the given or default project.",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/interceptor/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularInterceptor",
"title": "Angular Interceptor Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new, generic interceptor definition in the given or default project.",
"properties": {
"name": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/interface/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularInterface",
"title": "Angular Interface Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new generic interface definition in the given or default project.",
"properties": {
"name": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/library/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"type": "object",
"description": "Creates a new generic library project in the current workspace.",
"long-description": "./library-long.md",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('Migration to version 9', () => {
{
name: 'migration-test',
version: '1.2.3',
directory: '.',
},
tree,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ describe('Migration to version 9', () => {
{
name: 'migration-test',
version: '1.2.3',
directory: '.',
},
tree,
)
Expand Down
14 changes: 10 additions & 4 deletions packages/schematics/angular/module/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
schematic,
url,
} from '@angular-devkit/schematics';
import { Schema as ComponentOptions } from '../component/schema';
import * as ts from '../third_party/github.com/Microsoft/TypeScript/lib/typescript';
import { addImportToModule, addRouteDeclarationToModule } from '../utility/ast-utils';
import { InsertChange } from '../utility/change';
Expand Down Expand Up @@ -167,15 +168,20 @@ export default function (options: ModuleOptions): Rule {
const modulePath =
`${!options.flat ? moduleDasherized + '/' : ''}${moduleDasherized}.module.ts`;

const componentOptions: ComponentOptions = {
module: modulePath,
flat: options.flat,
name: options.name,
path: options.path,
project: options.project,
};

return chain([
!isLazyLoadedModuleGen ? addDeclarationToNgModule(options) : noop(),
addRouteDeclarationToNgModule(options, routingModulePath),
mergeWith(templateSource),
isLazyLoadedModuleGen
? schematic('component', {
...options,
module: modulePath,
})
? schematic('component', componentOptions)
: noop(),
options.lintFix ? applyLintFix(options.path) : noop(),
]);
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/module/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularModule",
"title": "Angular Module Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new generic NgModule definition in the given or default project.",
"properties": {
"name": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/ng-new/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularNgNew",
"title": "Angular Ng New Options Schema",
"type": "object",
"additionalProperties": false,
"properties": {
"directory": {
"type": "string",
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/pipe/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularPipe",
"title": "Angular Pipe Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new generic pipe definition in the given or default project.",
"properties": {
"name": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/resolver/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularResolver",
"title": "Angular resolver Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Generates a new, generic resolver definition in the given or default project.",
"properties": {
"name": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/service-worker/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularServiceWorker",
"title": "Angular Service Worker Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Pass this schematic to the \"run\" command to create a service worker",
"properties": {
"project": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/service/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularService",
"title": "Angular Service Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new, generic service definition in the given or default project.",
"properties": {
"name": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/universal/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularUniversalApp",
"title": "Angular Universal App Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Pass this schematic to the \"run\" command to set up server-side rendering for an app.",
"properties": {
"clientProject": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/web-worker/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularWebWorker",
"title": "Angular Web Worker Options Schema",
"type": "object",
"additionalProperties": false,
"description": "Creates a new generic web worker definition in the given or default project.",
"properties": {
"path": {
Expand Down
1 change: 1 addition & 0 deletions packages/schematics/angular/workspace/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"id": "SchematicsAngularWorkspace",
"title": "Angular Workspace Options Schema",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "The name of the workspace.",
Expand Down

0 comments on commit ba6f546

Please sign in to comment.