@sap/cds-compiler
Advanced tools
Comparing version 1.46.4 to 1.46.6
@@ -9,2 +9,8 @@ # ChangeLog for cdx compiler and backends | ||
## Version 1.46.6 - 2020-12-01 | ||
### Fixed | ||
- OData identifiers can now include all unicode characters which are described in the OData specification. | ||
## Version 1.46.4 - 2020-11-26 | ||
@@ -11,0 +17,0 @@ |
@@ -672,3 +672,3 @@ 'use strict'; | ||
simpleIdentifiers.forEach((identifier) => { | ||
if(!edmUtils.isSimpleIdentifier(identifier)){ | ||
if(!edmUtils.isODataSimpleIdentifier(identifier)){ | ||
message(error, context, | ||
@@ -686,3 +686,3 @@ `OData annotation term "${identifier}" must consist of one or more dot separated simple identifiers (each starting with a letter or underscore, followed by at most 127 letters)`) | ||
checkOdataTerm(p[0]); | ||
if (!edmUtils.isSimpleIdentifier(p[1])) { | ||
if (!edmUtils.isODataSimpleIdentifier(p[1])) { | ||
message(error, context, | ||
@@ -689,0 +689,0 @@ `OData annotation qualifier "${p[1]}" must start with a letter or underscore, followed by at most 127 letters, underscores or digits`); |
@@ -570,5 +570,21 @@ 'use strict'; | ||
// From the odata specification: [Simple Identifier] starts with a letter or underscore, followed by at most 127 letters, underscores or digits. | ||
function isSimpleIdentifier(identifier){ | ||
return identifier && identifier.match(/^[a-zA-Z_]{1}[a-zA-Z0-9_]{0,127}$/); | ||
/** | ||
* A simple identifier is a Unicode character sequence with the following restrictions: | ||
* - The first character MUST be the underscore character (U+005F) or any character in the Unicode category “Letter (L)” or “Letter number (Nl)” | ||
* - The remaining characters MUST be the underscore character (U+005F) or any character in the Unicode category: | ||
* “Letter (L)”, | ||
* “Letter number (Nl)”, | ||
* “Decimal number (Nd)”, | ||
* “Non-spacing mark (Mn)”, | ||
* “Combining spacing mark (Mc)”, | ||
* “Connector punctuation (Pc)”, | ||
* “Other, format (Cf)” | ||
* source: https://docs.oasis-open.org/odata/odata-csdl-xml/v4.01/os/odata-csdl-xml-v4.01-os.pdf#page=75 | ||
* | ||
* @param {string} identifier | ||
*/ | ||
function isODataSimpleIdentifier(identifier){ | ||
// this regular expression reflects the specifiation from above | ||
const regex = /^[\p{Letter}\p{Nl}_]{1}[_\p{Letter}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,127}$/gu | ||
return identifier && identifier.match(regex); | ||
} | ||
@@ -613,4 +629,4 @@ | ||
addTypeFacets, | ||
isSimpleIdentifier, | ||
isODataSimpleIdentifier, | ||
escapeString, | ||
} |
{ | ||
"name": "@sap/cds-compiler", | ||
"version": "1.46.4", | ||
"version": "1.46.6", | ||
"description": "CDS (Core Data Services) compiler and backends", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/", |
Sorry, the diff of this file is too big to display
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
3814986
73104