interagent / interagent/committee
Cannot assert on actual headers: Rack mutates header key
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 955
- Forks
- 145
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 6
Description
Given an OpenApi3 swagger yaml definition for a header:
x-Role: &Role
in: "header"
name: "Role"
required: true
schema:
type: "string"
enum: ["A", "B"]
And given a valid request:
curl ... -H "Role: A"
Committee, when raising an error, raises the following error for this request:
Committee::InvalidRequest:
#/paths/... missing required parameters: Role
This is because Rack mutates all http headers, and Role becomes HTTP_ROLE.
This would seem unrelated to this gem, except that it is designed as Rack middleware, so it seems odd that it wouldn't work with rack conventions.
I'm not too familiar with the gem yet, but a first idea for a solution might be to cast all swagger-defined headers into HTTP_x formats before passing to validation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the OpenAPI 3 header example with the shown curl request, then trace the Rack middleware boundary and request-header validation path. Confirm that a required Role header is recognized despite Rack's HTTP_ROLE convention; done means the request validates without the missing-parameter error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100