Repository navigation
Evaluate match() and search() as I-Regexp, compare content types by media type (dpp-criteria 203202e) - #5
Merged
Conversation
…edia type (dpp-criteria 203202e)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adapts dpplint to dpp-criteria 203202e (PR #5): content type matching under "Order of evaluation within a request", regular expressions inside JSONPath under "Regular expressions", and unusable patterns under "Results" in CRITERIA-FORMAT.md.
Changes
match()andsearch()inapplies_ifnow evaluate their pattern as I-Regexp (RFC 9485), as RFC 9535 requires. They use the new classIRegexp, which parses the pattern with the ABNF of RFC 9485 and translates it into a Ruby Regexp.match()needs the entire value,search()a substring..matches anything except LF and CR; matching is case-sensitive and counts code points.\p{..}/\P{..}exist.applies_if:existsnow holds fornullandfalsevalues.matchesinapplies_if: uses ECMA-262 (EcmaRegexp), like all JSON assertions.applies_ifcondition: an invalidmatchespattern, an unsupported path or an invalid string literal skips the criterion with the reason. Previously an unsupported path raised an error.+jsontypes such asapplication/ld+jsoncount as JSON media types.Tests
./build.sh(dpp-criteria 203202e).match()versussearch().^and$, following the JSONPath Compliance Test Suite cases "explicit caret" and "explicit dollar"..on U+2028, LF and CR; the categories\p{Lu}and\P{L}; values that are not strings.[Bb]atter) and DPP-PCDS-008 (59040|PCDS|pcds).applies_if: both criteria, filter on array, object and string, invalid I-Regexp withexists: trueandexists: false, string literals and escapes,existsonnullandfalse, the skip reasons.application/ld+json, invalid JSON, a body that is not an object, a type that is not JSON.Reference passport
https://dpp.oydapp.eu/01/09520123456788/21/000001:text/htmlit now returnstext/htmlwithVary: Accept, Origin; with*/*it still returns JSON.contentSpecificationIdsnorfacilityId.Results are from automated checks only and establish no presumption of conformity.
Decisions
^and$in I-Regexp anchor the whole value. The RFC 9485 ABNF lists them as ordinary characters, but the mappings in RFC 9485 section 5 and the Compliance Test Suite treat them as anchors, and so does jsonpath-rfc9535.[z-a]and{n,m}with m < n count as non-conforming (XML Schema, on which I-Regexp is based, rejects them).Open questions for dpp-criteria
match()/search()false for a non-conforming pattern, while "Results" asks forskippedbefore any request, neverfailed. Withexists: false, orequals/inon the filter result, the RFC behaviour lets the criterion run and possibly fail. Which one applies to patterns inside JSONPath? The current criteria are not affected.^and$in JSONPath patterns are anchors or ordinary characters, or rule them out?matchesof a JSON assertion, including inapplies_if, apply to values that are not strings?