Accounts for schemas in when validating properties in Ivy. This PR resolves FW-819. A couple of notes: * I had to rework the test slightly, in order to have it fail when we expect it to. The one in master is passing since Ivy's validation runs during the update phase, rather than creation. * I had to deviate from the design in FW-819 and not add an `enableSchema` instruction, because the schema is part of the `NgModule` scope, however the scope is only assigned to a component once all of the module's declarations have been resolved and some of them can be async. Instead, I opted to have the `schemas` on the component definition. PR Close #28637
41 lines
962 B
TypeScript
41 lines
962 B
TypeScript
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
|
|
|
|
/**
|
|
* A schema definition associated with an NgModule.
|
|
*
|
|
* @see `@NgModule`, `CUSTOM_ELEMENTS_SCHEMA`, `NO_ERRORS_SCHEMA`
|
|
*
|
|
* @param name The name of a defined schema.
|
|
*
|
|
* @publicApi
|
|
*/
|
|
export interface SchemaMetadata { name: string; }
|
|
|
|
/**
|
|
* Defines a schema that allows an NgModule to contain the following:
|
|
* - Non-Angular elements named with dash case (`-`).
|
|
* - Element properties named with dash case (`-`).
|
|
* Dash case is the naming convention for custom elements.
|
|
*
|
|
* @publicApi
|
|
*/
|
|
export const CUSTOM_ELEMENTS_SCHEMA: SchemaMetadata = {
|
|
name: 'custom-elements'
|
|
};
|
|
|
|
/**
|
|
* Defines a schema that allows any property on any element.
|
|
*
|
|
* @publicApi
|
|
*/
|
|
export const NO_ERRORS_SCHEMA: SchemaMetadata = {
|
|
name: 'no-errors-schema'
|
|
};
|