Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds ABNF for path templating #4244

Merged
merged 13 commits into from
Dec 18, 2024

Conversation

baywet
Copy link
Contributor

@baywet baywet commented Dec 5, 2024

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 <[email protected]>
src/oas.md Outdated Show resolved Hide resolved
@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
src/oas.md Outdated Show resolved Hide resolved
src/oas.md Outdated Show resolved Hide resolved
src/oas.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ralfhandl ralfhandl left a comment

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
src/oas.md Outdated Show resolved Hide resolved
src/oas.md Outdated Show resolved Hide resolved
src/oas.md Outdated Show resolved Hide resolved
@ralfhandl ralfhandl requested a review from a team December 12, 2024 17:26
src/oas.md Outdated Show resolved Hide resolved
@handrews
Copy link
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
Copy link
Contributor

char0n commented Dec 15, 2024

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
Copy link
Contributor

char0n commented Dec 15, 2024

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 handrews, char0n, karenetheridge and a team and removed request for char0n December 16, 2024 11:51
@baywet
Copy link
Contributor Author

baywet commented Dec 16, 2024

@char0n thanks for the suggestions here!
@ralfhandl @handrews this should be ready for (hopefully final) review :)

src/oas.md Outdated Show resolved Hide resolved
src/oas.md Outdated Show resolved Hide resolved
@baywet baywet requested review from char0n and ralfhandl December 17, 2024 12:03
src/oas.md Outdated Show resolved Hide resolved
Co-authored-by: Vladimír Gorej <[email protected]>
@baywet baywet requested a review from char0n December 17, 2024 12:37
src/oas.md Outdated Show resolved Hide resolved
@baywet baywet requested a review from char0n December 17, 2024 12:44
Copy link
Contributor

@char0n char0n left a comment

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!

src/oas.md Outdated Show resolved Hide resolved
@ralfhandl ralfhandl requested a review from a team December 18, 2024 16:19
Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants