diff --git a/packages/angular_devkit/architect/src/architect.ts b/packages/angular_devkit/architect/src/architect.ts index aecbeb06ea05..6dbf97cb5179 100644 --- a/packages/angular_devkit/architect/src/architect.ts +++ b/packages/angular_devkit/architect/src/architect.ts @@ -48,9 +48,6 @@ import { import { mergeOptions } from './options'; import { scheduleByName, scheduleByTarget } from './schedule-by-name'; -const inputSchema = require('./input-schema.json'); -const outputSchema = require('./output-schema.json'); - function _createJobHandlerFromBuilderInfo( info: BuilderInfo, target: Target | undefined, @@ -60,9 +57,9 @@ function _createJobHandlerFromBuilderInfo( ): Observable { const jobDescription: BuilderDescription = { name: target ? `{${targetStringFromTarget(target)}}` : info.builderName, - argument: { type: 'object' }, - input: inputSchema, - output: outputSchema, + argument: true, + input: true, + output: true, info, }; @@ -279,8 +276,6 @@ function _getTargetOptionsFactory(host: ArchitectHost) { }, { name: '..getTargetOptions', - output: { type: 'object' }, - argument: inputSchema.properties.target, }, ); } @@ -298,10 +293,6 @@ function _getProjectMetadataFactory(host: ArchitectHost) { }, { name: '..getProjectMetadata', - output: { type: 'object' }, - argument: { - oneOf: [{ type: 'string' }, inputSchema.properties.target], - }, }, ); } @@ -318,8 +309,6 @@ function _getBuilderNameForTargetFactory(host: ArchitectHost) { }, { name: '..getBuilderNameForTarget', - output: { type: 'string' }, - argument: inputSchema.properties.target, }, ); } @@ -344,11 +333,6 @@ function _validateOptionsFactory(host: ArchitectHost, registry: json.schema.Sche }, { name: '..validateOptions', - output: { type: 'object' }, - argument: { - type: 'array', - items: [{ type: 'string' }, { type: 'object' }], - }, }, ); } diff --git a/packages/angular_devkit/architect/src/jobs/simple-scheduler.ts b/packages/angular_devkit/architect/src/jobs/simple-scheduler.ts index 2c82b0d90052..8dacbbe687f8 100644 --- a/packages/angular_devkit/architect/src/jobs/simple-scheduler.ts +++ b/packages/angular_devkit/architect/src/jobs/simple-scheduler.ts @@ -155,11 +155,22 @@ export class SimpleScheduler< channels: handler.jobDescription.channels || {}, }; + const noopValidator = noopSchemaValidator(); + const handlerWithExtra = Object.assign(handler.bind(undefined), { jobDescription: description, - argumentV: this._schemaRegistry.compile(description.argument), - inputV: this._schemaRegistry.compile(description.input), - outputV: this._schemaRegistry.compile(description.output), + argumentV: + description.argument === true + ? noopValidator + : this._schemaRegistry.compile(description.argument), + inputV: + description.input === true + ? noopValidator + : this._schemaRegistry.compile(description.input), + outputV: + description.output === true + ? noopValidator + : this._schemaRegistry.compile(description.output), }) as JobHandlerWithExtra; this._internalJobDescriptionMap.set(name, handlerWithExtra); @@ -546,3 +557,10 @@ export class SimpleScheduler< return this._createJob(name, argument, handler, inboundBus, outboundBus); } } + +async function noopSchemaValidator(): Promise { + return async (data: JsonValue) => ({ + data, + success: true, + }); +}