@angular-devkit/core 11.1.4 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -93,6 +93,11 @@ export declare type PromptProvider = (definitions: Array<PromptDefinition>) => S
|
|
|
93
93
|
}>;
|
|
94
94
|
export interface SchemaRegistry {
|
|
95
95
|
compile(schema: Object): Observable<SchemaValidator>;
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated since 11.2 without replacement.
|
|
98
|
+
* Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original.
|
|
99
|
+
* See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2
|
|
100
|
+
*/
|
|
96
101
|
flatten(schema: JsonObject | string): Observable<JsonObject>;
|
|
97
102
|
addFormat(format: SchemaFormat): void;
|
|
98
103
|
addSmartDefaultProvider<T>(source: string, provider: SmartDefaultProvider<T>): void;
|
|
@@ -53,6 +53,9 @@ export declare class CoreSchemaRegistry implements SchemaRegistry {
|
|
|
53
53
|
*
|
|
54
54
|
* @param schema The schema or URI to flatten.
|
|
55
55
|
* @returns An Observable of the flattened schema object.
|
|
56
|
+
* @deprecated since 11.2 without replacement.
|
|
57
|
+
* Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original.
|
|
58
|
+
* See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2
|
|
56
59
|
*/
|
|
57
60
|
flatten(schema: JsonObject): Observable<JsonObject>;
|
|
58
61
|
/**
|
|
@@ -166,6 +166,9 @@ class CoreSchemaRegistry {
|
|
|
166
166
|
*
|
|
167
167
|
* @param schema The schema or URI to flatten.
|
|
168
168
|
* @returns An Observable of the flattened schema object.
|
|
169
|
+
* @deprecated since 11.2 without replacement.
|
|
170
|
+
* Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original.
|
|
171
|
+
* See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2
|
|
169
172
|
*/
|
|
170
173
|
flatten(schema) {
|
|
171
174
|
this._ajv.removeSchema(schema);
|
|
@@ -457,12 +460,25 @@ class CoreSchemaRegistry {
|
|
|
457
460
|
? undefined
|
|
458
461
|
: parentSchema.default,
|
|
459
462
|
async validator(data) {
|
|
463
|
+
var _a;
|
|
460
464
|
try {
|
|
461
|
-
|
|
465
|
+
const result = await it.self.validate(parentSchema, data);
|
|
466
|
+
// If the schema is sync then false will be returned on validation failure
|
|
467
|
+
if (result) {
|
|
468
|
+
return result;
|
|
469
|
+
}
|
|
470
|
+
else if ((_a = it.self.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
471
|
+
// Validation errors will be present on the Ajv instance when sync
|
|
472
|
+
return it.self.errors[0].message;
|
|
473
|
+
}
|
|
462
474
|
}
|
|
463
|
-
catch (
|
|
464
|
-
|
|
475
|
+
catch (e) {
|
|
476
|
+
// If the schema is async then an error will be thrown on validation failure
|
|
477
|
+
if (Array.isArray(e.errors) && e.errors.length) {
|
|
478
|
+
return e.errors[0].message;
|
|
479
|
+
}
|
|
465
480
|
}
|
|
481
|
+
return false;
|
|
466
482
|
},
|
|
467
483
|
};
|
|
468
484
|
compilationSchemInfo.promptDefinitions.push(definition);
|