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

OpenAPI 3.x.y - validation of runtime expression #2208

Open
char0n opened this issue Oct 28, 2022 · 0 comments
Open

OpenAPI 3.x.y - validation of runtime expression #2208

char0n opened this issue Oct 28, 2022 · 0 comments

Comments

@char0n
Copy link
Member

char0n commented Oct 28, 2022

We are currently not able to validate runtime expression. Ideally using already existing tool is ideal, but if we cannot find one we can still write one. I have created the parser and validator library here: https://github.com/char0n/openapi-runtime-expression

Implementation will apply both for OpenAPI 3.0.x and OpenAPI 3.1.x.


The runtime expression is defined by the following ABNF syntax.

expression = ( "$url" / "$method" / "$statusCode" / "$request." source / "$response." source )
      source = ( header-reference / query-reference / path-reference / body-reference )
      header-reference = "header." token
      query-reference = "query." name  
      path-reference = "path." name
      body-reference = "body" ["#" json-pointer ]
      json-pointer    = *( "/" reference-token )
      reference-token = *( unescaped / escaped )
      unescaped       = %x00-2E / %x30-7D / %x7F-10FFFF
         ; %x2F ('/') and %x7E ('~') are excluded from 'unescaped'
      escaped         = "~" ( "0" / "1" )
        ; representing '~' and '/', respectively
      name = *( CHAR )
      token = 1*tchar
      tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
        "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA

Here, json-pointer is taken from RFC6901, char from RFC7159 and token from RFC7230.

The name identifier is case-sensitive, whereas token is not.

The table below provides examples of runtime expressions and examples of their use in a value:

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

No branches or pull requests

1 participant