Skip to content

Commit

Permalink
feat(@angular-devkit/core): remove deprecated schema id handling
Browse files Browse the repository at this point in the history
BREAKING CHANGE: With this change we drop support for the deprecated behaviour to transform `id` in schemas. Use `$id` instead.

Note: this only effects schematics and builders authors.
  • Loading branch information
alan-agius4 committed Aug 10, 2021
1 parent e95ecb8 commit 0c92ea5
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions packages/angular_devkit/core/src/json/schema/registry.ts
Expand Up @@ -235,7 +235,6 @@ export class CoreSchemaRegistry implements SchemaRegistry {
}

private async _flatten(schema: JsonObject): Promise<JsonObject> {
this._replaceDeprecatedSchemaIdKeyword(schema);
this._ajv.removeSchema(schema);

this._currentCompilationSchemaInfo = undefined;
Expand Down Expand Up @@ -294,8 +293,6 @@ export class CoreSchemaRegistry implements SchemaRegistry {
return async (data) => ({ success: schema, data });
}

this._replaceDeprecatedSchemaIdKeyword(schema);

const schemaInfo: SchemaInfo = {
smartDefaultRecord: new Map<string, JsonObject>(),
promptDefinitions: [],
Expand Down Expand Up @@ -680,22 +677,6 @@ export class CoreSchemaRegistry implements SchemaRegistry {
});
}

/**
* Workaround to avoid a breaking change in downstream schematics.
* @deprecated will be removed in version 13.
*/
private _replaceDeprecatedSchemaIdKeyword(schema: JsonObject): void {
if (typeof schema.id === 'string') {
schema.$id = schema.id;
delete schema.id;

// eslint-disable-next-line no-console
console.warn(
`"${schema.$id}" schema is using the keyword "id" which its support is deprecated. Use "$id" for schema ID.`,
);
}
}

private normalizeDataPathArr(it: SchemaObjCxt): (number | string)[] {
return it.dataPathArr
.slice(1, it.dataLevel + 1)
Expand Down

0 comments on commit 0c92ea5

Please sign in to comment.