@itwin/ecschema-metadata 5.0.0-dev.99 → 5.1.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/lib/cjs/Constants.js.map +1 -1
- package/lib/cjs/Context.d.ts +3 -3
- package/lib/cjs/Context.d.ts.map +1 -1
- package/lib/cjs/Context.js +6 -6
- package/lib/cjs/Context.js.map +1 -1
- package/lib/cjs/DelayedPromise.d.ts +9 -8
- package/lib/cjs/DelayedPromise.d.ts.map +1 -1
- package/lib/cjs/DelayedPromise.js +2 -2
- package/lib/cjs/DelayedPromise.js.map +1 -1
- package/lib/cjs/Deserialization/AbstractParser.js.map +1 -1
- package/lib/cjs/Deserialization/Helper.d.ts.map +1 -1
- package/lib/cjs/Deserialization/Helper.js +27 -26
- package/lib/cjs/Deserialization/Helper.js.map +1 -1
- package/lib/cjs/Deserialization/JsonParser.js +150 -150
- package/lib/cjs/Deserialization/JsonParser.js.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.d.ts +34 -34
- package/lib/cjs/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/cjs/Deserialization/JsonProps.js +3 -3
- package/lib/cjs/Deserialization/JsonProps.js.map +1 -1
- package/lib/cjs/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/cjs/Deserialization/XmlParser.js +49 -49
- package/lib/cjs/Deserialization/XmlParser.js.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/cjs/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/cjs/Deserialization/XmlSerializationUtils.js +6 -11
- package/lib/cjs/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/cjs/ECName.d.ts +2 -2
- package/lib/cjs/ECName.js +4 -4
- package/lib/cjs/ECName.js.map +1 -1
- package/lib/cjs/ECObjects.d.ts +23 -11
- package/lib/cjs/ECObjects.d.ts.map +1 -1
- package/lib/cjs/ECObjects.js +47 -24
- package/lib/cjs/ECObjects.js.map +1 -1
- package/lib/cjs/Exception.d.ts +4 -4
- package/lib/cjs/Exception.d.ts.map +1 -1
- package/lib/cjs/Exception.js +60 -60
- package/lib/cjs/Exception.js.map +1 -1
- package/lib/cjs/Interfaces.d.ts +30 -34
- package/lib/cjs/Interfaces.d.ts.map +1 -1
- package/lib/cjs/Interfaces.js.map +1 -1
- package/lib/cjs/Metadata/Class.d.ts +107 -19
- package/lib/cjs/Metadata/Class.d.ts.map +1 -1
- package/lib/cjs/Metadata/Class.js +127 -47
- package/lib/cjs/Metadata/Class.js.map +1 -1
- package/lib/cjs/Metadata/Constant.d.ts +12 -9
- package/lib/cjs/Metadata/Constant.d.ts.map +1 -1
- package/lib/cjs/Metadata/Constant.js +12 -9
- package/lib/cjs/Metadata/Constant.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/cjs/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttribute.js.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts +5 -3
- package/lib/cjs/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/CustomAttributeClass.js +7 -5
- package/lib/cjs/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/cjs/Metadata/EntityClass.d.ts +20 -3
- package/lib/cjs/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/EntityClass.js +32 -14
- package/lib/cjs/Metadata/EntityClass.js.map +1 -1
- package/lib/cjs/Metadata/Enumeration.d.ts +16 -9
- package/lib/cjs/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/cjs/Metadata/Enumeration.js +20 -13
- package/lib/cjs/Metadata/Enumeration.js.map +1 -1
- package/lib/cjs/Metadata/Format.d.ts +32 -24
- package/lib/cjs/Metadata/Format.d.ts.map +1 -1
- package/lib/cjs/Metadata/Format.js +47 -27
- package/lib/cjs/Metadata/Format.js.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.d.ts +11 -7
- package/lib/cjs/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/cjs/Metadata/InvertedUnit.js +16 -10
- package/lib/cjs/Metadata/InvertedUnit.js.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.d.ts +24 -15
- package/lib/cjs/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/cjs/Metadata/KindOfQuantity.js +54 -29
- package/lib/cjs/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/cjs/Metadata/Mixin.d.ts +16 -3
- package/lib/cjs/Metadata/Mixin.d.ts.map +1 -1
- package/lib/cjs/Metadata/Mixin.js +20 -7
- package/lib/cjs/Metadata/Mixin.js.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/cjs/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/cjs/Metadata/OverrideFormat.js +27 -19
- package/lib/cjs/Metadata/OverrideFormat.js.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.d.ts +10 -2
- package/lib/cjs/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/cjs/Metadata/Phenomenon.js +11 -3
- package/lib/cjs/Metadata/Phenomenon.js.map +1 -1
- package/lib/cjs/Metadata/Property.d.ts +46 -28
- package/lib/cjs/Metadata/Property.d.ts.map +1 -1
- package/lib/cjs/Metadata/Property.js +46 -22
- package/lib/cjs/Metadata/Property.js.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.d.ts +6 -3
- package/lib/cjs/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/cjs/Metadata/PropertyCategory.js +12 -5
- package/lib/cjs/Metadata/PropertyCategory.js.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.d.ts +48 -25
- package/lib/cjs/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/cjs/Metadata/RelationshipClass.js +54 -34
- package/lib/cjs/Metadata/RelationshipClass.js.map +1 -1
- package/lib/cjs/Metadata/Schema.d.ts +50 -28
- package/lib/cjs/Metadata/Schema.d.ts.map +1 -1
- package/lib/cjs/Metadata/Schema.js +64 -42
- package/lib/cjs/Metadata/Schema.js.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.d.ts +10 -19
- package/lib/cjs/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/cjs/Metadata/SchemaItem.js +12 -20
- package/lib/cjs/Metadata/SchemaItem.js.map +1 -1
- package/lib/cjs/Metadata/Unit.d.ts +17 -21
- package/lib/cjs/Metadata/Unit.d.ts.map +1 -1
- package/lib/cjs/Metadata/Unit.js +20 -22
- package/lib/cjs/Metadata/Unit.js.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.d.ts +3 -1
- package/lib/cjs/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/cjs/Metadata/UnitSystem.js +4 -2
- package/lib/cjs/Metadata/UnitSystem.js.map +1 -1
- package/lib/cjs/PropertyTypes.d.ts +11 -11
- package/lib/cjs/PropertyTypes.d.ts.map +1 -1
- package/lib/cjs/PropertyTypes.js +28 -20
- package/lib/cjs/PropertyTypes.js.map +1 -1
- package/lib/cjs/SchemaFormatsProvider.d.ts +39 -0
- package/lib/cjs/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/cjs/SchemaFormatsProvider.js +146 -0
- package/lib/cjs/SchemaFormatsProvider.js.map +1 -0
- package/lib/cjs/SchemaJsonLocater.d.ts +5 -5
- package/lib/cjs/SchemaJsonLocater.js +4 -4
- package/lib/cjs/SchemaJsonLocater.js.map +1 -1
- package/lib/cjs/SchemaKey.d.ts +6 -6
- package/lib/cjs/SchemaKey.d.ts.map +1 -1
- package/lib/cjs/SchemaKey.js +9 -9
- package/lib/cjs/SchemaKey.js.map +1 -1
- package/lib/cjs/SchemaLoader.d.ts +3 -3
- package/lib/cjs/SchemaLoader.js +4 -4
- package/lib/cjs/SchemaLoader.js.map +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/cjs/SchemaPartVisitorDelegate.js +1 -1
- package/lib/cjs/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/cjs/UnitConversion/Graph.js.map +1 -1
- package/lib/cjs/UnitConversion/Parser.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/cjs/UnitConversion/UnitTree.js.map +1 -1
- package/lib/cjs/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/cjs/Validation/SchemaWalker.js.map +1 -1
- package/lib/cjs/ecschema-metadata.d.ts +2 -1
- package/lib/cjs/ecschema-metadata.d.ts.map +1 -1
- package/lib/cjs/ecschema-metadata.js +1 -0
- package/lib/cjs/ecschema-metadata.js.map +1 -1
- package/lib/cjs/utils/SchemaGraph.js +3 -3
- package/lib/cjs/utils/SchemaGraph.js.map +1 -1
- package/lib/esm/Constants.js.map +1 -1
- package/lib/esm/Context.d.ts +3 -3
- package/lib/esm/Context.d.ts.map +1 -1
- package/lib/esm/Context.js +7 -7
- package/lib/esm/Context.js.map +1 -1
- package/lib/esm/DelayedPromise.d.ts +9 -8
- package/lib/esm/DelayedPromise.d.ts.map +1 -1
- package/lib/esm/DelayedPromise.js +2 -2
- package/lib/esm/DelayedPromise.js.map +1 -1
- package/lib/esm/Deserialization/AbstractParser.js.map +1 -1
- package/lib/esm/Deserialization/Helper.d.ts.map +1 -1
- package/lib/esm/Deserialization/Helper.js +28 -27
- package/lib/esm/Deserialization/Helper.js.map +1 -1
- package/lib/esm/Deserialization/JsonParser.js +151 -151
- package/lib/esm/Deserialization/JsonParser.js.map +1 -1
- package/lib/esm/Deserialization/JsonProps.d.ts +34 -34
- package/lib/esm/Deserialization/JsonProps.d.ts.map +1 -1
- package/lib/esm/Deserialization/JsonProps.js +3 -3
- package/lib/esm/Deserialization/JsonProps.js.map +1 -1
- package/lib/esm/Deserialization/SchemaGraphUtil.js.map +1 -1
- package/lib/esm/Deserialization/XmlParser.js +50 -50
- package/lib/esm/Deserialization/XmlParser.js.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts +0 -5
- package/lib/esm/Deserialization/XmlSerializationUtils.d.ts.map +1 -1
- package/lib/esm/Deserialization/XmlSerializationUtils.js +7 -12
- package/lib/esm/Deserialization/XmlSerializationUtils.js.map +1 -1
- package/lib/esm/ECName.d.ts +2 -2
- package/lib/esm/ECName.js +5 -5
- package/lib/esm/ECName.js.map +1 -1
- package/lib/esm/ECObjects.d.ts +23 -11
- package/lib/esm/ECObjects.d.ts.map +1 -1
- package/lib/esm/ECObjects.js +48 -25
- package/lib/esm/ECObjects.js.map +1 -1
- package/lib/esm/Exception.d.ts +4 -4
- package/lib/esm/Exception.d.ts.map +1 -1
- package/lib/esm/Exception.js +58 -58
- package/lib/esm/Exception.js.map +1 -1
- package/lib/esm/Interfaces.d.ts +30 -34
- package/lib/esm/Interfaces.d.ts.map +1 -1
- package/lib/esm/Interfaces.js.map +1 -1
- package/lib/esm/Metadata/Class.d.ts +107 -19
- package/lib/esm/Metadata/Class.d.ts.map +1 -1
- package/lib/esm/Metadata/Class.js +128 -48
- package/lib/esm/Metadata/Class.js.map +1 -1
- package/lib/esm/Metadata/Constant.d.ts +12 -9
- package/lib/esm/Metadata/Constant.d.ts.map +1 -1
- package/lib/esm/Metadata/Constant.js +13 -10
- package/lib/esm/Metadata/Constant.js.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.d.ts +2 -2
- package/lib/esm/Metadata/CustomAttribute.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttribute.js.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.d.ts +5 -3
- package/lib/esm/Metadata/CustomAttributeClass.d.ts.map +1 -1
- package/lib/esm/Metadata/CustomAttributeClass.js +8 -6
- package/lib/esm/Metadata/CustomAttributeClass.js.map +1 -1
- package/lib/esm/Metadata/EntityClass.d.ts +20 -3
- package/lib/esm/Metadata/EntityClass.d.ts.map +1 -1
- package/lib/esm/Metadata/EntityClass.js +33 -15
- package/lib/esm/Metadata/EntityClass.js.map +1 -1
- package/lib/esm/Metadata/Enumeration.d.ts +16 -9
- package/lib/esm/Metadata/Enumeration.d.ts.map +1 -1
- package/lib/esm/Metadata/Enumeration.js +21 -14
- package/lib/esm/Metadata/Enumeration.js.map +1 -1
- package/lib/esm/Metadata/Format.d.ts +32 -24
- package/lib/esm/Metadata/Format.d.ts.map +1 -1
- package/lib/esm/Metadata/Format.js +48 -28
- package/lib/esm/Metadata/Format.js.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.d.ts +11 -7
- package/lib/esm/Metadata/InvertedUnit.d.ts.map +1 -1
- package/lib/esm/Metadata/InvertedUnit.js +17 -11
- package/lib/esm/Metadata/InvertedUnit.js.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.d.ts +24 -15
- package/lib/esm/Metadata/KindOfQuantity.d.ts.map +1 -1
- package/lib/esm/Metadata/KindOfQuantity.js +55 -30
- package/lib/esm/Metadata/KindOfQuantity.js.map +1 -1
- package/lib/esm/Metadata/Mixin.d.ts +16 -3
- package/lib/esm/Metadata/Mixin.d.ts.map +1 -1
- package/lib/esm/Metadata/Mixin.js +21 -8
- package/lib/esm/Metadata/Mixin.js.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.d.ts +12 -12
- package/lib/esm/Metadata/OverrideFormat.d.ts.map +1 -1
- package/lib/esm/Metadata/OverrideFormat.js +28 -20
- package/lib/esm/Metadata/OverrideFormat.js.map +1 -1
- package/lib/esm/Metadata/Phenomenon.d.ts +10 -2
- package/lib/esm/Metadata/Phenomenon.d.ts.map +1 -1
- package/lib/esm/Metadata/Phenomenon.js +12 -4
- package/lib/esm/Metadata/Phenomenon.js.map +1 -1
- package/lib/esm/Metadata/Property.d.ts +46 -28
- package/lib/esm/Metadata/Property.d.ts.map +1 -1
- package/lib/esm/Metadata/Property.js +47 -23
- package/lib/esm/Metadata/Property.js.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.d.ts +6 -3
- package/lib/esm/Metadata/PropertyCategory.d.ts.map +1 -1
- package/lib/esm/Metadata/PropertyCategory.js +13 -6
- package/lib/esm/Metadata/PropertyCategory.js.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.d.ts +48 -25
- package/lib/esm/Metadata/RelationshipClass.d.ts.map +1 -1
- package/lib/esm/Metadata/RelationshipClass.js +55 -35
- package/lib/esm/Metadata/RelationshipClass.js.map +1 -1
- package/lib/esm/Metadata/Schema.d.ts +50 -28
- package/lib/esm/Metadata/Schema.d.ts.map +1 -1
- package/lib/esm/Metadata/Schema.js +65 -43
- package/lib/esm/Metadata/Schema.js.map +1 -1
- package/lib/esm/Metadata/SchemaItem.d.ts +10 -19
- package/lib/esm/Metadata/SchemaItem.d.ts.map +1 -1
- package/lib/esm/Metadata/SchemaItem.js +13 -21
- package/lib/esm/Metadata/SchemaItem.js.map +1 -1
- package/lib/esm/Metadata/Unit.d.ts +17 -21
- package/lib/esm/Metadata/Unit.d.ts.map +1 -1
- package/lib/esm/Metadata/Unit.js +21 -23
- package/lib/esm/Metadata/Unit.js.map +1 -1
- package/lib/esm/Metadata/UnitSystem.d.ts +3 -1
- package/lib/esm/Metadata/UnitSystem.d.ts.map +1 -1
- package/lib/esm/Metadata/UnitSystem.js +5 -3
- package/lib/esm/Metadata/UnitSystem.js.map +1 -1
- package/lib/esm/PropertyTypes.d.ts +11 -11
- package/lib/esm/PropertyTypes.d.ts.map +1 -1
- package/lib/esm/PropertyTypes.js +29 -21
- package/lib/esm/PropertyTypes.js.map +1 -1
- package/lib/esm/SchemaFormatsProvider.d.ts +39 -0
- package/lib/esm/SchemaFormatsProvider.d.ts.map +1 -0
- package/lib/esm/SchemaFormatsProvider.js +142 -0
- package/lib/esm/SchemaFormatsProvider.js.map +1 -0
- package/lib/esm/SchemaJsonLocater.d.ts +5 -5
- package/lib/esm/SchemaJsonLocater.js +4 -4
- package/lib/esm/SchemaJsonLocater.js.map +1 -1
- package/lib/esm/SchemaKey.d.ts +6 -6
- package/lib/esm/SchemaKey.d.ts.map +1 -1
- package/lib/esm/SchemaKey.js +10 -10
- package/lib/esm/SchemaKey.js.map +1 -1
- package/lib/esm/SchemaLoader.d.ts +3 -3
- package/lib/esm/SchemaLoader.js +5 -5
- package/lib/esm/SchemaLoader.js.map +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.d.ts +2 -2
- package/lib/esm/SchemaPartVisitorDelegate.js +1 -1
- package/lib/esm/SchemaPartVisitorDelegate.js.map +1 -1
- package/lib/esm/UnitConversion/Graph.js.map +1 -1
- package/lib/esm/UnitConversion/Parser.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConversion.js.map +1 -1
- package/lib/esm/UnitConversion/UnitConverter.js.map +1 -1
- package/lib/esm/UnitConversion/UnitTree.js.map +1 -1
- package/lib/esm/UnitProvider/SchemaUnitProvider.js.map +1 -1
- package/lib/esm/Validation/SchemaWalker.js.map +1 -1
- package/lib/esm/ecschema-metadata.d.ts +2 -1
- package/lib/esm/ecschema-metadata.d.ts.map +1 -1
- package/lib/esm/ecschema-metadata.js +1 -0
- package/lib/esm/ecschema-metadata.js.map +1 -1
- package/lib/esm/utils/SchemaGraph.js +4 -4
- package/lib/esm/utils/SchemaGraph.js.map +1 -1
- package/package.json +8 -6
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { assert } from "@itwin/core-bentley";
|
|
6
6
|
import { parsePrimitiveType, PrimitiveType, primitiveTypeToString, StrengthDirection, strengthDirectionToString } from "../ECObjects";
|
|
7
|
-
import {
|
|
7
|
+
import { ECSchemaError, ECSchemaStatus } from "../Exception";
|
|
8
8
|
import { Enumeration } from "../Metadata/Enumeration";
|
|
9
9
|
import { ECName } from "../ECName";
|
|
10
10
|
import { AbstractParser } from "./AbstractParser";
|
|
@@ -49,18 +49,18 @@ export class XmlParser extends AbstractParser {
|
|
|
49
49
|
parseSchema() {
|
|
50
50
|
const schemaMetadata = this._rawSchema.documentElement;
|
|
51
51
|
if ("ECSchema" !== schemaMetadata.nodeName)
|
|
52
|
-
throw new
|
|
52
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, "An ECSchema is missing the required metadata.");
|
|
53
53
|
const schemaDefDuplicates = this.getElementChildrenByTagName(schemaMetadata, "ECSchema");
|
|
54
54
|
if (schemaDefDuplicates.length > 1)
|
|
55
|
-
throw new
|
|
55
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, "An ECSchema has more than one ECSchema definition. Only one is allowed.");
|
|
56
56
|
if (this._schemaName === undefined)
|
|
57
|
-
throw new
|
|
57
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `An ECSchema is missing a required 'schemaName' attribute`);
|
|
58
58
|
if (this._schemaVersion === undefined)
|
|
59
|
-
throw new
|
|
59
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'version' attribute`);
|
|
60
60
|
if (this._xmlNamespace === undefined)
|
|
61
|
-
throw new
|
|
61
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} is missing a required 'xmlns' attribute`);
|
|
62
62
|
if (this._ecSpecVersion === undefined)
|
|
63
|
-
throw new
|
|
63
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECSchema ${this._schemaName} has an invalid 'xmlns' attribute`);
|
|
64
64
|
const alias = this.getRequiredAttribute(schemaMetadata, "alias", `The ECSchema ${this._schemaName} is missing a required 'alias' attribute`);
|
|
65
65
|
const description = this.getOptionalAttribute(schemaMetadata, "description");
|
|
66
66
|
const displayLabel = this.getOptionalAttribute(schemaMetadata, "displayLabel");
|
|
@@ -101,11 +101,11 @@ export class XmlParser extends AbstractParser {
|
|
|
101
101
|
if (itemType === undefined) {
|
|
102
102
|
if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
103
103
|
continue;
|
|
104
|
-
throw new
|
|
104
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `A SchemaItem in ${this._schemaName} has an invalid type. '${rawItemType}' is not a valid SchemaItem type.`);
|
|
105
105
|
}
|
|
106
106
|
const itemName = this.getRequiredAttribute(item, "typeName", `A SchemaItem in ${this._schemaName} is missing the required 'typeName' attribute.`);
|
|
107
107
|
if (!ECName.validate(itemName))
|
|
108
|
-
throw new
|
|
108
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECName, `A SchemaItem in ${this._schemaName} has an invalid 'typeName' attribute. '${itemName}' is not a valid ECName.`);
|
|
109
109
|
this._currentItemFullName = `${this._schemaName}.${itemName}`;
|
|
110
110
|
this._schemaItems.set(itemName, [itemType, item]);
|
|
111
111
|
yield [itemName, itemType, item];
|
|
@@ -164,22 +164,22 @@ export class XmlParser extends AbstractParser {
|
|
|
164
164
|
const baseClasses = this.getElementChildrenByTagName(xmlElement, "BaseClass");
|
|
165
165
|
// Mixins can only have one base class
|
|
166
166
|
if (baseClasses.length > 1)
|
|
167
|
-
throw new
|
|
167
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} has more than one base class which is not allowed.`);
|
|
168
168
|
const customAttributesResult = this.getElementChildrenByTagName(xmlElement, "ECCustomAttributes");
|
|
169
169
|
if (customAttributesResult.length < 1)
|
|
170
|
-
throw new
|
|
170
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);
|
|
171
171
|
const customAttributes = customAttributesResult[0];
|
|
172
172
|
const isMixinResult = this.getElementChildrenByTagName(customAttributes, "IsMixin");
|
|
173
173
|
if (isMixinResult.length < 1)
|
|
174
|
-
throw new
|
|
174
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'IsMixin' tag.`);
|
|
175
175
|
const mixinAttributes = isMixinResult[0];
|
|
176
176
|
const appliesToResult = this.getElementChildrenByTagName(mixinAttributes, "AppliesToEntityClass");
|
|
177
177
|
if (appliesToResult.length < 1)
|
|
178
|
-
throw new
|
|
178
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);
|
|
179
179
|
const appliesToElement = appliesToResult[0];
|
|
180
180
|
let appliesTo = appliesToElement.textContent;
|
|
181
181
|
if (appliesTo === null || appliesTo.length === 0)
|
|
182
|
-
throw new
|
|
182
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Mixin ${this._currentItemFullName} is missing the required 'AppliesToEntityClass' tag.`);
|
|
183
183
|
appliesTo = this.getQualifiedTypeName(appliesTo);
|
|
184
184
|
const mixinProps = {
|
|
185
185
|
...classProps,
|
|
@@ -208,17 +208,17 @@ export class XmlParser extends AbstractParser {
|
|
|
208
208
|
const sourceResult = this.getElementChildrenByTagName(xmlElement, "Source");
|
|
209
209
|
if (sourceResult.length !== 1) {
|
|
210
210
|
if (sourceResult.length === 0)
|
|
211
|
-
throw new
|
|
211
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);
|
|
212
212
|
else
|
|
213
|
-
throw new
|
|
213
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Source constraint tag. Only one is allowed.`);
|
|
214
214
|
}
|
|
215
215
|
const source = this.getRelationshipConstraintProps(sourceResult[0], true);
|
|
216
216
|
const targetResult = this.getElementChildrenByTagName(xmlElement, "Target");
|
|
217
217
|
if (targetResult.length !== 1) {
|
|
218
218
|
if (targetResult.length === 0)
|
|
219
|
-
throw new
|
|
219
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);
|
|
220
220
|
else
|
|
221
|
-
throw new
|
|
221
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} has more than one Target constraint tag. Only one is allowed.`);
|
|
222
222
|
}
|
|
223
223
|
const target = this.getRelationshipConstraintProps(targetResult[0], false);
|
|
224
224
|
return {
|
|
@@ -245,7 +245,7 @@ export class XmlParser extends AbstractParser {
|
|
|
245
245
|
if (SchemaReadHelper.isECSpecVersionNewer(this._ecSpecVersion))
|
|
246
246
|
tempBackingType = PrimitiveType.String;
|
|
247
247
|
else
|
|
248
|
-
throw new
|
|
248
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidECJson, `The Enumeration ${this._currentItemFullName} has an invalid 'backingTypeName' attribute. It should be either "int" or "string".`);
|
|
249
249
|
}
|
|
250
250
|
let isStrictString = this.getOptionalAttribute(xmlElement, "isStrict");
|
|
251
251
|
if (isStrictString === undefined)
|
|
@@ -260,7 +260,7 @@ export class XmlParser extends AbstractParser {
|
|
|
260
260
|
if (PrimitiveType.Integer === tempBackingType) {
|
|
261
261
|
const numericValue = parseInt(valueString, 10);
|
|
262
262
|
if (isNaN(numericValue))
|
|
263
|
-
throw new
|
|
263
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Enumeration ${this._currentItemFullName} of type "int" has an enumerator with a non-integer value.`);
|
|
264
264
|
value = numericValue;
|
|
265
265
|
}
|
|
266
266
|
const label = this.getOptionalAttribute(element, "displayLabel");
|
|
@@ -286,7 +286,7 @@ export class XmlParser extends AbstractParser {
|
|
|
286
286
|
const relativeErrorString = this.getRequiredAttribute(xmlElement, "relativeError", `The KindOfQuantity ${this._currentItemFullName} is missing the required 'relativeError' attribute.`);
|
|
287
287
|
const relativeError = parseFloat(relativeErrorString);
|
|
288
288
|
if (isNaN(relativeError))
|
|
289
|
-
throw new
|
|
289
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The KindOfQuantity ${this._currentItemFullName} has an invalid 'relativeError' attribute. It should be a numeric value.`);
|
|
290
290
|
const presentationUnitsString = this.getOptionalAttribute(xmlElement, "presentationUnits");
|
|
291
291
|
let presentationUnits;
|
|
292
292
|
if (presentationUnitsString)
|
|
@@ -305,7 +305,7 @@ export class XmlParser extends AbstractParser {
|
|
|
305
305
|
const priorityString = this.getRequiredAttribute(xmlElement, "priority", `The PropertyCategory ${this._currentItemFullName} is missing the required 'priority' attribute.`);
|
|
306
306
|
const priority = parseInt(priorityString, 10);
|
|
307
307
|
if (isNaN(priority))
|
|
308
|
-
throw new
|
|
308
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The PropertyCategory ${this._currentItemFullName} has an invalid 'priority' attribute. It should be a numeric value.`);
|
|
309
309
|
return {
|
|
310
310
|
...itemProps,
|
|
311
311
|
priority,
|
|
@@ -394,11 +394,11 @@ export class XmlParser extends AbstractParser {
|
|
|
394
394
|
const units = new Array();
|
|
395
395
|
const unitsResult = this.getElementChildrenByTagName(compositeElement, "Unit");
|
|
396
396
|
if (unitsResult.length < 1)
|
|
397
|
-
throw new
|
|
397
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has an invalid 'Composite' element. It should have 1-4 Unit elements.`);
|
|
398
398
|
for (const unit of unitsResult) {
|
|
399
399
|
let name = unit.textContent;
|
|
400
400
|
if (null === name || 0 === name.length)
|
|
401
|
-
throw new
|
|
401
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The Format ${this._currentItemFullName} has a Composite with an invalid Unit. One of the Units is missing the required 'name' attribute.`);
|
|
402
402
|
const label = this.getOptionalAttribute(unit, "label");
|
|
403
403
|
name = this.getQualifiedTypeName(name);
|
|
404
404
|
units.push({ name, label });
|
|
@@ -438,7 +438,7 @@ export class XmlParser extends AbstractParser {
|
|
|
438
438
|
const propertyType = this.getPropertyType(childType);
|
|
439
439
|
// This may not be needed, just a failsafe if the regex is faulty
|
|
440
440
|
if (propertyType === undefined)
|
|
441
|
-
throw new
|
|
441
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${itemName}.${propertyName} has an invalid type. ${childType} is not a valid ECProperty type.`);
|
|
442
442
|
yield [propertyName, propertyType, child];
|
|
443
443
|
}
|
|
444
444
|
}
|
|
@@ -499,12 +499,12 @@ export class XmlParser extends AbstractParser {
|
|
|
499
499
|
getRelationshipConstraintCustomAttributeProviders(xmlElement) {
|
|
500
500
|
const sourceResult = this.getElementChildrenByTagName(xmlElement, "Source");
|
|
501
501
|
if (sourceResult.length < 1)
|
|
502
|
-
throw new
|
|
502
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Source constraint tag.`);
|
|
503
503
|
const sourceElement = sourceResult[0];
|
|
504
504
|
const sourceCustomAttributes = this.getCustomAttributeProviders(sourceElement, "Source Constraint of", this._currentItemFullName);
|
|
505
505
|
const targetResult = this.getElementChildrenByTagName(xmlElement, "Target");
|
|
506
506
|
if (targetResult.length < 1)
|
|
507
|
-
throw new
|
|
507
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The RelationshipClass ${this._currentItemFullName} is missing the required Target constraint tag.`);
|
|
508
508
|
const targetElement = targetResult[0];
|
|
509
509
|
const targetCustomAttributes = this.getCustomAttributeProviders(targetElement, "Source Constraint of", this._currentItemFullName);
|
|
510
510
|
return [sourceCustomAttributes, targetCustomAttributes];
|
|
@@ -553,7 +553,7 @@ export class XmlParser extends AbstractParser {
|
|
|
553
553
|
if (resultString) {
|
|
554
554
|
result = parseFloat(resultString);
|
|
555
555
|
if (isNaN(result))
|
|
556
|
-
throw new
|
|
556
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
557
557
|
}
|
|
558
558
|
return result;
|
|
559
559
|
}
|
|
@@ -563,7 +563,7 @@ export class XmlParser extends AbstractParser {
|
|
|
563
563
|
if (resultString) {
|
|
564
564
|
result = parseInt(resultString, 10);
|
|
565
565
|
if (isNaN(result))
|
|
566
|
-
throw new
|
|
566
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
567
567
|
}
|
|
568
568
|
return result;
|
|
569
569
|
}
|
|
@@ -574,14 +574,14 @@ export class XmlParser extends AbstractParser {
|
|
|
574
574
|
else if ("false" === textString)
|
|
575
575
|
return false;
|
|
576
576
|
else
|
|
577
|
-
throw new
|
|
577
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, parseErrorMsg);
|
|
578
578
|
}
|
|
579
579
|
getRequiredAttribute(xmlElement, attributeName, errorMsg) {
|
|
580
580
|
if (!xmlElement.hasAttribute(attributeName))
|
|
581
|
-
throw new
|
|
581
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);
|
|
582
582
|
const result = xmlElement.getAttribute(attributeName);
|
|
583
583
|
if (result === null)
|
|
584
|
-
throw new
|
|
584
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, errorMsg);
|
|
585
585
|
return result;
|
|
586
586
|
}
|
|
587
587
|
getSchemaReference(xmlElement) {
|
|
@@ -657,11 +657,11 @@ export class XmlParser extends AbstractParser {
|
|
|
657
657
|
const constraintClasses = new Array();
|
|
658
658
|
const constraintClassesResult = this.getElementChildrenByTagName(xmlElement, "Class");
|
|
659
659
|
if (constraintClassesResult.length < 1)
|
|
660
|
-
throw new
|
|
660
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} is missing the required Class tags.`);
|
|
661
661
|
for (const constraintClass of constraintClassesResult) {
|
|
662
662
|
let constraintClassId = constraintClass.getAttribute("class");
|
|
663
663
|
if (null === constraintClassId || 0 === constraintClassId.length)
|
|
664
|
-
throw new
|
|
664
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ${constraintName} has a Class that is missing the required 'class' attribute.`);
|
|
665
665
|
constraintClassId = this.getQualifiedTypeName(constraintClassId);
|
|
666
666
|
constraintClasses.push(constraintClassId);
|
|
667
667
|
}
|
|
@@ -690,7 +690,7 @@ export class XmlParser extends AbstractParser {
|
|
|
690
690
|
const propName = this.getPropertyName(xmlElement);
|
|
691
691
|
const propType = this.getPropertyType(xmlElement.nodeName);
|
|
692
692
|
if (propType === undefined)
|
|
693
|
-
throw new
|
|
693
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid type. ${propType} is not a valid ECProperty type.`);
|
|
694
694
|
const label = this.getOptionalAttribute(xmlElement, "displayLabel");
|
|
695
695
|
const description = this.getOptionalAttribute(xmlElement, "description");
|
|
696
696
|
const readOnlyString = this.getOptionalAttribute(xmlElement, "readOnly");
|
|
@@ -758,7 +758,7 @@ export class XmlParser extends AbstractParser {
|
|
|
758
758
|
else if (undefined !== maxOccursStr) {
|
|
759
759
|
maxOccurs = parseInt(maxOccursStr, 10);
|
|
760
760
|
if (isNaN(maxOccurs))
|
|
761
|
-
throw new
|
|
761
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `The ECProperty ${this._currentItemFullName}.${propName} has an invalid 'maxOccurs' attribute. It should be a numeric value.`);
|
|
762
762
|
}
|
|
763
763
|
return { minOccurs, maxOccurs };
|
|
764
764
|
}
|
|
@@ -782,7 +782,7 @@ export class XmlParser extends AbstractParser {
|
|
|
782
782
|
ns = `${this._schemaName}.${this._schemaVersion}`;
|
|
783
783
|
}
|
|
784
784
|
if (null === ns || !this.isSchemaFullNameValidForVersion(ns, this._ecSpecVersion))
|
|
785
|
-
throw new
|
|
785
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Custom attribute namespaces must contain a valid 3.2 full schema name in the form <schemaName>.RR.ww.mm.`);
|
|
786
786
|
const schemaNameParts = ns.split(".");
|
|
787
787
|
const className = `${schemaNameParts[0]}.${xmlCustomAttribute.tagName}`;
|
|
788
788
|
const properties = this.getElementChildren(xmlCustomAttribute);
|
|
@@ -811,7 +811,7 @@ export class XmlParser extends AbstractParser {
|
|
|
811
811
|
if (propertyClass.isEnumeration() && propertyClass.enumeration) {
|
|
812
812
|
enumeration = propertyClass.schema.lookupItemSync(propertyClass.enumeration.fullName, Enumeration);
|
|
813
813
|
if (!enumeration)
|
|
814
|
-
throw new
|
|
814
|
+
throw new ECSchemaError(ECSchemaStatus.ClassNotFound, `The Enumeration class '${propertyClass.enumeration.fullName}' could not be found.`);
|
|
815
815
|
}
|
|
816
816
|
const primitiveType = enumeration && enumeration.type ? enumeration.type : (propertyClass).primitiveType;
|
|
817
817
|
return this.readPrimitivePropertyValue(propElement, primitiveType);
|
|
@@ -858,9 +858,9 @@ export class XmlParser extends AbstractParser {
|
|
|
858
858
|
}
|
|
859
859
|
readPrimitivePropertyValue(propElement, primitiveType) {
|
|
860
860
|
if (undefined === propElement.textContent || null === propElement.textContent)
|
|
861
|
-
throw new
|
|
861
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
|
|
862
862
|
if (propElement.textContent === "" && primitiveType !== PrimitiveType.String)
|
|
863
|
-
throw new
|
|
863
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid property value.`);
|
|
864
864
|
// TODO: Mapping all primitive types to string, number and boolean
|
|
865
865
|
// for now. Need to review with IModelJs.
|
|
866
866
|
switch (primitiveType) {
|
|
@@ -882,7 +882,7 @@ export class XmlParser extends AbstractParser {
|
|
|
882
882
|
case PrimitiveType.Double:
|
|
883
883
|
return this.getDoublePropertyValue(propElement.textContent, propElement.tagName);
|
|
884
884
|
default:
|
|
885
|
-
throw new
|
|
885
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Primitive property '${propElement.tagName}' has an invalid primitive type.`);
|
|
886
886
|
}
|
|
887
887
|
}
|
|
888
888
|
getBooleanPropertyValue(propValue, propName) {
|
|
@@ -894,47 +894,47 @@ export class XmlParser extends AbstractParser {
|
|
|
894
894
|
Number.parseInt(propValue, 10) === 0) {
|
|
895
895
|
return false;
|
|
896
896
|
}
|
|
897
|
-
throw new
|
|
897
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An boolean value was expected.`);
|
|
898
898
|
}
|
|
899
899
|
getIntegerPropertyValue(propValue, propName) {
|
|
900
900
|
const result = Number.parseFloat(propValue);
|
|
901
901
|
if (isNaN(result) || result % 1 !== 0)
|
|
902
|
-
throw new
|
|
902
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. An integer value was expected.`);
|
|
903
903
|
return result;
|
|
904
904
|
}
|
|
905
905
|
getDatePropertyValue(propValue, propName) {
|
|
906
906
|
const result = Number.parseInt(propValue, 10);
|
|
907
907
|
if (isNaN(result))
|
|
908
|
-
throw new
|
|
908
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A date in milliseconds was expected.`);
|
|
909
909
|
return new Date(result);
|
|
910
910
|
}
|
|
911
911
|
getDoublePropertyValue(propValue, propName) {
|
|
912
912
|
const result = Number.parseFloat(propValue);
|
|
913
913
|
if (isNaN(result))
|
|
914
|
-
throw new
|
|
914
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A double value was expected.`);
|
|
915
915
|
return result;
|
|
916
916
|
}
|
|
917
917
|
getPoint2DPropertyValue(propValue, propName) {
|
|
918
918
|
const result = propValue.split(",");
|
|
919
919
|
if (result.length !== 2) {
|
|
920
|
-
throw new
|
|
920
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);
|
|
921
921
|
}
|
|
922
922
|
const x = Number.parseFloat(result[0]);
|
|
923
923
|
const y = Number.parseFloat(result[1]);
|
|
924
924
|
if (isNaN(x) || isNaN(y))
|
|
925
|
-
throw new
|
|
925
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 2D value was expected.`);
|
|
926
926
|
return { x, y };
|
|
927
927
|
}
|
|
928
928
|
getPoint3DPropertyValue(propValue, propName) {
|
|
929
929
|
const result = propValue.split(",");
|
|
930
930
|
if (result.length !== 3) {
|
|
931
|
-
throw new
|
|
931
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
|
|
932
932
|
}
|
|
933
933
|
const x = Number.parseFloat(result[0]);
|
|
934
934
|
const y = Number.parseFloat(result[1]);
|
|
935
935
|
const z = Number.parseFloat(result[2]);
|
|
936
936
|
if (isNaN(x) || isNaN(y) || isNaN(z))
|
|
937
|
-
throw new
|
|
937
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `Property '${propName}' has an invalid property value. A Point 3D value was expected.`);
|
|
938
938
|
return { x, y, z };
|
|
939
939
|
}
|
|
940
940
|
isSchemaFullNameValidForVersion(schemaFullName, ecSpecVersion) {
|
|
@@ -966,7 +966,7 @@ export class XmlParser extends AbstractParser {
|
|
|
966
966
|
return `${this._schemaName}.${nameParts[1]}`;
|
|
967
967
|
if (this._schemaReferenceNames.has(nameParts[0].toLowerCase()))
|
|
968
968
|
return `${this._schemaReferenceNames.get(nameParts[0].toLowerCase())}.${nameParts[1]}`;
|
|
969
|
-
throw new
|
|
969
|
+
throw new ECSchemaError(ECSchemaStatus.InvalidSchemaXML, `No valid schema found for alias ${nameParts[0]}`);
|
|
970
970
|
}
|
|
971
971
|
/** The rest of the API uses the full name format of `{SchemaName}.{SchemaItemName}`,
|
|
972
972
|
* meaning all of the references in the format string need to be changed.
|