Skip to content

Runtime expression name rule inconsistent with path template grammar #5285

@char0n

Description

@char0n

The runtime expression ABNF grammar defines:

name = *( char )
token = 1*tchar

The * (zero or more) quantifier on name means expressions like $request.query. and $request.path. with empty names are syntactically valid per the grammar.

The OpenAPI spec states that the Parameter Object's name field is REQUIRED:

REQUIRED. The name of the parameter. Parameter names are case-sensitive.

A required field with an empty string value is arguably not meaningful, though the spec doesn't explicitly say "non-empty".

For path parameters specifically, this is inconsistent with the path template grammar introduced in OpenAPI 3.2.0:

template-expression-param-name = 1*( %x00-7A / %x7C / %x7E-10FFFF )

The 1* quantifier requires at least one character for path parameter names. So {userId} is valid but {} is not. Yet the runtime expression $request.path. (empty name) is accepted by the grammar.

For query parameters, the situation is less clear — HTTP technically allows empty query parameter keys (?=value), though this is extremely uncommon.

For consistency with the path template grammar and the token = 1*tchar rule (which already requires at least one character for headers), consider changing:

name = *( char )

to:

name = 1*( char )

This would require at least one character for query and path parameter names, aligning the runtime expression grammar with the path template grammar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions