Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,21 +241,25 @@ The Path Templating is defined by the following [ABNF](https://tools.ietf.org/ht

```abnf
; OpenAPI Path Templating ABNF syntax
; variant of https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
path-template = slash *( path-segment slash ) [ path-segment ]
path-segment = 1*( path-literal / template-expression )
slash = "/"
path-literal = 1*pchar
template-expression = "{" template-expression-param-name "}"
template-expression-param-name = 1*( %x00-7A / %x7C / %x7E-10FFFF ) ; every UTF8 character except { and } (from OpenAPI)

; Characters definitions (from RFC 3986)
; https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
; https://datatracker.ietf.org/doc/html/rfc3986#section-2.3
pct-encoded = "%" HEXDIG HEXDIG
; https://datatracker.ietf.org/doc/html/rfc3986#section-2.1
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
; https://datatracker.ietf.org/doc/html/rfc3986#section-2.2

; Characters definitions (from RFC 5234)
; https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
Expand Down
8 changes: 6 additions & 2 deletions src/path-templating.bnf
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
; OpenAPI Path Templating ABNF syntax
; variant of https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
path-template = slash *( path-segment slash ) [ path-segment ]
path-segment = 1*( path-literal / template-expression )
slash = "/"
path-literal = 1*pchar
template-expression = "{" template-expression-param-name "}"
template-expression-param-name = 1*( %x00-7A / %x7C / %x7E-10FFFF ) ; every UTF8 character except { and } (from OpenAPI)

; Characters definitions (from RFC 3986)
; https://datatracker.ietf.org/doc/html/rfc3986#section-3.3
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
; https://datatracker.ietf.org/doc/html/rfc3986#section-2.3
pct-encoded = "%" HEXDIG HEXDIG
; https://datatracker.ietf.org/doc/html/rfc3986#section-2.1
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
; https://datatracker.ietf.org/doc/html/rfc3986#section-2.2

; Characters definitions (from RFC 5234)
; https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39 ; 0-9
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
8 changes: 6 additions & 2 deletions src/path-templating.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,25 @@ export default function grammar(){
this.toString = function toString(){
let str = "";
str += "; OpenAPI Path Templating ABNF syntax\n";
str += "; variant of https://datatracker.ietf.org/doc/html/rfc3986#section-3.3\n";
str += "path-template = slash *( path-segment slash ) [ path-segment ]\n";
str += "path-segment = 1*( path-literal / template-expression )\n";
str += "slash = \"/\"\n";
str += "path-literal = 1*pchar\n";
str += "template-expression = \"{\" template-expression-param-name \"}\"\n";
str += "template-expression-param-name = 1*( %x00-7A / %x7C / %x7E-10FFFF ) ; every UTF8 character except { and } (from OpenAPI)\n";
str += "\n";
str += "; Characters definitions (from RFC 3986)\n";
str += "; https://datatracker.ietf.org/doc/html/rfc3986#section-3.3\n";
str += "pchar = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n";
str += "unreserved = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n";
str += " ; https://datatracker.ietf.org/doc/html/rfc3986#section-2.3\n";
str += "pct-encoded = \"%\" HEXDIG HEXDIG\n";
str += " ; https://datatracker.ietf.org/doc/html/rfc3986#section-2.1\n";
str += "sub-delims = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n";
str += " / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n";
str += " ; https://datatracker.ietf.org/doc/html/rfc3986#section-2.2\n";
str += "\n";
str += "; Characters definitions (from RFC 5234)\n";
str += "; https://datatracker.ietf.org/doc/html/rfc5234#appendix-B.1\n";
str += "ALPHA = %x41-5A / %x61-7A ; A-Z / a-z\n";
str += "DIGIT = %x30-39 ; 0-9\n";
str += "HEXDIG = DIGIT / \"A\" / \"B\" / \"C\" / \"D\" / \"E\" / \"F\"\n";
Expand Down
Loading