Skip to content

adds ABNF for path templating - #4244

Merged
ralfhandl merged 13 commits into
OAI:v3.2-devfrom
baywet:feat/url-template-anbf-to-3-2-dev
Dec 18, 2024
Merged

adds ABNF for path templating#4244
ralfhandl merged 13 commits into
OAI:v3.2-devfrom
baywet:feat/url-template-anbf-to-3-2-dev

Conversation

@baywet

@baywet baywet commented Dec 5, 2024

Copy link
Copy Markdown
Member

partial #3256

This pull request adds an ABNF for path templating.

It only partially addresses the issue, my goal is to submit additional pull requests for:

  • additional links to annex C where missing
  • ABNF for server templating
  • relationship between server and path templating (if any)
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Comment thread src/oas.md Outdated
@baywet
baywet marked this pull request as ready for review December 6, 2024 12:38
@baywet
baywet requested review from a team as code owners December 6, 2024 12:38
Comment thread src/oas.md Outdated
Comment thread src/oas.md Outdated
Comment thread src/oas.md Outdated

@ralfhandl ralfhandl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits

@ralfhandl
ralfhandl requested a review from a team December 6, 2024 12:54
Co-authored-by: Ralf Handl <ralf.handl@sap.com>
Comment thread src/oas.md Outdated
Comment thread src/oas.md Outdated
Comment thread src/oas.md Outdated
Co-authored-by: Ralf Handl <ralf.handl@sap.com>
@ralfhandl
ralfhandl requested a review from a team December 12, 2024 17:26
Comment thread src/oas.md Outdated
@handrews

Copy link
Copy Markdown
Member

@ralfhandl

This relies on path templates being represented as JSON or YAML strings and thus using UTF-8.

We primarily define thing in terms of JSON, and (as mentioned in one of the new appendixes), JSON strings are only broadly interoperable in UTF-8, per the JSON RFC. It might be worth mentioning that here, but I think it's reasonable for us to write the spec based on what is interoperable in JSON.

@char0n

char0n commented Dec 15, 2024

Copy link
Copy Markdown
Contributor

Here is the latest version of ABNF I've come up in https://github.com/swaggerexpert/openapi-path-templating/blob/next/src/path-templating.bnf

; OpenAPI Path Templating ABNF syntax
; Aligned with RFC 3986 (https://datatracker.ietf.org/doc/html/rfc3986#section-3.3)
path-template                  = slash [ path-template-nz ]
path-template-nz               = path-segment *( slash path-segment )
slash                          = "/"
path-segment                   = 1*( path-literal / template-expression )
path-literal                   = 1*pchar
template-expression            = "{" template-expression-param-name "}"
template-expression-param-name = 1*pchar

; Characters definitions (from RFC 3986)
pchar               = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved          = ALPHA / DIGIT / "-" / "." / "_" / "~"
pct-encoded         = "%" HEXDIG HEXDIG
sub-delims          = "!" / "$" / "&" / "'" / "(" / ")"
                    / "*" / "+" / "," / ";" / "="
ALPHA               = %x41-5A / %x61-7A   ; A-Z / a-z
DIGIT               = %x30-39            ; 0-9
HEXDIG              = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"

This grammar is now as closely aligned with https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 as it can be.

Ref LICENSE, NOTICE

@char0n

char0n commented Dec 15, 2024

Copy link
Copy Markdown
Contributor

Just a small note related to licensing. I do support this effort fully, but seeing this PR, I got a bit worried how this ABNF grammar is being copied here from openapi-path-templating without any attribution or copyright notice.

I've created the original ABNF grammar in https://github.com/swaggerexpert/openapi-path-templating and is licensed under Apache-2.0 with following copyright notice:

openapi-path-templating
Copyright 2023, Vladimír Gorej
openapi-path-templating is licensed under Apache 2.0 license.
Copy of the Apache 2.0 license can be found in `LICENSE` file.

The NOTICE file is part of https://github.com/swaggerexpert/openapi-path-templating repo and npm package distribution.


Can we as part of this repo (https://github.com/OAI/OpenAPI-Specification) create a NOTICE file (standard practice with Apache-2.0 licensing) and mention the attribution of openapi-path-templating there?

ralfhandl
ralfhandl previously approved these changes Dec 16, 2024
@ralfhandl
ralfhandl requested review from a team, char0n, handrews and karenetheridge and removed request for char0n December 16, 2024 11:51
@baywet
baywet requested review from char0n and ralfhandl December 17, 2024 12:03
Comment thread src/oas.md Outdated
Co-authored-by: Vladimír Gorej <vladimir.gorej@gmail.com>
@baywet
baywet requested a review from char0n December 17, 2024 12:37
Comment thread src/oas.md Outdated
@baywet
baywet requested a review from char0n December 17, 2024 12:44

@char0n char0n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your patience! Looks great!

Comment thread src/oas.md Outdated
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
@ralfhandl
ralfhandl requested a review from a team December 18, 2024 16:19

@mikekistler mikekistler left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@ralfhandl
ralfhandl merged commit 53f96d7 into OAI:v3.2-dev Dec 18, 2024
char0n added a commit to swaggerexpert/openapi-path-templating that referenced this pull request Dec 22, 2024
@baywet
baywet deleted the feat/url-template-anbf-to-3-2-dev branch March 19, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants