@sap-ux/edmx-parser
Advanced tools
Comparing version 0.5.14 to 0.5.15
# @sap-ux/edmx-parser | ||
## 0.5.15 | ||
### Patch Changes | ||
- 1fc2286: The annotation converter now ensures that references (aliases and namespaces) are unique | ||
## 0.5.14 | ||
@@ -4,0 +10,0 @@ |
@@ -383,3 +383,3 @@ "use strict"; | ||
const { isCollection, type } = unaliasType(param._attributes.Type); | ||
return { | ||
const edmActionParameter = { | ||
_type: 'ActionParameter', | ||
@@ -391,2 +391,15 @@ fullyQualifiedName: `${fullyQualifiedName}/${param._attributes.Name}`, | ||
}; | ||
if (param._attributes.MaxLength) { | ||
edmActionParameter.maxLength = parseInt(param._attributes.MaxLength, 10); | ||
} | ||
if (param._attributes.Precision) { | ||
edmActionParameter.precision = parseInt(param._attributes.Precision, 10); | ||
} | ||
if (param._attributes.Scale) { | ||
edmActionParameter.scale = parseInt(param._attributes.Scale, 10); | ||
} | ||
if (param._attributes.Nullable) { | ||
edmActionParameter.nullable = param._attributes.Nullable !== 'false'; | ||
} | ||
return edmActionParameter; | ||
}), | ||
@@ -393,0 +406,0 @@ returnType: action.ReturnType ? unaliasType(action.ReturnType._attributes.Type).type : '' |
@@ -63,3 +63,4 @@ /** | ||
addParserOutput(parserOutput: RawMetadata): void; | ||
private mergeReferences; | ||
} | ||
//# sourceMappingURL=utils.d.ts.map |
@@ -92,3 +92,3 @@ "use strict"; | ||
this._parserOutput.push(parserOutput); | ||
this._references = this._references.concat(parserOutput.references); | ||
this.mergeReferences(parserOutput.references); | ||
this._associations = this._associations.concat(parserOutput.schema.associations); | ||
@@ -108,4 +108,14 @@ this._associationSets = this._associationSets.concat(parserOutput.schema.associationSets); | ||
} | ||
mergeReferences(references) { | ||
for (const reference of references) { | ||
const clash = this._references.find((r) => r.namespace === reference.namespace || r.alias === reference.alias); | ||
// Assuming that the parser output passed to addParserOutput() is unaliased, it is safe to ignore | ||
// non-unique references here. If it is not, then this is going to be problematic | ||
if (!clash) { | ||
this._references.push(reference); | ||
} | ||
} | ||
} | ||
} | ||
exports.MergedRawMetadata = MergedRawMetadata; | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@sap-ux/edmx-parser", | ||
"version": "0.5.14", | ||
"version": "0.5.15", | ||
"description": "SAP Fiori OData - EDMX File parser", | ||
@@ -20,3 +20,3 @@ "repository": { | ||
"devDependencies": { | ||
"@sap-ux/vocabularies-types": "0.7.4" | ||
"@sap-ux/vocabularies-types": "0.7.6" | ||
}, | ||
@@ -23,0 +23,0 @@ "scripts": { |
@@ -16,2 +16,3 @@ // eslint-disable-next-line @typescript-eslint/triple-slash-reference | ||
RawActionImport, | ||
RawActionParameter, | ||
RawAnnotation, | ||
@@ -570,3 +571,4 @@ RawAssociation, | ||
const { isCollection, type } = unaliasType(param._attributes.Type); | ||
return { | ||
const edmActionParameter: RawActionParameter = { | ||
_type: 'ActionParameter', | ||
@@ -578,2 +580,15 @@ fullyQualifiedName: `${fullyQualifiedName}/${param._attributes.Name}`, | ||
}; | ||
if (param._attributes.MaxLength) { | ||
edmActionParameter.maxLength = parseInt(param._attributes.MaxLength, 10); | ||
} | ||
if (param._attributes.Precision) { | ||
edmActionParameter.precision = parseInt(param._attributes.Precision, 10); | ||
} | ||
if (param._attributes.Scale) { | ||
edmActionParameter.scale = parseInt(param._attributes.Scale, 10); | ||
} | ||
if (param._attributes.Nullable) { | ||
edmActionParameter.nullable = param._attributes.Nullable !== 'false'; | ||
} | ||
return edmActionParameter; | ||
}), | ||
@@ -580,0 +595,0 @@ returnType: action.ReturnType ? unaliasType(action.ReturnType._attributes.Type).type : '' |
@@ -123,3 +123,3 @@ /** | ||
this._parserOutput.push(parserOutput); | ||
this._references = this._references.concat(parserOutput.references); | ||
this.mergeReferences(parserOutput.references); | ||
this._associations = this._associations.concat(parserOutput.schema.associations); | ||
@@ -139,2 +139,15 @@ this._associationSets = this._associationSets.concat(parserOutput.schema.associationSets); | ||
} | ||
private mergeReferences(references: Reference[]) { | ||
for (const reference of references) { | ||
const clash = this._references.find( | ||
(r) => r.namespace === reference.namespace || r.alias === reference.alias | ||
); | ||
// Assuming that the parser output passed to addParserOutput() is unaliased, it is safe to ignore | ||
// non-unique references here. If it is not, then this is going to be problematic | ||
if (!clash) { | ||
this._references.push(reference); | ||
} | ||
} | ||
} | ||
} |
@@ -90,2 +90,6 @@ declare namespace EDMX { | ||
Type: string; | ||
Nullable: string; | ||
MaxLength: string; | ||
Precision: string; | ||
Scale: string; | ||
}; | ||
@@ -92,0 +96,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253936
4603