atlassian / atlassian/openapi-request-validator
Message context not populated when validating response headers
- Dominant language
- Java
- Stars
- 14
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
As title says, there is no way to extract any information about header which failed validation while validating response.
For instance, let's say your openapi spec says response header should look like this
```
responses:
'200':
description: blah blah
headers:
X-Env:
description: Environment enum header
schema:
type: string
enum: [dev, test, prod]
```
when response has header `X-Env: 'wrong'` validator produces this king of message `does not have a value in the enumeration ["dev", "test", "prod"]`.
Context DOES NOT HAVE parameter value, it DOES NOT HAVE pointers.instance value. There is no way to which header this message is related to.
Generally it would be nice to have headers validation similar to request headers.
I don't understand why validating request headers produces messages with keys `validation.request.parameter.schema.(...)` and validating response headers produces messages with keys `validation.response.header.schema.(...)`
It should both be `...parameter.schema` and parameter information in context should be populated with proper parameter names
Contributor guide
Research direction
Start by comparing response-header validation with request-header validation, tracing how validation messages receive parameter context and schema keys. Reproduce the invalid X-Env enum case and inspect the response-header validation entry point; it is done when the failing header name and parameter context are exposed consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100