Inconsistency in runtime expression examples for request headers
Runtime expression examples include the following:
| Source Location | example expression | notes |
|---|---|---|
| Requested media type | $request.header.accept |
|
| Request parameter | $request.path.id |
Request parameters MUST be declared in the parameters section of the parent operation or they cannot be evaluated. This includes request headers. |
The 2nd example says that headers MUST be defined as parameters. But the 1st example refers to the Accept header which is not allowed in parameters.
Is $request.header.accept is an invalid example? Or are runtime expressions supposed to access any request headers?
Similarly, the section about callback path keys provides an example with the Content-Type header:
$request.header.content-Type application/json
Like Accept, Content-Type is not allowed in parameters. Is this example valid or not?
I don't think the constraint about not declaring Accept headers existed when the runtime expression was created so I didn't think about that contradiction. However, I believe it still is valid.
How about changing the constraint to this?
Request parameters MUST be declared in the parameters section of the parent operation or be a header defined in the IANA header registry.
I'm guessing we didn't do this in the patch releases because technically it is an added feature, and then we just overlooked it for 3.2. Adding to the 3.3 milestone.