Skip to content

openapi3: add T.WalkParameters to visit every parameter in a document#22

Closed
reuvenharrison wants to merge 2 commits into
masterfrom
walk-parameters
Closed

openapi3: add T.WalkParameters to visit every parameter in a document#22
reuvenharrison wants to merge 2 commits into
masterfrom
walk-parameters

Conversation

@reuvenharrison

@reuvenharrison reuvenharrison commented Jul 14, 2026

Copy link
Copy Markdown

The parameter counterpart of WalkSchemas (getkin#1206): visits every parameter reachable from the document exactly once (components.parameters, path items, operations, callbacks, and webhooks), following resolved $ref targets so a shared parameter is visited a single time, at its definition, in deterministic (sorted) order, with RFC 6901 pointers. The callback may modify param.Value in place, so it serves transformers as well as read-only inspection.

Any consumer acting on parameters (validators/linters, e.g. per-parameter serialization rules; transformers, e.g. name normalization; documentation) currently re-derives this traversal, and hand-rolled versions tend to miss components.parameters, callbacks, or webhooks. Same motivation as WalkSchemas, one object type over.

Implemented as a parallel walker in the WalkSchemas style (self-contained, no changes to the schema walker); the two traversal skeletons could be unified later if desired. Since this adds a second walker, walk.go is renamed walk_schemas.go alongside the new walk_parameters.go.

Tests cover the five parameter sites, $ref dedup at the definition, deterministic pointers (including a callback expression key), error abort, and a nil document.

The parameter counterpart of WalkSchemas: visits every parameter reachable
from the document exactly once (components.parameters, path items, operations,
callbacks, webhooks), following resolved $refs so a shared parameter is
visited a single time, at its definition, in deterministic sorted order with
RFC 6901 pointers. Useful for validation, linting, and parameter
transformation without re-deriving the traversal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BqJA1X6suZYtR3tRbX8sLj
With walk_parameters.go added, name the schema walker's file to match.
@reuvenharrison

Copy link
Copy Markdown
Author

Merged upstream as getkin#1224; this fork copy is superseded.

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