Skip to content

Merge the openapi_parameters gem into openapi_first - #496

Merged
ahx merged 3 commits into
mainfrom
merge-openapi-parameters
Aug 12, 2026
Merged

Merge the openapi_parameters gem into openapi_first#496
ahx merged 3 commits into
mainfrom
merge-openapi-parameters

Conversation

@ahx

@ahx ahx commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Vendors the openapi_parameters gem into this repo as OpenapiFirst::Parameters and drops the runtime dependency, so parameter parsing can evolve together with the rest of openapi_first.

Along the way:

  • Request#parameters is now a public API returning Parameters::Parameter objects (name, location, schema, required?, deprecated?, style, explode?, media_type).
  • Values that cannot be unpacked (repeated values for an object/content query parameter, malformed matrix values, broken %-encoding) now return a validation failure instead of raising NoMethodError/TypeError/ArgumentError.

Breaking changes and fixes are listed under ## Unreleased in CHANGELOG.md.

🤖 Generated with Claude Code

@ahx
ahx force-pushed the merge-openapi-parameters branch from 424a4ac to 4966f28 Compare August 12, 2026 13:26
ahx added 3 commits August 12, 2026 15:36
Request#parameters returns the parameters defined for a request as
Parameters::Parameter objects, ordered path, query, header, cookie, and
excluding the header parameters openapi_first ignores. Parameter is
public API now and answers required? and deprecated? again, which
describing a parameter needs.

This replaces the reader that was removed when openapi_parameters was
merged in, which handed out Builder's private_constant bundle of raw
parameter hashes and JSON schemas.

Deliberately not delegated from ValidatedRequest: that would shadow
ActionDispatch::Request#parameters for Rails users.

Co-Authored-By: Claude
Malformed parameter values escaped as exceptions out of
validate_request instead of failing validation, all reachable from
untrusted input:

- Repeated values for a query parameter that describes an object or
  uses content (?filter=a&filter=b) reached String#split or JSON.parse
  with an Array. These now throw :skip, so the raw values fall through
  to schema validation, like the other values these unpackers cannot
  unpack.
- A style: matrix value that does not contain the parameter name, or
  contains it more than once, reached nil.split or Array#split. These
  are now left to the converter, which is what the same values already
  did with explode: true, so both spellings agree.
- An invalid %-encoding in a matrix or path object value made
  Rack::Utils.parse_query raise, and the value now falls through to
  schema validation. Rack 2.2 and 3.0 raise a plain ArgumentError here,
  Rack 3.2 an InvalidParameterError, which is one.

Every value that could be unpacked before is unpacked to exactly the
same thing.

The behaviour was inherited from openapi_parameters 0.13.0.

Co-Authored-By: Claude
@ahx
ahx force-pushed the merge-openapi-parameters branch from 4966f28 to 334d3f2 Compare August 12, 2026 13:37
@ahx
ahx marked this pull request as ready for review August 12, 2026 13:37
@ahx
ahx merged commit 9b2b1a1 into main Aug 12, 2026
32 checks passed
@ahx
ahx deleted the merge-openapi-parameters branch August 12, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant