@itwin/ecschema-editing 4.10.0-dev.31 → 4.10.0-dev.33

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.
Files changed (67) hide show
  1. package/lib/cjs/Differencing/SchemaDifference.js +2 -2
  2. package/lib/cjs/Differencing/SchemaDifference.js.map +1 -1
  3. package/lib/cjs/Differencing/SchemaDifferenceValidator.js +1 -2
  4. package/lib/cjs/Differencing/SchemaDifferenceValidator.js.map +1 -1
  5. package/lib/cjs/Differencing/Utils.js +21 -22
  6. package/lib/cjs/Differencing/Utils.js.map +1 -1
  7. package/lib/cjs/Editing/Exception.d.ts.map +1 -1
  8. package/lib/cjs/Editing/Mutable/MutableRelationshipClass.d.ts.map +1 -1
  9. package/lib/cjs/Editing/Properties.js +2 -2
  10. package/lib/cjs/Editing/Properties.js.map +1 -1
  11. package/lib/cjs/Merging/ClassMerger.js +1 -2
  12. package/lib/cjs/Merging/ClassMerger.js.map +1 -1
  13. package/lib/cjs/Merging/ConstantMerger.js +2 -3
  14. package/lib/cjs/Merging/ConstantMerger.js.map +1 -1
  15. package/lib/cjs/Merging/CustomAttributeClassMerger.js +2 -3
  16. package/lib/cjs/Merging/CustomAttributeClassMerger.js.map +1 -1
  17. package/lib/cjs/Merging/CustomAttributeMerger.js +3 -4
  18. package/lib/cjs/Merging/CustomAttributeMerger.js.map +1 -1
  19. package/lib/cjs/Merging/Edits/RenameEditHandler.js +2 -3
  20. package/lib/cjs/Merging/Edits/RenameEditHandler.js.map +1 -1
  21. package/lib/cjs/Merging/Edits/SkipEditHandler.js +1 -2
  22. package/lib/cjs/Merging/Edits/SkipEditHandler.js.map +1 -1
  23. package/lib/cjs/Merging/EntityClassMerger.js +3 -4
  24. package/lib/cjs/Merging/EntityClassMerger.js.map +1 -1
  25. package/lib/cjs/Merging/EnumerationMerger.js +2 -3
  26. package/lib/cjs/Merging/EnumerationMerger.js.map +1 -1
  27. package/lib/cjs/Merging/EnumeratorMerger.js +2 -3
  28. package/lib/cjs/Merging/EnumeratorMerger.js.map +1 -1
  29. package/lib/cjs/Merging/KindOfQuantityMerger.js +3 -4
  30. package/lib/cjs/Merging/KindOfQuantityMerger.js.map +1 -1
  31. package/lib/cjs/Merging/MixinMerger.js +2 -3
  32. package/lib/cjs/Merging/MixinMerger.js.map +1 -1
  33. package/lib/cjs/Merging/PhenomenonMerger.js +2 -3
  34. package/lib/cjs/Merging/PhenomenonMerger.js.map +1 -1
  35. package/lib/cjs/Merging/PropertyCategoryMerger.js +2 -3
  36. package/lib/cjs/Merging/PropertyCategoryMerger.js.map +1 -1
  37. package/lib/cjs/Merging/PropertyMerger.js +2 -3
  38. package/lib/cjs/Merging/PropertyMerger.js.map +1 -1
  39. package/lib/cjs/Merging/RelationshipClassMerger.js +4 -5
  40. package/lib/cjs/Merging/RelationshipClassMerger.js.map +1 -1
  41. package/lib/cjs/Merging/SchemaReferenceMerger.js +2 -3
  42. package/lib/cjs/Merging/SchemaReferenceMerger.js.map +1 -1
  43. package/lib/cjs/Merging/StructClassMerger.js +2 -3
  44. package/lib/cjs/Merging/StructClassMerger.js.map +1 -1
  45. package/lib/cjs/Merging/UnitSystemMerger.js +2 -3
  46. package/lib/cjs/Merging/UnitSystemMerger.js.map +1 -1
  47. package/lib/cjs/Merging/Utils.js +4 -5
  48. package/lib/cjs/Merging/Utils.js.map +1 -1
  49. package/lib/cjs/Validation/Diagnostic.d.ts +2 -2
  50. package/lib/cjs/Validation/Diagnostic.d.ts.map +1 -1
  51. package/lib/cjs/Validation/Diagnostic.js +9 -9
  52. package/lib/cjs/Validation/Diagnostic.js.map +1 -1
  53. package/lib/cjs/Validation/DiagnosticReporter.js +1 -1
  54. package/lib/cjs/Validation/DiagnosticReporter.js.map +1 -1
  55. package/lib/cjs/Validation/ECRules.js +19 -19
  56. package/lib/cjs/Validation/ECRules.js.map +1 -1
  57. package/lib/cjs/Validation/RuleSuppressionSet.d.ts +2 -2
  58. package/lib/cjs/Validation/RuleSuppressionSet.d.ts.map +1 -1
  59. package/lib/cjs/Validation/RuleSuppressionSet.js.map +1 -1
  60. package/lib/cjs/Validation/Rules.d.ts +1 -1
  61. package/lib/cjs/Validation/Rules.d.ts.map +1 -1
  62. package/lib/cjs/Validation/Rules.js.map +1 -1
  63. package/lib/cjs/Validation/SchemaValidationVisitor.js.map +1 -1
  64. package/lib/cjs/ecschema-editing.d.ts.map +1 -1
  65. package/lib/cjs/ecschema-editing.js +0 -1
  66. package/lib/cjs/ecschema-editing.js.map +1 -1
  67. package/package.json +13 -13
@@ -7,7 +7,25 @@
7
7
  * @module Validation
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.validateCustomAttributeInstance = exports.mixinAppliedToClassMustDeriveFromConstraint = exports.enumerationTypeUnsupported = exports.abstractConstraintMustExistWithMultipleConstraints = exports.atLeastOneConstraintClassDefined = exports.validateRelationshipConstraint = exports.constraintClassesDeriveFromAbstractConstraint = exports.derivedConstraintsMustNarrowBaseConstraints = exports.abstractConstraintMustNarrowBaseConstraints = exports.validateRelationship = exports.validateNavigationProperty = exports.incompatibleUnitPropertyOverride = exports.incompatibleTypePropertyOverride = exports.incompatibleValueTypePropertyOverride = exports.baseClassIsOfDifferentType = exports.baseClassIsSealed = exports.validateSchemaReferencesSync = exports.validateSchemaReferences = exports.ECRuleSet = exports.Diagnostics = exports.DiagnosticCodes = void 0;
10
+ exports.ECRuleSet = exports.Diagnostics = exports.DiagnosticCodes = void 0;
11
+ exports.validateSchemaReferences = validateSchemaReferences;
12
+ exports.validateSchemaReferencesSync = validateSchemaReferencesSync;
13
+ exports.baseClassIsSealed = baseClassIsSealed;
14
+ exports.baseClassIsOfDifferentType = baseClassIsOfDifferentType;
15
+ exports.incompatibleValueTypePropertyOverride = incompatibleValueTypePropertyOverride;
16
+ exports.incompatibleTypePropertyOverride = incompatibleTypePropertyOverride;
17
+ exports.incompatibleUnitPropertyOverride = incompatibleUnitPropertyOverride;
18
+ exports.validateNavigationProperty = validateNavigationProperty;
19
+ exports.validateRelationship = validateRelationship;
20
+ exports.abstractConstraintMustNarrowBaseConstraints = abstractConstraintMustNarrowBaseConstraints;
21
+ exports.derivedConstraintsMustNarrowBaseConstraints = derivedConstraintsMustNarrowBaseConstraints;
22
+ exports.constraintClassesDeriveFromAbstractConstraint = constraintClassesDeriveFromAbstractConstraint;
23
+ exports.validateRelationshipConstraint = validateRelationshipConstraint;
24
+ exports.atLeastOneConstraintClassDefined = atLeastOneConstraintClassDefined;
25
+ exports.abstractConstraintMustExistWithMultipleConstraints = abstractConstraintMustExistWithMultipleConstraints;
26
+ exports.enumerationTypeUnsupported = enumerationTypeUnsupported;
27
+ exports.mixinAppliedToClassMustDeriveFromConstraint = mixinAppliedToClassMustDeriveFromConstraint;
28
+ exports.validateCustomAttributeInstance = validateCustomAttributeInstance;
11
29
  const ecschema_metadata_1 = require("@itwin/ecschema-metadata");
12
30
  const Diagnostic_1 = require("./Diagnostic");
13
31
  const ruleSetName = "ECObjects";
@@ -169,7 +187,6 @@ exports.ECRuleSet = {
169
187
  async function* validateSchemaReferences(schema) {
170
188
  yield* validateSchemaReferencesSync(schema);
171
189
  }
172
- exports.validateSchemaReferences = validateSchemaReferences;
173
190
  /**
174
191
  * Validates schema references against multiple EC rules.
175
192
  * @param schema The schema to validate.
@@ -197,7 +214,6 @@ function* validateSchemaReferencesSync(schema) {
197
214
  yield new exports.Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, result]);
198
215
  }
199
216
  }
200
- exports.validateSchemaReferencesSync = validateSchemaReferencesSync;
201
217
  /**
202
218
  * EC Rule: Sealed classes cannot be a base class.
203
219
  * @internal
@@ -211,7 +227,6 @@ async function* baseClassIsSealed(ecClass) {
211
227
  return;
212
228
  yield new exports.Diagnostics.BaseClassIsSealed(ecClass, [ecClass.fullName, baseClass.fullName]);
213
229
  }
214
- exports.baseClassIsSealed = baseClassIsSealed;
215
230
  /**
216
231
  * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.)
217
232
  * @internal
@@ -226,7 +241,6 @@ async function* baseClassIsOfDifferentType(ecClass) {
226
241
  const itemType = baseClass.schemaItemType;
227
242
  yield new exports.Diagnostics.BaseClassIsOfDifferentType(ecClass, [ecClass.fullName, baseClass.fullName, itemType]);
228
243
  }
229
- exports.baseClassIsOfDifferentType = baseClassIsOfDifferentType;
230
244
  /**
231
245
  * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...).
232
246
  * @internal
@@ -257,7 +271,6 @@ async function* incompatibleValueTypePropertyOverride(property) {
257
271
  yield result;
258
272
  }
259
273
  }
260
- exports.incompatibleValueTypePropertyOverride = incompatibleValueTypePropertyOverride;
261
274
  /**
262
275
  * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).
263
276
  * @internal
@@ -280,7 +293,6 @@ async function* incompatibleTypePropertyOverride(property) {
280
293
  yield result;
281
294
  }
282
295
  }
283
- exports.incompatibleTypePropertyOverride = incompatibleTypePropertyOverride;
284
296
  /**
285
297
  * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.
286
298
  * @internal
@@ -323,7 +335,6 @@ async function* incompatibleUnitPropertyOverride(property) {
323
335
  yield result;
324
336
  }
325
337
  }
326
- exports.incompatibleUnitPropertyOverride = incompatibleUnitPropertyOverride;
327
338
  /**
328
339
  * Validates Navigation Properties. EC Rules: 1303, 1304
329
340
  * @internal
@@ -379,7 +390,6 @@ async function* validateNavigationProperty(property) {
379
390
  }
380
391
  return;
381
392
  }
382
- exports.validateNavigationProperty = validateNavigationProperty;
383
393
  /**
384
394
  * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.
385
395
  * @internal
@@ -389,7 +399,6 @@ async function* validateRelationship(ecClass) {
389
399
  yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);
390
400
  yield* constraintClassesDeriveFromAbstractConstraint(ecClass);
391
401
  }
392
- exports.validateRelationship = validateRelationship;
393
402
  /**
394
403
  * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.
395
404
  * @internal
@@ -405,7 +414,6 @@ async function* abstractConstraintMustNarrowBaseConstraints(ecClass) {
405
414
  if (targetResult)
406
415
  yield targetResult;
407
416
  }
408
- exports.abstractConstraintMustNarrowBaseConstraints = abstractConstraintMustNarrowBaseConstraints;
409
417
  /**
410
418
  * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.
411
419
  * @internal
@@ -421,7 +429,6 @@ async function* derivedConstraintsMustNarrowBaseConstraints(ecClass) {
421
429
  if (targetResult)
422
430
  yield targetResult;
423
431
  }
424
- exports.derivedConstraintsMustNarrowBaseConstraints = derivedConstraintsMustNarrowBaseConstraints;
425
432
  /**
426
433
  * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.
427
434
  * @internal
@@ -434,7 +441,6 @@ async function* constraintClassesDeriveFromAbstractConstraint(ecClass) {
434
441
  if (targetResult)
435
442
  yield targetResult;
436
443
  }
437
- exports.constraintClassesDeriveFromAbstractConstraint = constraintClassesDeriveFromAbstractConstraint;
438
444
  /**
439
445
  * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.
440
446
  * @internal
@@ -443,7 +449,6 @@ async function* validateRelationshipConstraint(constraint) {
443
449
  yield* atLeastOneConstraintClassDefined(constraint);
444
450
  yield* abstractConstraintMustExistWithMultipleConstraints(constraint);
445
451
  }
446
- exports.validateRelationshipConstraint = validateRelationshipConstraint;
447
452
  /**
448
453
  * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.
449
454
  * @internal
@@ -454,7 +459,6 @@ async function* atLeastOneConstraintClassDefined(constraint) {
454
459
  yield new exports.Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);
455
460
  }
456
461
  }
457
- exports.atLeastOneConstraintClassDefined = atLeastOneConstraintClassDefined;
458
462
  /**
459
463
  * EC Rule: If multiple constraints exist, an abstract constraint must be defined.
460
464
  * @internal
@@ -469,7 +473,6 @@ async function* abstractConstraintMustExistWithMultipleConstraints(constraint) {
469
473
  const constraintType = constraint.isSource ? ecschema_metadata_1.ECStringConstants.RELATIONSHIP_END_SOURCE : ecschema_metadata_1.ECStringConstants.RELATIONSHIP_END_TARGET;
470
474
  yield new exports.Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);
471
475
  }
472
- exports.abstractConstraintMustExistWithMultipleConstraints = abstractConstraintMustExistWithMultipleConstraints;
473
476
  function propertyTypesMatch(propertyA, propertyB) {
474
477
  return propertyA.constructor.name === propertyB.constructor.name;
475
478
  }
@@ -488,7 +491,6 @@ async function* enumerationTypeUnsupported(enumeration) {
488
491
  return;
489
492
  yield new exports.Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);
490
493
  }
491
- exports.enumerationTypeUnsupported = enumerationTypeUnsupported;
492
494
  /**
493
495
  * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.
494
496
  * @internal
@@ -503,7 +505,6 @@ async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass) {
503
505
  }
504
506
  return;
505
507
  }
506
- exports.mixinAppliedToClassMustDeriveFromConstraint = mixinAppliedToClassMustDeriveFromConstraint;
507
508
  /**
508
509
  * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.
509
510
  * @internal
@@ -513,7 +514,6 @@ async function* validateCustomAttributeInstance(container, customAttribute) {
513
514
  yield* customAttributeSchemaMustBeReferenced(container, customAttribute);
514
515
  yield* customAttributeClassMustExist(container, customAttribute);
515
516
  }
516
- exports.validateCustomAttributeInstance = validateCustomAttributeInstance;
517
517
  /** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */
518
518
  async function* customAttributeNotOfConcreteClass(container, customAttribute) {
519
519
  const schema = container.schema;
@@ -1 +1 @@
1
- {"version":3,"file":"ECRules.js","sourceRoot":"","sources":["../../../src/Validation/ECRules.ts"],"names":[],"mappings":";AAAA;;;+FAG+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AAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;IAC/D,IAAI,kBAAkB;QACpB,OAAO,kBAAkB,CAAC;IAE5B,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAA8B,CAAC;IAC3F,IAAI,CAAC,gBAAgB;QACnB,OAAO;IAET,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE/F,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport {\r\n AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, ECClass, ECClassModifier,\r\n ECStringConstants, EntityClass, Enumeration, PrimitiveProperty, PrimitiveType, primitiveTypeToString,\r\n Property, RelationshipClass, RelationshipConstraint, RelationshipMultiplicity, Schema, SchemaGraph, SchemaItemType,\r\n StrengthDirection, strengthDirectionToString,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n ClassDiagnostic, createClassDiagnosticClass, createCustomAttributeContainerDiagnosticClass, createPropertyDiagnosticClass,\r\n createRelationshipConstraintDiagnosticClass, createSchemaDiagnosticClass, createSchemaItemDiagnosticClass, CustomAttributeContainerDiagnostic,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n DiagnosticType, PropertyDiagnostic, RelationshipConstraintDiagnostic, SchemaDiagnostic, SchemaItemDiagnostic,\r\n} from \"./Diagnostic\";\r\nimport { IRuleSet } from \"./Rules\";\r\n\r\nconst ruleSetName = \"ECObjects\";\r\n\r\nfunction getCode(code: number): string {\r\n return `${ruleSetName}-${code}`;\r\n}\r\n\r\n/**\r\n * The unique diagnostic codes for ECObjects rules.\r\n *\r\n * To provide meaning to code values, with anticipation\r\n * of future rules for all current EC Types, the following\r\n * value ranges should be used:\r\n *\r\n * - Schema: 000-099\r\n * - Class: 100-199\r\n * - Constant: 200-299\r\n * - CustomAttribute 300-399\r\n * - CustomAttributeClass: 400-499\r\n * - CustomAttributeContainer: 500-599\r\n * - EntityClass: 600-699\r\n * - Enumeration: 700-799\r\n * - Format: 800-899\r\n * - InvertedUnit: 900-999\r\n * - KindOfQuantity: 1000-1099\r\n * - Mixin: 1100-1199\r\n * - Phenomenon: 1200-1299\r\n * - Property: 1300-1399\r\n * - PropertyCategory: 1400-1499\r\n * - RelationshipClass: 1500-1599\r\n * - RelationshipConstraint: 1600-1699\r\n * - StructClass: 1700-1799\r\n * - Unit: 1800-1899\r\n * - UnitSystem: 1900-1999\r\n * @beta\r\n */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nexport const DiagnosticCodes = {\r\n // Class Rule Codes (100-199)\r\n BaseClassIsSealed: getCode(100),\r\n BaseClassOfDifferentType: getCode(101),\r\n // EC-102 has been deprecated. Leaving the code here to prevent re-use.\r\n AbstractClassWithNonAbstractBase: getCode(102),\r\n\r\n // CA Container Rule Codes (500-599)\r\n CustomAttributeNotOfConcreteClass: getCode(500),\r\n CustomAttributeSchemaMustBeReferenced: getCode(501),\r\n CustomAttributeClassNotFound: getCode(502),\r\n\r\n // Enumeration Rule Codes (700-799)\r\n EnumerationTypeUnsupported: getCode(700),\r\n\r\n // Mixin Rule Codes (1100-1199)\r\n MixinAppliedToClassMustDeriveFromConstraint: getCode(1100),\r\n\r\n // Property Rule Codes (1300-1399)\r\n IncompatibleValueTypePropertyOverride: getCode(1300),\r\n IncompatibleTypePropertyOverride: getCode(1301),\r\n IncompatibleUnitPropertyOverride: getCode(1302),\r\n\r\n // Relationship Rule Codes (1500-1599)\r\n AbstractConstraintMustNarrowBaseConstraints: getCode(1500),\r\n DerivedConstraintsMustNarrowBaseConstraints: getCode(1501),\r\n ConstraintClassesDeriveFromAbstractConstraint: getCode(1502),\r\n\r\n // Relationship Constraint Rule Codes (1600-1699)\r\n AtLeastOneConstraintClassDefined: getCode(1600),\r\n AbstractConstraintMustExistWithMultipleConstraints: getCode(1601),\r\n};\r\n\r\n/**\r\n * The list of [[IDiagnostic]] implementation classes used by the EC rule implementations.\r\n * @beta\r\n */\r\nexport const Diagnostics = {\r\n /** EC-001: Required message parameters: schema name, referenced schema name */\r\n SupplementalSchemasCannotBeReferenced: createSchemaDiagnosticClass<[string, string]>(getCode(1),\r\n \"Referenced schema '{1}' of schema '{0}' is a supplemental schema. Supplemental schemas are not allowed to be referenced.\"),\r\n\r\n /** EC-002: Required message parameters: schema name, reference schema alias, first schema reference name, second schema reference name. */\r\n SchemaRefAliasMustBeUnique: createSchemaDiagnosticClass<[string, string, string, string]>(getCode(2),\r\n \"Schema '{0}' has multiple schema references ({2}, {3}) with the same alias '{1}', which is not allowed.\"),\r\n\r\n /** EC-003: Required message parameters: schema name, cycle text */\r\n ReferenceCyclesNotAllowed: createSchemaDiagnosticClass<[string, string]>(getCode(3),\r\n \"Schema '{0}' has reference cycles: {1}\"),\r\n\r\n /** EC-100: Required message parameters: childClass.FullName, baseClass.FullName */\r\n BaseClassIsSealed: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.BaseClassIsSealed,\r\n \"Class '{0}' cannot derive from sealed base class '{1}'.\"),\r\n\r\n /** EC-101: Required message parameters: childClass.FullName, baseClass.FullName, baseClass.schemaItemType */\r\n BaseClassIsOfDifferentType: createClassDiagnosticClass<[string, string, string]>(DiagnosticCodes.BaseClassOfDifferentType,\r\n \"Class '{0}' cannot derive from base class '{1}' of type '{2}'.\"),\r\n\r\n /** **DEPRECATED** EC-102: Required message parameters: childClass.FullName, baseClass.FullName */\r\n AbstractClassWithNonAbstractBase: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractClassWithNonAbstractBase,\r\n \"Abstract Class '{0}' cannot derive from base class '{1}' because it is not an abstract class.\"),\r\n\r\n /** EC-500: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\r\n CustomAttributeNotOfConcreteClass: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeNotOfConcreteClass,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which is not a concrete class.\"),\r\n\r\n /** EC-501: Required message parameters: CustomAttribute container name, CustomAttributeClass name, CustomAttributeClass Schema name. */\r\n CustomAttributeSchemaMustBeReferenced: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeSchemaMustBeReferenced,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' whose schema is not referenced by the container's Schema.\"),\r\n\r\n /** EC-502: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\r\n CustomAttributeClassNotFound: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeClassNotFound,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which cannot be found.\"),\r\n\r\n /** EC-700: Required message parameters: Enumeration name */\r\n EnumerationTypeUnsupported: createSchemaItemDiagnosticClass<Enumeration, [string]>(DiagnosticCodes.EnumerationTypeUnsupported,\r\n \"Enumeration '{0}' has invalid primitive type.\"),\r\n\r\n /** EC-1100: Required message parameters: mixin class fullName, class fullName, applies to constraint class fullName */\r\n MixinAppliedToClassMustDeriveFromConstraint: createSchemaItemDiagnosticClass<EntityClass, [string, string, string]>(DiagnosticCodes.MixinAppliedToClassMustDeriveFromConstraint,\r\n \"Mixin '{0}' cannot be applied to the class '{1}' because it does not satisfy the applies to constraint '{2}'.\"),\r\n\r\n /** EC-1300: Required message parameters: childClass.FullName, property name, baseClass.FullName, base value type, child value type */\r\n IncompatibleValueTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleValueTypePropertyOverride,\r\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a value type of {3} which is incompatible with the value type of {4}.\"),\r\n\r\n /** EC-1301: Required message parameters: childClass.FullName, property name, baseClass.FullName, base property type, child property type */\r\n IncompatibleTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleTypePropertyOverride,\r\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a type of {3} which is incompatible with the type of {4}.\"),\r\n\r\n /** EC-1302: Required message parameters: childClass.Name, property name, baseClass.Name, baseClass Koq name, baseClass Koq persistence unit name, child class Koq persistence unit name, child class Koq name */\r\n IncompatibleUnitPropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string, string, string]>(DiagnosticCodes.IncompatibleUnitPropertyOverride,\r\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with KindOfQuantity '{3}' with persistence unit '{4}' which is not the same as the persistence unit '{5}' of the provided KindOfQuantity '{6}'.\"),\r\n\r\n /** EC-1303: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationRelationshipMustBeRoot: createPropertyDiagnosticClass<[string, string]>(getCode(1303),\r\n \"The referenced relationship '{1}', used in NavigationProperty '{0}' is not the root relationship.\"),\r\n\r\n /** EC-1304: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationTargetMustHaveSingularMultiplicity: createPropertyDiagnosticClass<[string, string, string]>(getCode(1304),\r\n \"NavigationProperty '{0}' uses the relationship '{1}' that cannot be traversed in the '{2}' direction due to a max multiplicity greater than 1.\"),\r\n\r\n /** EC-1305: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationRelationshipAbstractConstraintEntityOrMixin: createPropertyDiagnosticClass<[string, string]>(getCode(1305),\r\n \"The NavigationProperty '{0}', using the relationship '{1}', points to a RelationshipClass, which is not allowed. NavigationProperties must point to an EntityClass or Mixin.\"),\r\n\r\n /** EC-1306: Required message parameters: class name, property name, navigation relationship.fullName */\r\n NavigationClassMustBeAConstraintClassOfRelationship: createPropertyDiagnosticClass<[string, string, string, string]>(getCode(1306),\r\n \"The class '{0}' of NavigationProperty '{1}' is not supported by the {3} constraint of the referenced relationship '{2}'.\"),\r\n\r\n /** EC-1500: Required message parameters: abstract constraint class name, relationship end (source/target), relationship name, base relationship name */\r\n AbstractConstraintMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.AbstractConstraintMustNarrowBaseConstraints,\r\n \"The abstract constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\r\n\r\n /** EC-1501: Required message parameters: constraint class name, relationship end (source/target), relationship name, base relationship name */\r\n DerivedConstraintsMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.DerivedConstraintsMustNarrowBaseConstraints,\r\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\r\n\r\n /** EC-1502: Required message parameters: constraint class name, relationship end (source/target), relationship name, abstract constraint class name */\r\n ConstraintClassesDeriveFromAbstractConstraint: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.ConstraintClassesDeriveFromAbstractConstraint,\r\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not derived from the abstract constraint class '{3}'.\"),\r\n\r\n /** EC-1600: Required message parameters: relationship end (source/target), relationship name */\r\n AtLeastOneConstraintClassDefined: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AtLeastOneConstraintClassDefined,\r\n \"The {0}-Constraint of '{1}' does not contain any constraint classes.\"),\r\n\r\n /** EC-1601: Required message parameters: relationship end (source/target), relationship name */\r\n AbstractConstraintMustExistWithMultipleConstraints: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractConstraintMustExistWithMultipleConstraints,\r\n \"The {0}-Constraint of '{1}' has multiple constraint classes which requires an abstract constraint to be defined.\"),\r\n};\r\n\r\n/**\r\n * All schema validation rules that fall under the category of ECObjects.\r\n * @beta\r\n */\r\nexport const ECRuleSet: IRuleSet = {\r\n name: ruleSetName,\r\n\r\n schemaRules: [\r\n validateSchemaReferences,\r\n ],\r\n classRules: [\r\n baseClassIsSealed,\r\n baseClassIsOfDifferentType,\r\n ],\r\n propertyRules: [\r\n incompatibleValueTypePropertyOverride,\r\n incompatibleTypePropertyOverride,\r\n incompatibleUnitPropertyOverride,\r\n validateNavigationProperty,\r\n ],\r\n relationshipRules: [\r\n abstractConstraintMustNarrowBaseConstraints,\r\n constraintClassesDeriveFromAbstractConstraint,\r\n derivedConstraintsMustNarrowBaseConstraints,\r\n ],\r\n relationshipConstraintRules: [\r\n atLeastOneConstraintClassDefined,\r\n abstractConstraintMustExistWithMultipleConstraints,\r\n ],\r\n enumerationRules: [\r\n enumerationTypeUnsupported,\r\n ],\r\n entityClassRules: [\r\n mixinAppliedToClassMustDeriveFromConstraint,\r\n ],\r\n customAttributeInstanceRules: [\r\n validateCustomAttributeInstance,\r\n ],\r\n};\r\n\r\n/* eslint-enable @typescript-eslint/naming-convention */\r\n\r\n/**\r\n * Validates schema references against multiple EC rules.\r\n * @param schema The schema to validate.\r\n * @internal\r\n */\r\nexport async function* validateSchemaReferences(schema: Schema): AsyncIterable<SchemaDiagnostic<any[]>> {\r\n yield* validateSchemaReferencesSync(schema);\r\n}\r\n\r\n/**\r\n * Validates schema references against multiple EC rules.\r\n * @param schema The schema to validate.\r\n * @internal\r\n */\r\nexport function* validateSchemaReferencesSync(schema: Schema): Iterable<SchemaDiagnostic<any[]>> {\r\n const aliases = new Map();\r\n for (const schemaRef of schema.references) {\r\n if (schemaRef.customAttributes && schemaRef.customAttributes.has(\"CoreCustomAttributes.SupplementalSchema\"))\r\n yield new Diagnostics.SupplementalSchemasCannotBeReferenced(schema, [schema.name, schemaRef.name]);\r\n\r\n if (schema.schemaKey.matches(schemaRef.schemaKey))\r\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, `${schema.name} --> ${schemaRef.name}`]);\r\n\r\n if (aliases.has(schemaRef.alias)) {\r\n const currentRef = aliases.get(schemaRef.alias);\r\n yield new Diagnostics.SchemaRefAliasMustBeUnique(schema, [schema.name, schemaRef.alias, currentRef.name, schemaRef.name]);\r\n } else {\r\n aliases.set(schemaRef.alias, schemaRef);\r\n }\r\n }\r\n\r\n const graph = SchemaGraph.generateGraphSync(schema);\r\n const cycles = graph.detectCycles();\r\n if (cycles) {\r\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\r\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, result]);\r\n }\r\n}\r\n/**\r\n * EC Rule: Sealed classes cannot be a base class.\r\n * @internal\r\n */\r\nexport async function* baseClassIsSealed(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n // return if rule passed\r\n if (baseClass.modifier !== ECClassModifier.Sealed)\r\n return;\r\n\r\n yield new Diagnostics.BaseClassIsSealed(ecClass, [ecClass.fullName, baseClass.fullName]);\r\n}\r\n\r\n/**\r\n * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.)\r\n * @internal\r\n */\r\nexport async function* baseClassIsOfDifferentType(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n // return if rule passed\r\n if (baseClass.schemaItemType === ecClass.schemaItemType)\r\n return;\r\n\r\n const itemType = baseClass.schemaItemType;\r\n yield new Diagnostics.BaseClassIsOfDifferentType(ecClass, [ecClass.fullName, baseClass.fullName, itemType]);\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...).\r\n * @internal\r\n*/\r\nexport async function* incompatibleValueTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.class.baseClass)\r\n return;\r\n\r\n const primitiveType = getPrimitiveType(property);\r\n if (!primitiveType)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name);\r\n if (!baseProperty)\r\n return;\r\n\r\n // Other rules will catch this if false, but we need to make sure\r\n // types match for this rule to be valid.\r\n if (!propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n const baseType = getPrimitiveType(baseProperty);\r\n\r\n // Return if rule passed\r\n if (!baseType || primitiveType === baseType)\r\n return;\r\n\r\n return new Diagnostics.IncompatibleValueTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, primitiveTypeToString(baseType), primitiveTypeToString(primitiveType!)]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).\r\n * @internal\r\n */\r\nexport async function* incompatibleTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.class.baseClass)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name);\r\n if (!baseProperty)\r\n return;\r\n\r\n // Return if rule passed\r\n if (propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n return new Diagnostics.IncompatibleTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, baseProperty.constructor.name, property.constructor.name]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.\r\n * @internal\r\n */\r\nexport async function* incompatibleUnitPropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.kindOfQuantity || !property.class.baseClass)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name);\r\n if (!baseProperty || !baseProperty.kindOfQuantity)\r\n return;\r\n\r\n // Other rules will catch this if false, but we need to make sure\r\n // types match for this rule to be valid.\r\n if (!propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n const koq = await property.kindOfQuantity;\r\n const baseKoq = await baseProperty.kindOfQuantity;\r\n if (!koq || !baseKoq)\r\n return;\r\n\r\n const unit = await koq.persistenceUnit;\r\n const baseUnit = await baseKoq.persistenceUnit;\r\n\r\n if (!unit || !baseUnit)\r\n return;\r\n\r\n // return if rule passed\r\n if (unit.key.matches(baseUnit.key))\r\n return;\r\n\r\n return new Diagnostics.IncompatibleUnitPropertyOverride(property, [\r\n property.class.fullName,\r\n property.name,\r\n baseClass.fullName,\r\n baseKoq.fullName,\r\n baseUnit.fullName,\r\n unit.fullName,\r\n koq.fullName,\r\n ]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * Validates Navigation Properties. EC Rules: 1303, 1304\r\n * @internal\r\n */\r\nexport async function* validateNavigationProperty(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.isNavigation())\r\n return;\r\n\r\n const navProp = property;\r\n const relationship = await navProp.relationshipClass;\r\n\r\n if (relationship.baseClass)\r\n yield new Diagnostics.NavigationRelationshipMustBeRoot(property, [property.fullName, relationship.fullName]);\r\n\r\n let thisConstraint: RelationshipConstraint;\r\n let thatConstraint: RelationshipConstraint;\r\n let navigationClassSide: string;\r\n if (navProp.direction === StrengthDirection.Forward) {\r\n thisConstraint = relationship.source;\r\n thatConstraint = relationship.target;\r\n navigationClassSide = \"source\";\r\n } else {\r\n thisConstraint = relationship.target;\r\n thatConstraint = relationship.source;\r\n navigationClassSide = \"target\";\r\n }\r\n\r\n const thatAbstractConstraint = await thatConstraint.abstractConstraint;\r\n if (thatAbstractConstraint && thatAbstractConstraint.schemaItemType === SchemaItemType.RelationshipClass) {\r\n yield new Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);\r\n }\r\n\r\n const isClassSupported = async (ecClass: ECClass, propertyName: string, constraintName: string): Promise<boolean> => {\r\n if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName))\r\n return true;\r\n\r\n const inheritedProp = await ecClass.getInheritedProperty(propertyName);\r\n if (inheritedProp && constraintName === inheritedProp.class.fullName)\r\n return true;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n if (!baseClass)\r\n return false;\r\n\r\n return isClassSupported(baseClass, propertyName, constraintName);\r\n };\r\n\r\n let classSupported = false;\r\n if (thisConstraint.constraintClasses) {\r\n for (const constraintClass of thisConstraint.constraintClasses) {\r\n classSupported = await isClassSupported(property.class, property.name, constraintClass.fullName);\r\n if (classSupported)\r\n break;\r\n }\r\n }\r\n\r\n if (!classSupported)\r\n yield new Diagnostics.NavigationClassMustBeAConstraintClassOfRelationship(property, [property.class.name, property.name, relationship.fullName, navigationClassSide]);\r\n\r\n if (thatConstraint.multiplicity === RelationshipMultiplicity.oneMany || thatConstraint.multiplicity === RelationshipMultiplicity.zeroMany) {\r\n const direction = strengthDirectionToString(navProp.direction);\r\n yield new Diagnostics.NavigationTargetMustHaveSingularMultiplicity(property, [property.fullName, relationship.fullName, direction]);\r\n }\r\n\r\n return;\r\n}\r\n\r\n/**\r\n * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateRelationship(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n yield* abstractConstraintMustNarrowBaseConstraints(ecClass);\r\n yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);\r\n yield* constraintClassesDeriveFromAbstractConstraint(ecClass);\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.\r\n * @internal\r\n */\r\nexport async function* abstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\r\n\r\n const sourceResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.\r\n * @internal\r\n */\r\nexport async function* derivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\r\n\r\n const sourceResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.\r\n * @internal\r\n */\r\nexport async function* constraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n const sourceResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.source);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.target);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateRelationshipConstraint(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n yield* atLeastOneConstraintClassDefined(constraint);\r\n yield* abstractConstraintMustExistWithMultipleConstraints(constraint);\r\n}\r\n\r\n/**\r\n * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.\r\n * @internal\r\n */\r\nexport async function* atLeastOneConstraintClassDefined(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n if (!constraint.constraintClasses || constraint.constraintClasses.length === 0) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n yield new Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: If multiple constraints exist, an abstract constraint must be defined.\r\n * @internal\r\n */\r\nexport async function* abstractConstraintMustExistWithMultipleConstraints(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n if (!constraint.constraintClasses || constraint.constraintClasses.length <= 1) {\r\n return;\r\n }\r\n\r\n const abstractConstraint = await getAbstractConstraint(constraint);\r\n if (abstractConstraint)\r\n return;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n yield new Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);\r\n}\r\n\r\nfunction propertyTypesMatch(propertyA: Property, propertyB: Property) {\r\n return propertyA.constructor.name === propertyB.constructor.name;\r\n}\r\n\r\nfunction getPrimitiveType(property: Property): PrimitiveType | undefined {\r\n if (property.isPrimitive())\r\n return (property as PrimitiveProperty).primitiveType;\r\n\r\n return undefined;\r\n}\r\n\r\n/**\r\n * EC Rule: Enumeration type must be a string or integer\r\n * @internal\r\n */\r\nexport async function* enumerationTypeUnsupported(enumeration: Enumeration): AsyncIterable<SchemaItemDiagnostic<Enumeration, any[]>> {\r\n const type = enumeration.type;\r\n if (type === PrimitiveType.Integer || type === PrimitiveType.String)\r\n return;\r\n\r\n yield new Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);\r\n}\r\n\r\n/**\r\n * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.\r\n * @internal\r\n */\r\nexport async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass: EntityClass): AsyncIterable<SchemaItemDiagnostic<EntityClass, any[]>> {\r\n for (const lazyMixin of entityClass.mixins) {\r\n const mixin = await lazyMixin;\r\n if (!mixin.appliesTo)\r\n continue;\r\n\r\n if (!await entityClass.is(await mixin.appliesTo))\r\n yield new Diagnostics.MixinAppliedToClassMustDeriveFromConstraint(entityClass, [mixin.fullName, entityClass.fullName, mixin.appliesTo.fullName]);\r\n }\r\n\r\n return;\r\n}\r\n\r\n/**\r\n * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateCustomAttributeInstance(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n yield* customAttributeNotOfConcreteClass(container, customAttribute);\r\n yield* customAttributeSchemaMustBeReferenced(container, customAttribute);\r\n yield* customAttributeClassMustExist(container, customAttribute);\r\n}\r\n\r\n/** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */\r\nasync function* customAttributeNotOfConcreteClass(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\r\n if (!caClass)\r\n return;\r\n\r\n if (caClass.modifier !== ECClassModifier.Abstract)\r\n return;\r\n\r\n yield new Diagnostics.CustomAttributeNotOfConcreteClass(container, [container.fullName, caClass.fullName]);\r\n}\r\n\r\n/** EC Rule: CustomAttribute Schema must be referenced by the container's Schema. */\r\nasync function* customAttributeSchemaMustBeReferenced(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const nameParts = customAttribute.className.split(\".\");\r\n if (nameParts.length === 1 || nameParts[0] === schema.name)\r\n return;\r\n\r\n if (schema.references.some((s) => s.name === nameParts[0]))\r\n return;\r\n\r\n yield new Diagnostics.CustomAttributeSchemaMustBeReferenced(container, [container.fullName, customAttribute.className]);\r\n}\r\n\r\n/** EC Rule: CustomAttribute instance class must exist. */\r\nasync function* customAttributeClassMustExist(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\r\n if (!caClass)\r\n yield new Diagnostics.CustomAttributeClassNotFound(container, [container.fullName, customAttribute.className]);\r\n}\r\n\r\nasync function applyAbstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n const abstractConstraint = await constraint.abstractConstraint;\r\n if (!abstractConstraint)\r\n return;\r\n\r\n if (await baseConstraint.supportsClass(abstractConstraint))\r\n return;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.AbstractConstraintMustNarrowBaseConstraints(ecClass, [abstractConstraint.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\r\n}\r\n\r\nasync function applyDerivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n\r\n if (!constraint.constraintClasses)\r\n return;\r\n\r\n for (const classPromise of constraint.constraintClasses) {\r\n const constraintClass = await classPromise;\r\n\r\n if (await baseConstraint.supportsClass(constraintClass))\r\n continue;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.DerivedConstraintsMustNarrowBaseConstraints(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\r\n }\r\n\r\n return;\r\n}\r\n\r\nasync function applyConstraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass, constraint: RelationshipConstraint): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const abstractConstraint = await getAbstractConstraint(constraint);\r\n if (!abstractConstraint)\r\n return;\r\n\r\n if (!constraint.constraintClasses)\r\n return;\r\n\r\n for (const classPromise of constraint.constraintClasses) {\r\n const constraintClass = await classPromise;\r\n\r\n if (constraintClass.schemaItemType === SchemaItemType.Mixin && abstractConstraint.schemaItemType === SchemaItemType.EntityClass) {\r\n if (!await (constraintClass).applicableTo(abstractConstraint as EntityClass)) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\r\n }\r\n continue;\r\n }\r\n\r\n if (!await constraintClass.is(abstractConstraint)) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\r\n }\r\n }\r\n\r\n return;\r\n}\r\n\r\nasync function getAbstractConstraint(constraint: RelationshipConstraint): Promise<ECClass | undefined> {\r\n const abstractConstraint = await constraint.abstractConstraint;\r\n if (abstractConstraint)\r\n return abstractConstraint;\r\n\r\n const baseRelationship = await constraint.relationshipClass.baseClass as RelationshipClass;\r\n if (!baseRelationship)\r\n return;\r\n\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n\r\n return getAbstractConstraint(baseConstraint);\r\n}\r\n"]}
1
+ {"version":3,"file":"ECRules.js","sourceRoot":"","sources":["../../../src/Validation/ECRules.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAsOH,4DAEC;AAOD,oEAuBC;AAKD,8CAUC;AAMD,gEAWC;AAMD,sFAgCC;AAMD,4EAqBC;AAMD,4EA6CC;AAMD,gEA6DC;AAMD,oDAIC;AAMD,kGAYC;AAMD,kGAYC;AAMD,sGAOC;AAMD,wEAGC;AAMD,4EAKC;AAMD,gHAWC;AAiBD,gEAMC;AAMD,kGAWC;AAMD,0EAIC;AA7mBD,gEAKkC;AAClC,6CAKsB;AAGtB,MAAM,WAAW,GAAG,WAAW,CAAC;AAEhC,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,GAAG,WAAW,IAAI,IAAI,EAAE,CAAC;AAClC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,yDAAyD;AAC5C,QAAA,eAAe,GAAG;IAC7B,6BAA6B;IAC7B,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC;IAC/B,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC;IACtC,uEAAuE;IACvE,gCAAgC,EAAE,OAAO,CAAC,GAAG,CAAC;IAE9C,oCAAoC;IACpC,iCAAiC,EAAE,OAAO,CAAC,GAAG,C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CAAC;YACD,SAAS;QACX,CAAC;QAED,IAAI,CAAC,MAAM,eAAe,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAClD,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,qCAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC,qCAAiB,CAAC,uBAAuB,CAAC;YACnI,OAAO,IAAI,mBAAW,CAAC,6CAA6C,CAAC,OAAO,EAAE,CAAC,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,UAAU,CAAC,iBAAiB,CAAC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChM,CAAC;IACH,CAAC;IAED,OAAO;AACT,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,UAAkC;IACrE,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;IAC/D,IAAI,kBAAkB;QACpB,OAAO,kBAAkB,CAAC;IAE5B,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,iBAAiB,CAAC,SAA8B,CAAC;IAC3F,IAAI,CAAC,gBAAgB;QACnB,OAAO;IAET,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC;IAE/F,OAAO,qBAAqB,CAAC,cAAc,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport {\r\n AnyClass, AnyProperty, CustomAttribute, CustomAttributeContainerProps, ECClass, ECClassModifier,\r\n ECStringConstants, EntityClass, Enumeration, PrimitiveProperty, PrimitiveType, primitiveTypeToString,\r\n Property, RelationshipClass, RelationshipConstraint, RelationshipMultiplicity, Schema, SchemaGraph, SchemaItemType,\r\n StrengthDirection, strengthDirectionToString,\r\n} from \"@itwin/ecschema-metadata\";\r\nimport {\r\n ClassDiagnostic, createClassDiagnosticClass, createCustomAttributeContainerDiagnosticClass, createPropertyDiagnosticClass,\r\n createRelationshipConstraintDiagnosticClass, createSchemaDiagnosticClass, createSchemaItemDiagnosticClass, CustomAttributeContainerDiagnostic,\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n DiagnosticType, PropertyDiagnostic, RelationshipConstraintDiagnostic, SchemaDiagnostic, SchemaItemDiagnostic,\r\n} from \"./Diagnostic\";\r\nimport { IRuleSet } from \"./Rules\";\r\n\r\nconst ruleSetName = \"ECObjects\";\r\n\r\nfunction getCode(code: number): string {\r\n return `${ruleSetName}-${code}`;\r\n}\r\n\r\n/**\r\n * The unique diagnostic codes for ECObjects rules.\r\n *\r\n * To provide meaning to code values, with anticipation\r\n * of future rules for all current EC Types, the following\r\n * value ranges should be used:\r\n *\r\n * - Schema: 000-099\r\n * - Class: 100-199\r\n * - Constant: 200-299\r\n * - CustomAttribute 300-399\r\n * - CustomAttributeClass: 400-499\r\n * - CustomAttributeContainer: 500-599\r\n * - EntityClass: 600-699\r\n * - Enumeration: 700-799\r\n * - Format: 800-899\r\n * - InvertedUnit: 900-999\r\n * - KindOfQuantity: 1000-1099\r\n * - Mixin: 1100-1199\r\n * - Phenomenon: 1200-1299\r\n * - Property: 1300-1399\r\n * - PropertyCategory: 1400-1499\r\n * - RelationshipClass: 1500-1599\r\n * - RelationshipConstraint: 1600-1699\r\n * - StructClass: 1700-1799\r\n * - Unit: 1800-1899\r\n * - UnitSystem: 1900-1999\r\n * @beta\r\n */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nexport const DiagnosticCodes = {\r\n // Class Rule Codes (100-199)\r\n BaseClassIsSealed: getCode(100),\r\n BaseClassOfDifferentType: getCode(101),\r\n // EC-102 has been deprecated. Leaving the code here to prevent re-use.\r\n AbstractClassWithNonAbstractBase: getCode(102),\r\n\r\n // CA Container Rule Codes (500-599)\r\n CustomAttributeNotOfConcreteClass: getCode(500),\r\n CustomAttributeSchemaMustBeReferenced: getCode(501),\r\n CustomAttributeClassNotFound: getCode(502),\r\n\r\n // Enumeration Rule Codes (700-799)\r\n EnumerationTypeUnsupported: getCode(700),\r\n\r\n // Mixin Rule Codes (1100-1199)\r\n MixinAppliedToClassMustDeriveFromConstraint: getCode(1100),\r\n\r\n // Property Rule Codes (1300-1399)\r\n IncompatibleValueTypePropertyOverride: getCode(1300),\r\n IncompatibleTypePropertyOverride: getCode(1301),\r\n IncompatibleUnitPropertyOverride: getCode(1302),\r\n\r\n // Relationship Rule Codes (1500-1599)\r\n AbstractConstraintMustNarrowBaseConstraints: getCode(1500),\r\n DerivedConstraintsMustNarrowBaseConstraints: getCode(1501),\r\n ConstraintClassesDeriveFromAbstractConstraint: getCode(1502),\r\n\r\n // Relationship Constraint Rule Codes (1600-1699)\r\n AtLeastOneConstraintClassDefined: getCode(1600),\r\n AbstractConstraintMustExistWithMultipleConstraints: getCode(1601),\r\n};\r\n\r\n/**\r\n * The list of [[IDiagnostic]] implementation classes used by the EC rule implementations.\r\n * @beta\r\n */\r\nexport const Diagnostics = {\r\n /** EC-001: Required message parameters: schema name, referenced schema name */\r\n SupplementalSchemasCannotBeReferenced: createSchemaDiagnosticClass<[string, string]>(getCode(1),\r\n \"Referenced schema '{1}' of schema '{0}' is a supplemental schema. Supplemental schemas are not allowed to be referenced.\"),\r\n\r\n /** EC-002: Required message parameters: schema name, reference schema alias, first schema reference name, second schema reference name. */\r\n SchemaRefAliasMustBeUnique: createSchemaDiagnosticClass<[string, string, string, string]>(getCode(2),\r\n \"Schema '{0}' has multiple schema references ({2}, {3}) with the same alias '{1}', which is not allowed.\"),\r\n\r\n /** EC-003: Required message parameters: schema name, cycle text */\r\n ReferenceCyclesNotAllowed: createSchemaDiagnosticClass<[string, string]>(getCode(3),\r\n \"Schema '{0}' has reference cycles: {1}\"),\r\n\r\n /** EC-100: Required message parameters: childClass.FullName, baseClass.FullName */\r\n BaseClassIsSealed: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.BaseClassIsSealed,\r\n \"Class '{0}' cannot derive from sealed base class '{1}'.\"),\r\n\r\n /** EC-101: Required message parameters: childClass.FullName, baseClass.FullName, baseClass.schemaItemType */\r\n BaseClassIsOfDifferentType: createClassDiagnosticClass<[string, string, string]>(DiagnosticCodes.BaseClassOfDifferentType,\r\n \"Class '{0}' cannot derive from base class '{1}' of type '{2}'.\"),\r\n\r\n /** **DEPRECATED** EC-102: Required message parameters: childClass.FullName, baseClass.FullName */\r\n AbstractClassWithNonAbstractBase: createClassDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractClassWithNonAbstractBase,\r\n \"Abstract Class '{0}' cannot derive from base class '{1}' because it is not an abstract class.\"),\r\n\r\n /** EC-500: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\r\n CustomAttributeNotOfConcreteClass: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeNotOfConcreteClass,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which is not a concrete class.\"),\r\n\r\n /** EC-501: Required message parameters: CustomAttribute container name, CustomAttributeClass name, CustomAttributeClass Schema name. */\r\n CustomAttributeSchemaMustBeReferenced: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeSchemaMustBeReferenced,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' whose schema is not referenced by the container's Schema.\"),\r\n\r\n /** EC-502: Required message parameters: CustomAttribute container name and CustomAttributeClass name. */\r\n CustomAttributeClassNotFound: createCustomAttributeContainerDiagnosticClass<[string, string]>(DiagnosticCodes.CustomAttributeClassNotFound,\r\n \"The CustomAttribute container '{0}' has a CustomAttribute with the class '{1}' which cannot be found.\"),\r\n\r\n /** EC-700: Required message parameters: Enumeration name */\r\n EnumerationTypeUnsupported: createSchemaItemDiagnosticClass<Enumeration, [string]>(DiagnosticCodes.EnumerationTypeUnsupported,\r\n \"Enumeration '{0}' has invalid primitive type.\"),\r\n\r\n /** EC-1100: Required message parameters: mixin class fullName, class fullName, applies to constraint class fullName */\r\n MixinAppliedToClassMustDeriveFromConstraint: createSchemaItemDiagnosticClass<EntityClass, [string, string, string]>(DiagnosticCodes.MixinAppliedToClassMustDeriveFromConstraint,\r\n \"Mixin '{0}' cannot be applied to the class '{1}' because it does not satisfy the applies to constraint '{2}'.\"),\r\n\r\n /** EC-1300: Required message parameters: childClass.FullName, property name, baseClass.FullName, base value type, child value type */\r\n IncompatibleValueTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleValueTypePropertyOverride,\r\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a value type of {3} which is incompatible with the value type of {4}.\"),\r\n\r\n /** EC-1301: Required message parameters: childClass.FullName, property name, baseClass.FullName, base property type, child property type */\r\n IncompatibleTypePropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string]>(DiagnosticCodes.IncompatibleTypePropertyOverride,\r\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with a type of {3} which is incompatible with the type of {4}.\"),\r\n\r\n /** EC-1302: Required message parameters: childClass.Name, property name, baseClass.Name, baseClass Koq name, baseClass Koq persistence unit name, child class Koq persistence unit name, child class Koq name */\r\n IncompatibleUnitPropertyOverride: createPropertyDiagnosticClass<[string, string, string, string, string, string, string]>(DiagnosticCodes.IncompatibleUnitPropertyOverride,\r\n \"The ECProperty '{0}.{1}' has a base property '{2}.{1}' with KindOfQuantity '{3}' with persistence unit '{4}' which is not the same as the persistence unit '{5}' of the provided KindOfQuantity '{6}'.\"),\r\n\r\n /** EC-1303: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationRelationshipMustBeRoot: createPropertyDiagnosticClass<[string, string]>(getCode(1303),\r\n \"The referenced relationship '{1}', used in NavigationProperty '{0}' is not the root relationship.\"),\r\n\r\n /** EC-1304: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationTargetMustHaveSingularMultiplicity: createPropertyDiagnosticClass<[string, string, string]>(getCode(1304),\r\n \"NavigationProperty '{0}' uses the relationship '{1}' that cannot be traversed in the '{2}' direction due to a max multiplicity greater than 1.\"),\r\n\r\n /** EC-1305: Required message parameters: property.fullName, navigation relationship.fullName */\r\n NavigationRelationshipAbstractConstraintEntityOrMixin: createPropertyDiagnosticClass<[string, string]>(getCode(1305),\r\n \"The NavigationProperty '{0}', using the relationship '{1}', points to a RelationshipClass, which is not allowed. NavigationProperties must point to an EntityClass or Mixin.\"),\r\n\r\n /** EC-1306: Required message parameters: class name, property name, navigation relationship.fullName */\r\n NavigationClassMustBeAConstraintClassOfRelationship: createPropertyDiagnosticClass<[string, string, string, string]>(getCode(1306),\r\n \"The class '{0}' of NavigationProperty '{1}' is not supported by the {3} constraint of the referenced relationship '{2}'.\"),\r\n\r\n /** EC-1500: Required message parameters: abstract constraint class name, relationship end (source/target), relationship name, base relationship name */\r\n AbstractConstraintMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.AbstractConstraintMustNarrowBaseConstraints,\r\n \"The abstract constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\r\n\r\n /** EC-1501: Required message parameters: constraint class name, relationship end (source/target), relationship name, base relationship name */\r\n DerivedConstraintsMustNarrowBaseConstraints: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.DerivedConstraintsMustNarrowBaseConstraints,\r\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not supported by the base class constraint in '{3}'.\"),\r\n\r\n /** EC-1502: Required message parameters: constraint class name, relationship end (source/target), relationship name, abstract constraint class name */\r\n ConstraintClassesDeriveFromAbstractConstraint: createSchemaItemDiagnosticClass<RelationshipClass, [string, string, string, string]>(DiagnosticCodes.ConstraintClassesDeriveFromAbstractConstraint,\r\n \"The constraint class '{0}' on the {1}-Constraint of '{2}' is not derived from the abstract constraint class '{3}'.\"),\r\n\r\n /** EC-1600: Required message parameters: relationship end (source/target), relationship name */\r\n AtLeastOneConstraintClassDefined: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AtLeastOneConstraintClassDefined,\r\n \"The {0}-Constraint of '{1}' does not contain any constraint classes.\"),\r\n\r\n /** EC-1601: Required message parameters: relationship end (source/target), relationship name */\r\n AbstractConstraintMustExistWithMultipleConstraints: createRelationshipConstraintDiagnosticClass<[string, string]>(DiagnosticCodes.AbstractConstraintMustExistWithMultipleConstraints,\r\n \"The {0}-Constraint of '{1}' has multiple constraint classes which requires an abstract constraint to be defined.\"),\r\n};\r\n\r\n/**\r\n * All schema validation rules that fall under the category of ECObjects.\r\n * @beta\r\n */\r\nexport const ECRuleSet: IRuleSet = {\r\n name: ruleSetName,\r\n\r\n schemaRules: [\r\n validateSchemaReferences,\r\n ],\r\n classRules: [\r\n baseClassIsSealed,\r\n baseClassIsOfDifferentType,\r\n ],\r\n propertyRules: [\r\n incompatibleValueTypePropertyOverride,\r\n incompatibleTypePropertyOverride,\r\n incompatibleUnitPropertyOverride,\r\n validateNavigationProperty,\r\n ],\r\n relationshipRules: [\r\n abstractConstraintMustNarrowBaseConstraints,\r\n constraintClassesDeriveFromAbstractConstraint,\r\n derivedConstraintsMustNarrowBaseConstraints,\r\n ],\r\n relationshipConstraintRules: [\r\n atLeastOneConstraintClassDefined,\r\n abstractConstraintMustExistWithMultipleConstraints,\r\n ],\r\n enumerationRules: [\r\n enumerationTypeUnsupported,\r\n ],\r\n entityClassRules: [\r\n mixinAppliedToClassMustDeriveFromConstraint,\r\n ],\r\n customAttributeInstanceRules: [\r\n validateCustomAttributeInstance,\r\n ],\r\n};\r\n\r\n/* eslint-enable @typescript-eslint/naming-convention */\r\n\r\n/**\r\n * Validates schema references against multiple EC rules.\r\n * @param schema The schema to validate.\r\n * @internal\r\n */\r\nexport async function* validateSchemaReferences(schema: Schema): AsyncIterable<SchemaDiagnostic<any[]>> {\r\n yield* validateSchemaReferencesSync(schema);\r\n}\r\n\r\n/**\r\n * Validates schema references against multiple EC rules.\r\n * @param schema The schema to validate.\r\n * @internal\r\n */\r\nexport function* validateSchemaReferencesSync(schema: Schema): Iterable<SchemaDiagnostic<any[]>> {\r\n const aliases = new Map();\r\n for (const schemaRef of schema.references) {\r\n if (schemaRef.customAttributes && schemaRef.customAttributes.has(\"CoreCustomAttributes.SupplementalSchema\"))\r\n yield new Diagnostics.SupplementalSchemasCannotBeReferenced(schema, [schema.name, schemaRef.name]);\r\n\r\n if (schema.schemaKey.matches(schemaRef.schemaKey))\r\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, `${schema.name} --> ${schemaRef.name}`]);\r\n\r\n if (aliases.has(schemaRef.alias)) {\r\n const currentRef = aliases.get(schemaRef.alias);\r\n yield new Diagnostics.SchemaRefAliasMustBeUnique(schema, [schema.name, schemaRef.alias, currentRef.name, schemaRef.name]);\r\n } else {\r\n aliases.set(schemaRef.alias, schemaRef);\r\n }\r\n }\r\n\r\n const graph = SchemaGraph.generateGraphSync(schema);\r\n const cycles = graph.detectCycles();\r\n if (cycles) {\r\n const result = cycles.map((cycle) => `${cycle.schema.schemaKey.name} --> ${cycle.refSchema.schemaKey.name}`).join(\", \");\r\n yield new Diagnostics.ReferenceCyclesNotAllowed(schema, [schema.name, result]);\r\n }\r\n}\r\n/**\r\n * EC Rule: Sealed classes cannot be a base class.\r\n * @internal\r\n */\r\nexport async function* baseClassIsSealed(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n // return if rule passed\r\n if (baseClass.modifier !== ECClassModifier.Sealed)\r\n return;\r\n\r\n yield new Diagnostics.BaseClassIsSealed(ecClass, [ecClass.fullName, baseClass.fullName]);\r\n}\r\n\r\n/**\r\n * EC Rule: Base and child class must be of the same type (i.e. Entity, Mixin, Relationship, etc.)\r\n * @internal\r\n */\r\nexport async function* baseClassIsOfDifferentType(ecClass: AnyClass): AsyncIterable<ClassDiagnostic<any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n // return if rule passed\r\n if (baseClass.schemaItemType === ecClass.schemaItemType)\r\n return;\r\n\r\n const itemType = baseClass.schemaItemType;\r\n yield new Diagnostics.BaseClassIsOfDifferentType(ecClass, [ecClass.fullName, baseClass.fullName, itemType]);\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a class primitive property, the child and base property must be of the same type (string, number, etc...).\r\n * @internal\r\n*/\r\nexport async function* incompatibleValueTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.class.baseClass)\r\n return;\r\n\r\n const primitiveType = getPrimitiveType(property);\r\n if (!primitiveType)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name);\r\n if (!baseProperty)\r\n return;\r\n\r\n // Other rules will catch this if false, but we need to make sure\r\n // types match for this rule to be valid.\r\n if (!propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n const baseType = getPrimitiveType(baseProperty);\r\n\r\n // Return if rule passed\r\n if (!baseType || primitiveType === baseType)\r\n return;\r\n\r\n return new Diagnostics.IncompatibleValueTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, primitiveTypeToString(baseType), primitiveTypeToString(primitiveType!)]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a class property, the child and base property must be of the same property type (primitive, struct, enumeration, etc...).\r\n * @internal\r\n */\r\nexport async function* incompatibleTypePropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.class.baseClass)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name);\r\n if (!baseProperty)\r\n return;\r\n\r\n // Return if rule passed\r\n if (propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n return new Diagnostics.IncompatibleTypePropertyOverride(property, [property.class.fullName, property.name, baseClass.fullName, baseProperty.constructor.name, property.constructor.name]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a kindOfQuantity property, the child and base property units must be the same.\r\n * @internal\r\n */\r\nexport async function* incompatibleUnitPropertyOverride(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.kindOfQuantity || !property.class.baseClass)\r\n return;\r\n\r\n async function callback(baseClass: ECClass): Promise<PropertyDiagnostic<any[]> | undefined> {\r\n const baseProperty = await baseClass.getProperty(property.name);\r\n if (!baseProperty || !baseProperty.kindOfQuantity)\r\n return;\r\n\r\n // Other rules will catch this if false, but we need to make sure\r\n // types match for this rule to be valid.\r\n if (!propertyTypesMatch(property, baseProperty))\r\n return;\r\n\r\n const koq = await property.kindOfQuantity;\r\n const baseKoq = await baseProperty.kindOfQuantity;\r\n if (!koq || !baseKoq)\r\n return;\r\n\r\n const unit = await koq.persistenceUnit;\r\n const baseUnit = await baseKoq.persistenceUnit;\r\n\r\n if (!unit || !baseUnit)\r\n return;\r\n\r\n // return if rule passed\r\n if (unit.key.matches(baseUnit.key))\r\n return;\r\n\r\n return new Diagnostics.IncompatibleUnitPropertyOverride(property, [\r\n property.class.fullName,\r\n property.name,\r\n baseClass.fullName,\r\n baseKoq.fullName,\r\n baseUnit.fullName,\r\n unit.fullName,\r\n koq.fullName,\r\n ]);\r\n }\r\n\r\n for await (const baseClass of property.class.getAllBaseClasses()) {\r\n const result = await callback(baseClass);\r\n if (result)\r\n yield result;\r\n }\r\n}\r\n\r\n/**\r\n * Validates Navigation Properties. EC Rules: 1303, 1304\r\n * @internal\r\n */\r\nexport async function* validateNavigationProperty(property: AnyProperty): AsyncIterable<PropertyDiagnostic<any[]>> {\r\n if (!property.isNavigation())\r\n return;\r\n\r\n const navProp = property;\r\n const relationship = await navProp.relationshipClass;\r\n\r\n if (relationship.baseClass)\r\n yield new Diagnostics.NavigationRelationshipMustBeRoot(property, [property.fullName, relationship.fullName]);\r\n\r\n let thisConstraint: RelationshipConstraint;\r\n let thatConstraint: RelationshipConstraint;\r\n let navigationClassSide: string;\r\n if (navProp.direction === StrengthDirection.Forward) {\r\n thisConstraint = relationship.source;\r\n thatConstraint = relationship.target;\r\n navigationClassSide = \"source\";\r\n } else {\r\n thisConstraint = relationship.target;\r\n thatConstraint = relationship.source;\r\n navigationClassSide = \"target\";\r\n }\r\n\r\n const thatAbstractConstraint = await thatConstraint.abstractConstraint;\r\n if (thatAbstractConstraint && thatAbstractConstraint.schemaItemType === SchemaItemType.RelationshipClass) {\r\n yield new Diagnostics.NavigationRelationshipAbstractConstraintEntityOrMixin(property, [property.fullName, relationship.fullName]);\r\n }\r\n\r\n const isClassSupported = async (ecClass: ECClass, propertyName: string, constraintName: string): Promise<boolean> => {\r\n if (constraintName === ecClass.fullName && undefined !== await ecClass.getProperty(propertyName))\r\n return true;\r\n\r\n const inheritedProp = await ecClass.getInheritedProperty(propertyName);\r\n if (inheritedProp && constraintName === inheritedProp.class.fullName)\r\n return true;\r\n\r\n const baseClass = await ecClass.baseClass;\r\n if (!baseClass)\r\n return false;\r\n\r\n return isClassSupported(baseClass, propertyName, constraintName);\r\n };\r\n\r\n let classSupported = false;\r\n if (thisConstraint.constraintClasses) {\r\n for (const constraintClass of thisConstraint.constraintClasses) {\r\n classSupported = await isClassSupported(property.class, property.name, constraintClass.fullName);\r\n if (classSupported)\r\n break;\r\n }\r\n }\r\n\r\n if (!classSupported)\r\n yield new Diagnostics.NavigationClassMustBeAConstraintClassOfRelationship(property, [property.class.name, property.name, relationship.fullName, navigationClassSide]);\r\n\r\n if (thatConstraint.multiplicity === RelationshipMultiplicity.oneMany || thatConstraint.multiplicity === RelationshipMultiplicity.zeroMany) {\r\n const direction = strengthDirectionToString(navProp.direction);\r\n yield new Diagnostics.NavigationTargetMustHaveSingularMultiplicity(property, [property.fullName, relationship.fullName, direction]);\r\n }\r\n\r\n return;\r\n}\r\n\r\n/**\r\n * Validates a Relationship class and yields EC-1500, EC-1501, and EC-1502 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateRelationship(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n yield* abstractConstraintMustNarrowBaseConstraints(ecClass);\r\n yield* derivedConstraintsMustNarrowBaseConstraints(ecClass);\r\n yield* constraintClassesDeriveFromAbstractConstraint(ecClass);\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a RelationshipClass, the derived abstract constraint must narrow the base constraint classes.\r\n * @internal\r\n */\r\nexport async function* abstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\r\n\r\n const sourceResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyAbstractConstraintMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * EC Rule: When overriding a RelationshipClass, derived constraint classes must narrow base constraint classes.\r\n * @internal\r\n */\r\nexport async function* derivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n if (!ecClass.baseClass)\r\n return;\r\n\r\n const baseRelationship = await ecClass.baseClass as RelationshipClass;\r\n\r\n const sourceResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.source, baseRelationship);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyDerivedConstraintsMustNarrowBaseConstraints(ecClass, ecClass.target, baseRelationship);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * EC Rule: All constraint classes must have a common base class specified in the abstract constraint.\r\n * @internal\r\n */\r\nexport async function* constraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass): AsyncIterable<SchemaItemDiagnostic<RelationshipClass, any[]>> {\r\n const sourceResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.source);\r\n if (sourceResult)\r\n yield sourceResult;\r\n const targetResult = await applyConstraintClassesDeriveFromAbstractConstraint(ecClass, ecClass.target);\r\n if (targetResult)\r\n yield targetResult;\r\n}\r\n\r\n/**\r\n * Validates a RelationshipConstraint and yields EC-1600 and EC-1601 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateRelationshipConstraint(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n yield* atLeastOneConstraintClassDefined(constraint);\r\n yield* abstractConstraintMustExistWithMultipleConstraints(constraint);\r\n}\r\n\r\n/**\r\n * EC Rule: At least on concrete constraint class must be defined in the list of constraint classes.\r\n * @internal\r\n */\r\nexport async function* atLeastOneConstraintClassDefined(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n if (!constraint.constraintClasses || constraint.constraintClasses.length === 0) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n yield new Diagnostics.AtLeastOneConstraintClassDefined(constraint, [constraintType, constraint.relationshipClass.fullName]);\r\n }\r\n}\r\n\r\n/**\r\n * EC Rule: If multiple constraints exist, an abstract constraint must be defined.\r\n * @internal\r\n */\r\nexport async function* abstractConstraintMustExistWithMultipleConstraints(constraint: RelationshipConstraint): AsyncIterable<RelationshipConstraintDiagnostic<any[]>> {\r\n if (!constraint.constraintClasses || constraint.constraintClasses.length <= 1) {\r\n return;\r\n }\r\n\r\n const abstractConstraint = await getAbstractConstraint(constraint);\r\n if (abstractConstraint)\r\n return;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n yield new Diagnostics.AbstractConstraintMustExistWithMultipleConstraints(constraint, [constraintType, constraint.relationshipClass.fullName]);\r\n}\r\n\r\nfunction propertyTypesMatch(propertyA: Property, propertyB: Property) {\r\n return propertyA.constructor.name === propertyB.constructor.name;\r\n}\r\n\r\nfunction getPrimitiveType(property: Property): PrimitiveType | undefined {\r\n if (property.isPrimitive())\r\n return (property as PrimitiveProperty).primitiveType;\r\n\r\n return undefined;\r\n}\r\n\r\n/**\r\n * EC Rule: Enumeration type must be a string or integer\r\n * @internal\r\n */\r\nexport async function* enumerationTypeUnsupported(enumeration: Enumeration): AsyncIterable<SchemaItemDiagnostic<Enumeration, any[]>> {\r\n const type = enumeration.type;\r\n if (type === PrimitiveType.Integer || type === PrimitiveType.String)\r\n return;\r\n\r\n yield new Diagnostics.EnumerationTypeUnsupported(enumeration, [enumeration.fullName]);\r\n}\r\n\r\n/**\r\n * EC Rule: Mixin applied to class must derived from the Mixin appliesTo constraint.\r\n * @internal\r\n */\r\nexport async function* mixinAppliedToClassMustDeriveFromConstraint(entityClass: EntityClass): AsyncIterable<SchemaItemDiagnostic<EntityClass, any[]>> {\r\n for (const lazyMixin of entityClass.mixins) {\r\n const mixin = await lazyMixin;\r\n if (!mixin.appliesTo)\r\n continue;\r\n\r\n if (!await entityClass.is(await mixin.appliesTo))\r\n yield new Diagnostics.MixinAppliedToClassMustDeriveFromConstraint(entityClass, [mixin.fullName, entityClass.fullName, mixin.appliesTo.fullName]);\r\n }\r\n\r\n return;\r\n}\r\n\r\n/**\r\n * Validates a custom attribute instance and yields EC-500, EC-501, and EC-502 rule violations.\r\n * @internal\r\n */\r\nexport async function* validateCustomAttributeInstance(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n yield* customAttributeNotOfConcreteClass(container, customAttribute);\r\n yield* customAttributeSchemaMustBeReferenced(container, customAttribute);\r\n yield* customAttributeClassMustExist(container, customAttribute);\r\n}\r\n\r\n/** EC Rule: CustomAttribute instance must be of a concrete CustomAttributeClass. */\r\nasync function* customAttributeNotOfConcreteClass(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\r\n if (!caClass)\r\n return;\r\n\r\n if (caClass.modifier !== ECClassModifier.Abstract)\r\n return;\r\n\r\n yield new Diagnostics.CustomAttributeNotOfConcreteClass(container, [container.fullName, caClass.fullName]);\r\n}\r\n\r\n/** EC Rule: CustomAttribute Schema must be referenced by the container's Schema. */\r\nasync function* customAttributeSchemaMustBeReferenced(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const nameParts = customAttribute.className.split(\".\");\r\n if (nameParts.length === 1 || nameParts[0] === schema.name)\r\n return;\r\n\r\n if (schema.references.some((s) => s.name === nameParts[0]))\r\n return;\r\n\r\n yield new Diagnostics.CustomAttributeSchemaMustBeReferenced(container, [container.fullName, customAttribute.className]);\r\n}\r\n\r\n/** EC Rule: CustomAttribute instance class must exist. */\r\nasync function* customAttributeClassMustExist(container: CustomAttributeContainerProps, customAttribute: CustomAttribute): AsyncIterable<CustomAttributeContainerDiagnostic<any[]>> {\r\n const schema = container.schema;\r\n const caClass = await schema.lookupItem(customAttribute.className) as ECClass;\r\n if (!caClass)\r\n yield new Diagnostics.CustomAttributeClassNotFound(container, [container.fullName, customAttribute.className]);\r\n}\r\n\r\nasync function applyAbstractConstraintMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n const abstractConstraint = await constraint.abstractConstraint;\r\n if (!abstractConstraint)\r\n return;\r\n\r\n if (await baseConstraint.supportsClass(abstractConstraint))\r\n return;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.AbstractConstraintMustNarrowBaseConstraints(ecClass, [abstractConstraint.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\r\n}\r\n\r\nasync function applyDerivedConstraintsMustNarrowBaseConstraints(ecClass: RelationshipClass, constraint: RelationshipConstraint, baseRelationship: RelationshipClass): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n\r\n if (!constraint.constraintClasses)\r\n return;\r\n\r\n for (const classPromise of constraint.constraintClasses) {\r\n const constraintClass = await classPromise;\r\n\r\n if (await baseConstraint.supportsClass(constraintClass))\r\n continue;\r\n\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.DerivedConstraintsMustNarrowBaseConstraints(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, baseRelationship.fullName]);\r\n }\r\n\r\n return;\r\n}\r\n\r\nasync function applyConstraintClassesDeriveFromAbstractConstraint(ecClass: RelationshipClass, constraint: RelationshipConstraint): Promise<SchemaItemDiagnostic<RelationshipClass, any[]> | undefined> {\r\n const abstractConstraint = await getAbstractConstraint(constraint);\r\n if (!abstractConstraint)\r\n return;\r\n\r\n if (!constraint.constraintClasses)\r\n return;\r\n\r\n for (const classPromise of constraint.constraintClasses) {\r\n const constraintClass = await classPromise;\r\n\r\n if (constraintClass.schemaItemType === SchemaItemType.Mixin && abstractConstraint.schemaItemType === SchemaItemType.EntityClass) {\r\n if (!await (constraintClass).applicableTo(abstractConstraint as EntityClass)) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\r\n }\r\n continue;\r\n }\r\n\r\n if (!await constraintClass.is(abstractConstraint)) {\r\n const constraintType = constraint.isSource ? ECStringConstants.RELATIONSHIP_END_SOURCE : ECStringConstants.RELATIONSHIP_END_TARGET;\r\n return new Diagnostics.ConstraintClassesDeriveFromAbstractConstraint(ecClass, [constraintClass.fullName, constraintType, constraint.relationshipClass.fullName, abstractConstraint.fullName]);\r\n }\r\n }\r\n\r\n return;\r\n}\r\n\r\nasync function getAbstractConstraint(constraint: RelationshipConstraint): Promise<ECClass | undefined> {\r\n const abstractConstraint = await constraint.abstractConstraint;\r\n if (abstractConstraint)\r\n return abstractConstraint;\r\n\r\n const baseRelationship = await constraint.relationshipClass.baseClass as RelationshipClass;\r\n if (!baseRelationship)\r\n return;\r\n\r\n const baseConstraint = constraint.isSource ? baseRelationship.source : baseRelationship.target;\r\n\r\n return getAbstractConstraint(baseConstraint);\r\n}\r\n"]}
@@ -8,7 +8,7 @@ import { AnyDiagnostic } from "./Diagnostic";
8
8
  * Just telling us whether a rule is suppressed or not.
9
9
  * @beta
10
10
  */
11
- export type ISuppressionRule<T extends AnyECType, U = {}> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;
11
+ export type ISuppressionRule<T extends AnyECType, U = object> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;
12
12
  /** @beta */
13
13
  export type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;
14
14
  /** @internal */
@@ -17,7 +17,7 @@ export type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;
17
17
  * Interface used to represent elements of a rule suppression
18
18
  * @beta
19
19
  */
20
- export interface IRuleSuppressionMap<T extends AnyECType, U = {}> {
20
+ export interface IRuleSuppressionMap<T extends AnyECType, U = object> {
21
21
  ruleCode: string;
22
22
  rule: ISuppressionRule<T, U>;
23
23
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RuleSuppressionSet.d.ts","sourceRoot":"","sources":["../../../src/Validation/RuleSuppressionSet.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,oBAAoB,EACxF,6BAA6B,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAChH,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAClG,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE3I,YAAY;AACZ,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEnG,gBAAgB;AAChB,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;AAEnE;;;GAGG;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AAC,CAAC,CAAC;IACpE,0BAA0B,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;IACpE,wBAAwB,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC;CACjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"RuleSuppressionSet.js","sourceRoot":"","sources":["../../../src/Validation/RuleSuppressionSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule suppressions used during schema validation.\r\n * Just telling us whether a rule is suppressed or not.\r\n * @beta\r\n */\r\nexport type ISuppressionRule<T extends AnyECType, U = {}> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;\r\n\r\n/** @beta */\r\nexport type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;\r\n\r\n/** @internal */\r\nexport type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionMap<T extends AnyECType, U = {}> {\r\n ruleCode: string;\r\n rule: ISuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface BaseRuleSuppressionMap<T extends AnyECType, U extends AnyECType> {\r\n ruleCode: string;\r\n rule: BaseSuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent logical collection of [[ISuppressionRule]] instances.\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionSet {\r\n name: string;\r\n schemaRuleSuppressions?: Array<IRuleSuppressionMap<Schema>>;\r\n schemaItemRuleSuppressions?: Array<IRuleSuppressionMap<SchemaItem>>;\r\n classRuleSuppressions?: Array<IRuleSuppressionMap<AnyClass>>;\r\n propertyRuleSuppressions?: Array<IRuleSuppressionMap<AnyProperty>>;\r\n entityRuleSuppressions?: Array<IRuleSuppressionMap<EntityClass>>;\r\n structRuleSuppressions?: Array<IRuleSuppressionMap<StructClass>>;\r\n mixinRuleSuppressions?: Array<IRuleSuppressionMap<Mixin>>;\r\n relationshipRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipClass>>;\r\n relationshipConstraintRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipConstraint>>;\r\n customAttributeRuleSuppressions?: Array<IRuleSuppressionMap<CustomAttributeClass>>;\r\n customAttributeContainerSuppressions?: Array<IRuleSuppressionMap<CustomAttributeContainerProps>>;\r\n customAttributeInstanceSuppressions?: Array<BaseRuleSuppressionMap<CustomAttributeContainerProps, CustomAttribute>>;\r\n enumerationRuleSuppressions?: Array<IRuleSuppressionMap<Enumeration>>;\r\n koqRuleSuppressions?: Array<IRuleSuppressionMap<KindOfQuantity>>;\r\n propertyCategoryRuleSuppressions?: Array<IRuleSuppressionMap<PropertyCategory>>;\r\n formatRuleSuppressions?: Array<IRuleSuppressionMap<Format>>;\r\n unitRuleSuppressions?: Array<IRuleSuppressionMap<Unit>>;\r\n invertedUnitRuleSuppressions?: Array<IRuleSuppressionMap<InvertedUnit>>;\r\n unitSystemRuleSuppressions?: Array<IRuleSuppressionMap<UnitSystem>>;\r\n phenomenonRuleSuppressions?: Array<IRuleSuppressionMap<Phenomenon>>;\r\n constantRuleSuppressions?: Array<IRuleSuppressionMap<Constant>>;\r\n}\r\n"]}
1
+ {"version":3,"file":"RuleSuppressionSet.js","sourceRoot":"","sources":["../../../src/Validation/RuleSuppressionSet.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { AnyDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule suppressions used during schema validation.\r\n * Just telling us whether a rule is suppressed or not.\r\n * @beta\r\n */\r\nexport type ISuppressionRule<T extends AnyECType, U = object> = (diagnostic: AnyDiagnostic, ecDefinition: T, ...args: U[]) => Promise<boolean>;\r\n\r\n/** @beta */\r\nexport type BaseSuppressionRule<T extends AnyECType, U extends AnyECType> = ISuppressionRule<T, U>;\r\n\r\n/** @internal */\r\nexport type AnyRuleSuppressionMap = IRuleSuppressionMap<AnyECType>;\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionMap<T extends AnyECType, U = object> {\r\n ruleCode: string;\r\n rule: ISuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent elements of a rule suppression\r\n * @beta\r\n */\r\nexport interface BaseRuleSuppressionMap<T extends AnyECType, U extends AnyECType> {\r\n ruleCode: string;\r\n rule: BaseSuppressionRule<T, U>;\r\n}\r\n\r\n/**\r\n * Interface used to represent logical collection of [[ISuppressionRule]] instances.\r\n * @beta\r\n */\r\nexport interface IRuleSuppressionSet {\r\n name: string;\r\n schemaRuleSuppressions?: Array<IRuleSuppressionMap<Schema>>;\r\n schemaItemRuleSuppressions?: Array<IRuleSuppressionMap<SchemaItem>>;\r\n classRuleSuppressions?: Array<IRuleSuppressionMap<AnyClass>>;\r\n propertyRuleSuppressions?: Array<IRuleSuppressionMap<AnyProperty>>;\r\n entityRuleSuppressions?: Array<IRuleSuppressionMap<EntityClass>>;\r\n structRuleSuppressions?: Array<IRuleSuppressionMap<StructClass>>;\r\n mixinRuleSuppressions?: Array<IRuleSuppressionMap<Mixin>>;\r\n relationshipRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipClass>>;\r\n relationshipConstraintRuleSuppressions?: Array<IRuleSuppressionMap<RelationshipConstraint>>;\r\n customAttributeRuleSuppressions?: Array<IRuleSuppressionMap<CustomAttributeClass>>;\r\n customAttributeContainerSuppressions?: Array<IRuleSuppressionMap<CustomAttributeContainerProps>>;\r\n customAttributeInstanceSuppressions?: Array<BaseRuleSuppressionMap<CustomAttributeContainerProps, CustomAttribute>>;\r\n enumerationRuleSuppressions?: Array<IRuleSuppressionMap<Enumeration>>;\r\n koqRuleSuppressions?: Array<IRuleSuppressionMap<KindOfQuantity>>;\r\n propertyCategoryRuleSuppressions?: Array<IRuleSuppressionMap<PropertyCategory>>;\r\n formatRuleSuppressions?: Array<IRuleSuppressionMap<Format>>;\r\n unitRuleSuppressions?: Array<IRuleSuppressionMap<Unit>>;\r\n invertedUnitRuleSuppressions?: Array<IRuleSuppressionMap<InvertedUnit>>;\r\n unitSystemRuleSuppressions?: Array<IRuleSuppressionMap<UnitSystem>>;\r\n phenomenonRuleSuppressions?: Array<IRuleSuppressionMap<Phenomenon>>;\r\n constantRuleSuppressions?: Array<IRuleSuppressionMap<Constant>>;\r\n}\r\n"]}
@@ -7,7 +7,7 @@ import { BaseDiagnostic } from "./Diagnostic";
7
7
  * Interface used for all rule implementations used during schema validation.
8
8
  * @beta
9
9
  */
10
- export type IRule<T extends AnyECType, U = {}> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;
10
+ export type IRule<T extends AnyECType, U = object> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;
11
11
  /** @beta */
12
12
  export type BaseRule<T extends AnyECType, U extends AnyECType> = IRule<T, U>;
13
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Rules.d.ts","sourceRoot":"","sources":["../../../src/Validation/Rules.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,EAAE,oBAAoB,EACxF,6BAA6B,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAChH,gBAAgB,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAClG,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,KAAK,aAAa,CAAC,cAAc,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;AAE5H,YAAY;AACZ,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,g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;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { BaseDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule implementations used during schema validation.\r\n * @beta\r\n */\r\nexport type IRule<T extends AnyECType, U = {}> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;\r\n\r\n/** @beta */\r\nexport type BaseRule<T extends AnyECType, U extends AnyECType> = IRule<T, U>;\r\n\r\n/**\r\n * Interface used to represent logical collection of [IRule]($ecschema-editing) instances.\r\n * @beta\r\n */\r\nexport interface IRuleSet {\r\n /** The name of the rule set. */\r\n name: string;\r\n\r\n /** A collection of schema names that should be excluded from adhering to the rules defined in this rule set. */\r\n schemaExclusionSet?: string[];\r\n\r\n /** The rules that apply to [Schema]($ecschema-metadata) objects. */\r\n schemaRules?: Array<IRule<Schema>>;\r\n /** The rules that apply to [SchemaItem]($ecschema-metadata) objects. */\r\n schemaItemRules?: Array<IRule<SchemaItem>>;\r\n /** The rules that apply to [ECClass]($ecschema-metadata) objects. */\r\n classRules?: Array<IRule<AnyClass>>;\r\n /** The rules that apply to [Property]($ecschema-metadata) objects. */\r\n propertyRules?: Array<IRule<AnyProperty>>;\r\n /** The rules that apply to [EntityClass]($ecschema-metadata) objects. */\r\n entityClassRules?: Array<IRule<EntityClass>>;\r\n /** The rules that apply to [StructClass]($ecschema-metadata) objects. */\r\n structClassRules?: Array<IRule<StructClass>>;\r\n /** The rules that apply to [Mixin]($ecschema-metadata) objects. */\r\n mixinRules?: Array<IRule<Mixin>>;\r\n /** The rules that apply to [RelationshipClass]($ecschema-metadata) objects. */\r\n relationshipRules?: Array<IRule<RelationshipClass>>;\r\n /** The rules that apply to [RelationshipConstraint]($ecschema-metadata) objects. */\r\n relationshipConstraintRules?: Array<IRule<RelationshipConstraint>>;\r\n /** The rules that apply to [CustomAttributeClass]($ecschema-metadata) objects. */\r\n customAttributeClassRules?: Array<IRule<CustomAttributeClass>>;\r\n /** The rules that apply to [CustomAttributeContainerProps]($ecschema-metadata) objects. */\r\n customAttributeContainerRules?: Array<IRule<CustomAttributeContainerProps>>;\r\n /** The rules that apply to [CustomAttribute]($ecschema-metadata) objects. */\r\n customAttributeInstanceRules?: Array<BaseRule<CustomAttributeContainerProps, CustomAttribute>>;\r\n /** The rules that apply to [Enumeration]($ecschema-metadata) objects. */\r\n enumerationRules?: Array<IRule<Enumeration>>;\r\n /** The rules that apply to [KindOfQuantity]($ecschema-metadata) objects. */\r\n kindOfQuantityRules?: Array<IRule<KindOfQuantity>>;\r\n /** The rules that apply to [PropertyCategory]($ecschema-metadata) objects. */\r\n propertyCategoryRules?: Array<IRule<PropertyCategory>>;\r\n /** The rules that apply to [Format]($ecschema-metadata) objects. */\r\n formatRules?: Array<IRule<Format>>;\r\n /** The rules that apply to [Unit]($ecschema-metadata) objects. */\r\n unitRules?: Array<IRule<Unit>>;\r\n /** The rules that apply to [InvertedUnit]($ecschema-metadata) objects. */\r\n invertedUnitRules?: Array<IRule<InvertedUnit>>;\r\n /** The rules that apply to [UnitSystem]($ecschema-metadata) objects. */\r\n unitSystemRules?: Array<IRule<UnitSystem>>;\r\n /** The rules that apply to [Phenomenon]($ecschema-metadata) objects. */\r\n phenomenonRules?: Array<IRule<Phenomenon>>;\r\n /** The rules that apply to [Constant]($ecschema-metadata) objects. */\r\n constantRules?: Array<IRule<Constant>>;\r\n}\r\n"]}
1
+ {"version":3,"file":"Rules.js","sourceRoot":"","sources":["../../../src/Validation/Rules.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Validation\r\n */\r\n\r\nimport { AnyClass, AnyECType, AnyProperty, Constant, CustomAttribute, CustomAttributeClass,\r\n CustomAttributeContainerProps, EntityClass, Enumeration, Format, InvertedUnit, KindOfQuantity, Mixin, Phenomenon,\r\n PropertyCategory, RelationshipClass, RelationshipConstraint, Schema, SchemaItem, StructClass, Unit,\r\n UnitSystem } from \"@itwin/ecschema-metadata\";\r\nimport { BaseDiagnostic } from \"./Diagnostic\";\r\n\r\n/**\r\n * Interface used for all rule implementations used during schema validation.\r\n * @beta\r\n */\r\nexport type IRule<T extends AnyECType, U = object> = (ecDefinition: T, ...args: U[]) => AsyncIterable<BaseDiagnostic<T, any[]>>;\r\n\r\n/** @beta */\r\nexport type BaseRule<T extends AnyECType, U extends AnyECType> = IRule<T, U>;\r\n\r\n/**\r\n * Interface used to represent logical collection of [IRule]($ecschema-editing) instances.\r\n * @beta\r\n */\r\nexport interface IRuleSet {\r\n /** The name of the rule set. */\r\n name: string;\r\n\r\n /** A collection of schema names that should be excluded from adhering to the rules defined in this rule set. */\r\n schemaExclusionSet?: string[];\r\n\r\n /** The rules that apply to [Schema]($ecschema-metadata) objects. */\r\n schemaRules?: Array<IRule<Schema>>;\r\n /** The rules that apply to [SchemaItem]($ecschema-metadata) objects. */\r\n schemaItemRules?: Array<IRule<SchemaItem>>;\r\n /** The rules that apply to [ECClass]($ecschema-metadata) objects. */\r\n classRules?: Array<IRule<AnyClass>>;\r\n /** The rules that apply to [Property]($ecschema-metadata) objects. */\r\n propertyRules?: Array<IRule<AnyProperty>>;\r\n /** The rules that apply to [EntityClass]($ecschema-metadata) objects. */\r\n entityClassRules?: Array<IRule<EntityClass>>;\r\n /** The rules that apply to [StructClass]($ecschema-metadata) objects. */\r\n structClassRules?: Array<IRule<StructClass>>;\r\n /** The rules that apply to [Mixin]($ecschema-metadata) objects. */\r\n mixinRules?: Array<IRule<Mixin>>;\r\n /** The rules that apply to [RelationshipClass]($ecschema-metadata) objects. */\r\n relationshipRules?: Array<IRule<RelationshipClass>>;\r\n /** The rules that apply to [RelationshipConstraint]($ecschema-metadata) objects. */\r\n relationshipConstraintRules?: Array<IRule<RelationshipConstraint>>;\r\n /** The rules that apply to [CustomAttributeClass]($ecschema-metadata) objects. */\r\n customAttributeClassRules?: Array<IRule<CustomAttributeClass>>;\r\n /** The rules that apply to [CustomAttributeContainerProps]($ecschema-metadata) objects. */\r\n customAttributeContainerRules?: Array<IRule<CustomAttributeContainerProps>>;\r\n /** The rules that apply to [CustomAttribute]($ecschema-metadata) objects. */\r\n customAttributeInstanceRules?: Array<BaseRule<CustomAttributeContainerProps, CustomAttribute>>;\r\n /** The rules that apply to [Enumeration]($ecschema-metadata) objects. */\r\n enumerationRules?: Array<IRule<Enumeration>>;\r\n /** The rules that apply to [KindOfQuantity]($ecschema-metadata) objects. */\r\n kindOfQuantityRules?: Array<IRule<KindOfQuantity>>;\r\n /** The rules that apply to [PropertyCategory]($ecschema-metadata) objects. */\r\n propertyCategoryRules?: Array<IRule<PropertyCategory>>;\r\n /** The rules that apply to [Format]($ecschema-metadata) objects. */\r\n formatRules?: Array<IRule<Format>>;\r\n /** The rules that apply to [Unit]($ecschema-metadata) objects. */\r\n unitRules?: Array<IRule<Unit>>;\r\n /** The rules that apply to [InvertedUnit]($ecschema-metadata) objects. */\r\n invertedUnitRules?: Array<IRule<InvertedUnit>>;\r\n /** The rules that apply to [UnitSystem]($ecschema-metadata) objects. */\r\n unitSystemRules?: Array<IRule<UnitSystem>>;\r\n /** The rules that apply to [Phenomenon]($ecschema-metadata) objects. */\r\n phenomenonRules?: Array<IRule<Phenomenon>>;\r\n /** The rules that apply to [Constant]($ecschema-metadata) objects. */\r\n constantRules?: Array<IRule<Constant>>;\r\n}\r\n"]}