Skip to content

feat: add ExtraParams support for declaring path params not in input models#2

Closed
c-wygoda wants to merge 1 commit intomasterfrom
feat/extra-params-support
Closed

feat: add ExtraParams support for declaring path params not in input models#2
c-wygoda wants to merge 1 commit intomasterfrom
feat/extra-params-support

Conversation

@c-wygoda
Copy link

@c-wygoda c-wygoda commented Jan 2, 2026

Summary

  • Add ExtraParams field to OperationInfo for declaring additional path/query parameters
  • Add ExtraParam struct for parameter metadata
  • Add PathParam() and QueryParam() OperationOption functions
  • Update generator to include extra params before OpenAPI path param validation

Background

This enables declaring path parameters at the operation level when they come from parent routes (e.g., /v1/:contract_id/...) and are not defined in handler input models.

Without this, fizz's OpenAPI validation fails with:

declared path parameter contract_id needs to be defined at operation level

Usage

r.GET("/v1/:contract_id/items", []fizz.OperationOption{
    fizz.PathParam("contract_id", "The contract identifier"),
    fizz.Summary("Get items"),
}, handler)

Test plan

  • Verify fizz compiles
  • Test integration with stacster path param support

🤖 Generated with Claude Code

…models

Add support for declaring extra path parameters at the operation level.
This is useful when path parameters come from parent routes
(e.g., /v1/:contract_id/...) and are not defined in handler input models.

- Add ExtraParams field to OperationInfo
- Add ExtraParam struct for parameter metadata
- Add PathParam and QueryParam OperationOption functions
- Update generator to include extra params before validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@c-wygoda
Copy link
Author

c-wygoda commented Jan 2, 2026

Closing this PR - we found a workaround by embedding BasePathParams in input structs, which allows fizz to find path params via reflection without requiring library changes. This enables releasing stacster as OSS without needing to merge fizz changes first.

@c-wygoda c-wygoda closed this Jan 2, 2026
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.

2 participants