From ec2e164a6103780534f85d55aaaca0d2e9a950f2 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Wed, 29 Nov 2023 18:43:49 +0100 Subject: [PATCH 01/10] ODATA-1604 (#105) --- abnf/odata-abnf-construction-rules.txt | 7 +++++-- abnf/odata-abnf-testcases.yaml | 20 ++++++++++++++++++++ package-lock.json | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index a29639e..0967a97 100644 --- a/abnf/odata-abnf-construction-rules.txt +++ b/abnf/odata-abnf-construction-rules.txt @@ -331,7 +331,7 @@ inlinecount = ( "$count" / "count" ) EQ booleanValue schemaversion = ( "$schemaversion" / "schemaversion" ) EQ ( STAR / 1*unreserved ) -search = ( "$search" / "search" ) EQ BWS ( searchExpr / searchExpr-incomplete ) +search = ( "$search" / "search" ) EQ BWS ( searchExpr / searchExpr-incomplete ) BWS searchExpr = ( searchParenExpr / searchNegateExpr @@ -359,7 +359,7 @@ searchPhrase = quotation-mark 1*( qchar-no-AMP-DQUOTE / SP ) quotation-mark ; Expressing this in ABNF is somewhat clumsy, so the following rule is overly generous. ; Note: the words AND, OR, and NOT are sometimes operators, depending on their position within a search expression. searchWord = searchChar *( searchChar / SQUOTE ) -searchChar = unreserved / pct-encoded-no-DQUOTE / "!" / "*" / "+" / "," / ":" / "@" / "/" / "?" / "$" / "=" +searchChar = unreserved / pct-encoded-no-SP-DQUOTE / "!" / "*" / "+" / "," / ":" / "@" / "/" / "?" / "$" / "=" searchExpr-incomplete = SQUOTE *( SQUOTE-in-string / qchar-no-AMP-SQUOTE / quotation-mark / SP ) SQUOTE @@ -1238,6 +1238,9 @@ pct-encoded-unescaped = "%" ( "0" / "1" / "3" / "4" / "6" / "7" / "8" / "9" pct-encoded-no-DQUOTE = "%" ( "0" / "1" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / A-to-F ) HEXDIG / "%" "2" ( "0" / "1" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / A-to-F ) +pct-encoded-no-SP-DQUOTE = "%" ( "0" / "1" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / A-to-F ) HEXDIG + / "%" "2" ( "1" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / A-to-F ) + ;------------------------------------------------------------------------------ ; B. IRI syntax [RFC3987] diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index b9265be..736c0b5 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -2695,6 +2695,26 @@ TestCases: Rule: queryOptions Input: $search=blue%20green + - Name: 5.1.7 Search - leading space + Rule: queryOptions + Input: $search=%20blue + Expect: + - searchWord:blue + + - Name: 5.1.7 Search - trailing space + Rule: queryOptions + Input: $search=blue%20&!special + Expect: + - searchWord:blue + - customQueryOption:!special + + - Name: 5.1.7 Search - space in search phrase + Rule: queryOptions + Input: $search=%20"%20"%20-%20 + Expect: + - searchPhrase:"%20" + - searchWord:- + - Name: 5.1.7 Search - AND Rule: queryOptions Input: $search=blue AND green diff --git a/package-lock.json b/package-lock.json index 661cef2..4b81d12 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "": { "name": "odata-abnf", "version": "0.0.0", - "license": "ISC", + "license": "SEE LICENSE IN LICENSE.md", "dependencies": { "apg-js": "^4.2.0", "colors": "^1.4.0", From 139f473d91313ed6b8b8784e5065b817933b96a9 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Thu, 18 Jan 2024 16:07:53 +0100 Subject: [PATCH 02/10] overload with third parameter for providing regular expression flags --- abnf/odata-abnf-construction-rules.txt | 2 +- abnf/odata-abnf-testcases.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index 128cacd..929504c 100644 --- a/abnf/odata-abnf-construction-rules.txt +++ b/abnf/odata-abnf-construction-rules.txt @@ -647,7 +647,7 @@ containsMethodCallExpr = "contains" OPEN BWS commonExpr BWS COMMA BW endsWithMethodCallExpr = "endswith" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE indexOfMethodCallExpr = "indexof" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE lengthMethodCallExpr = "length" OPEN BWS commonExpr BWS CLOSE -matchesPatternMethodCallExpr = "matchesPattern" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE +matchesPatternMethodCallExpr = "matchesPattern" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS [ COMMA BWS commonExpr BWS ] CLOSE startsWithMethodCallExpr = "startswith" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS CLOSE substringMethodCallExpr = "substring" OPEN BWS commonExpr BWS COMMA BWS commonExpr BWS [ COMMA BWS commonExpr BWS ] CLOSE toLowerMethodCallExpr = "tolower" OPEN BWS commonExpr BWS CLOSE diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index 3afe919..f747f6f 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -1921,6 +1921,10 @@ TestCases: Rule: commonExpr Input: matchesPattern(CompanyName,'%5EA.*e$') + - Name: 5.1.1.7.1 matchesPattern ^A.*e$ case-insensitive + Rule: commonExpr + Input: matchesPattern(CompanyName,'%5EA.*e$','i') + - Name: 5.1.1.7.2 tolower Rule: commonExpr Input: tolower(CompanyName) From 7952c352edc51b8ab59d630d0732d2f6c7ee754a Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Mon, 5 Feb 2024 15:47:11 +0100 Subject: [PATCH 03/10] Adjust header comments, add test cases (#114) --- abnf/odata-abnf-construction-rules.txt | 18 ++++++------ abnf/odata-abnf-testcases.yaml | 40 +++++++++++++++----------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index 128cacd..d2f6f1b 100644 --- a/abnf/odata-abnf-construction-rules.txt +++ b/abnf/odata-abnf-construction-rules.txt @@ -1,7 +1,7 @@ ;------------------------------------------------------------------------------ -; OData ABNF Construction Rules Version 4.01 and 4.0 +; OData ABNF Construction Rules Version 4.02, 4.01, and 4.0 ;------------------------------------------------------------------------------ -; 17 September 2020 +; 05 February 2024 ; ; Latest version: https://github.com/oasis-tcs/odata-abnf/blob/main/abnf/odata-abnf-construction-rules.txt ;------------------------------------------------------------------------------ @@ -21,18 +21,18 @@ ; ; Additional artifacts: ; This grammar is one component of a Work Product which consists of: -; - OData Version 4.01 Part 1: Protocol -; - OData Version 4.01 Part 2: URL Conventions -; - OData ABNF Construction Rules Version 4.01 (this document) -; - OData ABNF Test Cases Version 4.01 +; - OData Version 4.02 Part 1: Protocol +; - OData Version 4.02 Part 2: URL Conventions +; - OData ABNF Construction Rules Version 4.02 (this document) +; - OData ABNF Test Cases Version 4.02 ; ; Related work: ; This specification replaces or supersedes: ; - OData ABNF Construction Rules Version 4.0 ; This work product is related to -; - OData Common Schema Definition Language (CSDL) JSON Representation Version 4.01 -; - OData Common Schema Definition Language (CSDL) XML Representation Version 4.01 -; - OData JSON Format Version 4.01 +; - OData Common Schema Definition Language (CSDL) JSON Representation Version 4.02 +; - OData Common Schema Definition Language (CSDL) XML Representation Version 4.02 +; - OData JSON Format Version 4.02 ; ; Abstract: ; The Open Data Protocol (OData) enables the creation of REST-based data diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index 3afe919..fc6ed97 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -1,6 +1,6 @@ -# OData ABNF Test Cases Version 4.01 and 4.0 +# OData ABNF Test Cases Version 4.02, 4.01, and 4.0 # -# 17 September 2020 +# 05 February 2024 # # Latest version: https://github.com/oasis-tcs/odata-abnf/blob/main/abnf/odata-abnf-testcases.yaml # @@ -19,18 +19,18 @@ # # Additional artifacts: # This test case document is one component of a Work Product which consists of: -# - OData Version 4.01 Part 1: Protocol -# - OData Version 4.01 Part 2: URL Conventions -# - OData ABNF Construction Rules Version 4.01 -# - OData ABNF Test Cases Version 4.01 (this document) +# - OData Version 4.02 Part 1: Protocol +# - OData Version 4.02 Part 2: URL Conventions +# - OData ABNF Construction Rules Version 4.02 +# - OData ABNF Test Cases Version 4.02 (this document) # # Related work: # This specification replaces or supersedes: # - OData ABNF Test Cases Version 4.0 # This work product is related to -# - OData Common Schema Definition Language (CSDL) JSON Representation Version 4.01 -# - OData Common Schema Definition Language (CSDL) XML Representation Version 4.01 -# - OData JSON Format Version 4.01 +# - OData Common Schema Definition Language (CSDL) JSON Representation Version 4.02 +# - OData Common Schema Definition Language (CSDL) XML Representation Version 4.02 +# - OData JSON Format Version 4.02 # # Abstract: # The Open Data Protocol (OData) enables the creation of REST-based data @@ -42,10 +42,10 @@ # # Overview: # This document contains positive and negative test cases for the -# OData ABNF Construction Rules Version 4.01. +# OData ABNF Construction Rules Version 4.02. # Positive test cases consist of the rule to test, the input string to parse, # and a description of the test case, often starting with a section number -# referring to OData Version 4.01 Part 2: URL Conventions. +# referring to OData Version 4.02 Part 2: URL Conventions. # Negative test cases in addition state the character position at which the # invalid portion of input text starts, 0 meaning the whole input string. # @@ -3577,26 +3577,34 @@ TestCases: Rule: header Input: isolation:sNapShoT - - Name: Header - odata-maxversion + - Name: Header - odata-maxversion 4.0 Rule: header Input: "odata-maxversion: 4.0" - - Name: Header - odata-maxversion next + - Name: Header - odata-maxversion 4.01 Rule: header Input: "odata-maxversion: 4.01" - - Name: Header - odata-maxversion + - Name: Header - odata-maxversion 4.02 + Rule: header + Input: "odata-maxversion: 4.02" + + - Name: Header - odata-maxversion weird Rule: header Input: odata-maxversion:06.2831852000 - - Name: Header - odata-version + - Name: Header - odata-version 4.0 Rule: header Input: "odata-version: 4.0" - - Name: Header - odata-version + - Name: Header - odata-version 4.01 Rule: header Input: "odata-version: 4.01" + - Name: Header - odata-version 4.02 + Rule: header + Input: "odata-version: 4.02" + - Name: Preferences - allow entity references and maximum page size Rule: prefer Input: "Prefer: odata.allow-entityreferences,odata.maxpagesize=20" From 7c8115f0742567e254d61b6b6046d49f94f6bf30 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Wed, 21 Feb 2024 17:30:06 +0100 Subject: [PATCH 04/10] ODATA-1540 (#109) * ODATA-1540 * Plus in URL needs percent-encoding * Update odata-abnf-construction-rules.txt * Update odata-abnf-construction-rules.txt * Update odata-abnf-construction-rules.txt * enumLiteral and enumValue --- abnf/odata-abnf-construction-rules.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index 402e7aa..ced5037 100644 --- a/abnf/odata-abnf-construction-rules.txt +++ b/abnf/odata-abnf-construction-rules.txt @@ -1168,7 +1168,7 @@ COLON = ":" / "%3A" COMMA = "," / "%2C" EQ = "=" HASH = "%23" ; the # character is not allowed in the query part -SIGN = "+" / "%2B" / "-" +SIGN = "%2B" / "-" SEMI = ";" / "%3B" STAR = "*" / "%2A" SQUOTE = "'" / "%27" From 485c742891582d816889030b2beff9e39cc18ab3 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Mon, 26 Feb 2024 17:37:08 +0100 Subject: [PATCH 05/10] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4d977ff..3b73adf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ coverage/ grammar/ node_modules/ lib/grammar.js +.DS_Store From 9592dde6eed3d8f452f5c1fb059b43c587306c69 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 12 Mar 2024 17:58:05 +0100 Subject: [PATCH 06/10] Update nodejs.yml --- .github/workflows/nodejs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 5763a60..403d0e0 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -19,10 +19,10 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} From 44738ed4615436500f61baf3190291fa5e5fbf84 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Tue, 12 Mar 2024 18:01:23 +0100 Subject: [PATCH 07/10] Update .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3b73adf..4d977ff 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ coverage/ grammar/ node_modules/ lib/grammar.js -.DS_Store From b89590f111695dec95a484d9f88bae2b4a557b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Thu, 4 Apr 2024 14:20:53 +0200 Subject: [PATCH 08/10] $ --- abnf/odata-abnf-construction-rules.txt | 1 + abnf/odata-abnf-testcases.yaml | 10 ++++++++++ abnf/odata-aggregation-testcases.yaml | 2 ++ 3 files changed, 13 insertions(+) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index ced5037..81b98f8 100644 --- a/abnf/odata-abnf-construction-rules.txt +++ b/abnf/odata-abnf-construction-rules.txt @@ -558,6 +558,7 @@ inscopeVariableExpr = implicitVariableExpr / lambdaVariableExpr ; only allowed inside a lambdaPredicateExpr implicitVariableExpr = %s"$it" ; the current instance of the resource identified by the resource path / %s"$this" ; the instance on which the query option is evaluated + / "$" request-id lambdaVariableExpr = odataIdentifier collectionNavigationExpr = collectionNavNoCastExpr diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index fa8cc5e..f34e3e1 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -250,6 +250,10 @@ Constraints: - Title - X - ZipCode + request-id: + - '1' + - First-Insert~Customer_1.1 + - group1 singletonEntity: - BestProductEverCreated - MainSupplier @@ -2268,6 +2272,12 @@ TestCases: Rule: odataRelativeUri Input: Customers?$select=Addresses(@a=$this;$filter=endswith(@a/Street,'gasse')) + - Name: request reference in $batch + Rule: commonExpr + Input: Customer eq $1 + Expect: + - implicitVariableExpr:$1 + - Name: 5.1.1.15 Path expressions Rule: commonExpr Input: Items diff --git a/abnf/odata-aggregation-testcases.yaml b/abnf/odata-aggregation-testcases.yaml index a7e6e85..d3a902a 100644 --- a/abnf/odata-aggregation-testcases.yaml +++ b/abnf/odata-aggregation-testcases.yaml @@ -238,6 +238,8 @@ Constraints: - Total # dynamic - WeightedAmount # dynamic - Year + request-id: + - group1 streamProperty: - Image termName: From cab406552e236431833c3462f9fd4c0dc3ead43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Fri, 10 May 2024 10:43:05 +0200 Subject: [PATCH 09/10] TC 2024-05-08 --- abnf/odata-abnf-construction-rules.txt | 3 ++- abnf/odata-abnf-testcases.yaml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index 81b98f8..eeae755 100644 --- a/abnf/odata-abnf-construction-rules.txt +++ b/abnf/odata-abnf-construction-rules.txt @@ -525,6 +525,8 @@ rootExpr = %s"$root/" ( entitySetName [ collectionNavigationExpr ] firstMemberExpr = memberExpr / inscopeVariableExpr [ "/" memberExpr ] + / "$" request-id [ "/" memberExpr ] ; reference to single-valued response of earlier request + / "$" request-id [ collectionNavigationExpr ] ; reference to collection-valued response of earlier request memberExpr = directMemberExpr / ( optionallyQualifiedEntityTypeName / optionallyQualifiedComplexTypeName ) "/" directMemberExpr @@ -558,7 +560,6 @@ inscopeVariableExpr = implicitVariableExpr / lambdaVariableExpr ; only allowed inside a lambdaPredicateExpr implicitVariableExpr = %s"$it" ; the current instance of the resource identified by the resource path / %s"$this" ; the instance on which the query option is evaluated - / "$" request-id lambdaVariableExpr = odataIdentifier collectionNavigationExpr = collectionNavNoCastExpr diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index f34e3e1..6f97bf0 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -2276,7 +2276,8 @@ TestCases: Rule: commonExpr Input: Customer eq $1 Expect: - - implicitVariableExpr:$1 + - firstMemberExpr:Customer + - firstMemberExpr:$1 - Name: 5.1.1.15 Path expressions Rule: commonExpr From 9b7418ac945e7116c5a5df6a00b07bedc4e23fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Thu, 16 May 2024 08:56:02 +0200 Subject: [PATCH 10/10] additional test cases --- abnf/odata-abnf-construction-rules.txt | 5 +++-- abnf/odata-abnf-testcases.yaml | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index eeae755..9faa960 100644 --- a/abnf/odata-abnf-construction-rules.txt +++ b/abnf/odata-abnf-construction-rules.txt @@ -525,8 +525,9 @@ rootExpr = %s"$root/" ( entitySetName [ collectionNavigationExpr ] firstMemberExpr = memberExpr / inscopeVariableExpr [ "/" memberExpr ] - / "$" request-id [ "/" memberExpr ] ; reference to single-valued response of earlier request - / "$" request-id [ collectionNavigationExpr ] ; reference to collection-valued response of earlier request + / "$" request-id "/" memberExpr ; reference to single-valued response of earlier request + / "$" request-id collectionNavigationExpr ; reference to collection-valued response of earlier request + / "$" request-id memberExpr = directMemberExpr / ( optionallyQualifiedEntityTypeName / optionallyQualifiedComplexTypeName ) "/" directMemberExpr diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index 6f97bf0..4970d49 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -2279,6 +2279,19 @@ TestCases: - firstMemberExpr:Customer - firstMemberExpr:$1 + - Name: property reference in $batch + Rule: commonExpr + Input: Customer/Name eq $1/Name + Expect: + - memberExpr:Customer/Name + - memberExpr:Name + + - Name: member reference in $batch + Rule: commonExpr + Input: Customer/Name eq $1('ALFKI')/Name + Expect: + - collectionNavigationExpr:('ALFKI')/Name + - Name: 5.1.1.15 Path expressions Rule: commonExpr Input: Items