From 5d3f4c6083b5da1c003655d370f1c0f40d41bfa3 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Thu, 26 Oct 2023 10:51:01 +0200 Subject: [PATCH 1/2] ODATA-1604 --- abnf/odata-abnf-construction-rules.txt | 13 ++++++++----- abnf/odata-abnf-testcases.yaml | 13 +++++++++++++ package-lock.json | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/abnf/odata-abnf-construction-rules.txt b/abnf/odata-abnf-construction-rules.txt index 992c43f..68353c1 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 @@ -1237,8 +1237,11 @@ 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] ;------------------------------------------------------------------------------ @@ -1248,7 +1251,7 @@ pct-encoded-no-DQUOTE = "%" ( "0" / "1" / "3" / "4" / "5" / "6" / "7" / "8" / IRI-in-header = 1*( VCHAR / obs-text ) IRI-in-query = 1*qchar-no-AMP - + ;------------------------------------------------------------------------------ ; C. ABNF core definitions [RFC5234] ;------------------------------------------------------------------------------ diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index b9265be..6e5bb58 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -2695,6 +2695,19 @@ 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 - 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 dd21a82ba4e969c175f2e2f9a4ada3f4633e3094 Mon Sep 17 00:00:00 2001 From: D024504 Date: Thu, 26 Oct 2023 11:18:12 +0200 Subject: [PATCH 2/2] Added test case --- abnf/odata-abnf-testcases.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/abnf/odata-abnf-testcases.yaml b/abnf/odata-abnf-testcases.yaml index 6e5bb58..736c0b5 100644 --- a/abnf/odata-abnf-testcases.yaml +++ b/abnf/odata-abnf-testcases.yaml @@ -2708,6 +2708,13 @@ TestCases: - 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