-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
We currently define what's allowed in tbd directives and annotations as:
multi-line-parameters = *(comment / q-string / regex /
not-multi-line-special)
The presence of regex means that any / characters in the parameters will be treated as forming a regular expression. This allows assertion annotations like:
"link" : @{assert ($other == "ok" && $ =~ /p\d{1,2}/i) ||
($other == "bad" && $ =~ /x\d{1,3}/i) } string
But is problematic if we want to have assertion annotations such as:
"size" : @{assert $ / 4 == 2} integer
We could fix that by having something like:
"size" : @{assert $ idiv 4 == 2} integer
where idiv means integer divide.
But that doesn't allow for something like:
"geo" : @{abnf 1*DIGIT "." 1*DIGIT ("N" / "S") "," 1*DIGIT "." 1*DIGIT ("E" / "W") } string
We could remove the special meaning for /, and say if you want a regex in an annotation, then you have to define some sort of function, such as:
"link" : @{assert ($other == "ok" && re( $, "/p\d{1,2}/i" )) ||
($other == "bad" && re( $, "/x\d{1,3}/i" )) } string
That would basically means changing the above rule to:
multi-line-parameters = *(comment / q-string /
not-multi-line-special)
not-multi-line-special = spaces / %x21 / %x23-3A /
%x3C-7C / %x7E-10FFFF ; not ", ; or }
Metadata
Metadata
Assignees
Labels
No labels