Skip to content

Tags: oapi-codegen/runtime

Tags

v1.7.0

Toggle v1.7.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix panic binding numeric values into non-byte slice destinations (#156)

Closes: #155

The reflect.Slice case handled the base64 `format: byte` path and then
fell through, with a comment claiming it landed in the default error
case. It did not: the next case is the integer one, so a non-byte slice
destination reached v.OverflowInt on a slice reflect.Value and panicked.
Only sources that parse as an integer got that far — ParseInt failed
first for anything else, masking the bug behind a plausible-looking
error.

This was reachable from generated server code. A nullable slice query
parameter using the default form/explode serialization binds through the
primitive path, and the nullable wrapper then binds the raw value into a
fresh slice, so `?p=123` panicked while `?p=abc` returned a binding
error.

Replace the fallthrough with the explicit unhandled-type error, which
restores the pre-v1.2.0 behavior (the fallthrough came in with 224825a,
first released in v1.2.0) and makes the comment true. A []byte
destination without Format "byte" took the same panicking path and now
reports the same error; that path never bound successfully, so nothing
could have depended on it.

Regression tests pin both the numeric and non-numeric sources against
[]string, []int and []byte, plus the nullable.Nullable[[]string]
exploded-query route through both BindQueryParameter and
BindRawQueryParameter.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

v1.6.0

Toggle v1.6.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore(deps): update module github.com/golangci/golangci-lint to v2.12…

….2 (#112)

* chore(deps): update module github.com/golangci/golangci-lint to v2.12.2

* Update lint settings

The linter was being pulled incorrectly, and run it on Go 1.26 like
in the main repo.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marcin Romaszewicz <marcinr@gmail.com>

v1.5.0

Toggle v1.5.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix(deps): update module github.com/labstack/echo/v5 to v5.3.0 (#142)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

v1.4.2

Toggle v1.4.2's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add missing required parameter detection (#135)

Closes: #134

The exploded form path bound struct-typed query params (e.g. types.Date,
time.Time) via bindParamsToExplodedObject and returned nil when no fields
were present, dropping the required check that the slice and primitive
cases already perform. A missing required date param therefore passed
silently instead of returning a RequiredParameterError.

Honor required in the reflect.Struct case of both
BindQueryParameterWithOptions and BindRawQueryParameter, and add
regression tests for the absent-required case.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

v1.4.1

Toggle v1.4.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix form binding of Nullables (#133)

Closes: #129

`nullable.Nullable[T]` is defined as `map[bool]T`, but neither
`bindFormImpl` nor `BindStringToObjectWithOptions` had a `reflect.Map`
branch, so any Nullable field in a form body failed with
"error binding string parameter: can not bind to destination of type: map".

This change adds Map handling at both layers:

- `BindStringToObjectWithOptions` (bindstring.go): a bool-keyed map
  destination is treated as a Nullable wrapper -- bind `src` into a
  fresh value of the map's element type, then store it under
  `map[bool]T{true: value}`. This covers query, path, and header
  parameters in addition to forms.
- `bindFormImpl` (bindform.go): a bool-keyed map field recurses
  through `bindFormImpl` on the element type and wraps the result, so
  `Nullable[ComplexStruct]` works alongside scalars. A non-bool-keyed
  map field routes to a new `bindFormMap` helper that binds entries
  of the form `name[key]=value` into a generic `map[K]V`.

The structural `map[bool]T` check keeps `runtime` decoupled from
`github.com/oapi-codegen/nullable`; the data shape is the whole type,
so detecting it by reflection is equivalent to importing the package.

An absent form field still produces an unspecified (zero) Nullable,
matching the pre-fix behavior. Form payloads have no way to encode
an explicit null, so `name=` binds as the inner type's zero value
(specified), symmetric with non-nullable form binding.

Tests cover scalar Nullable, generic `map[K]V`, and the
absent-field-stays-unspecified path.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

v1.4.0

Toggle v1.4.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix(deps): update module github.com/labstack/echo/v4 to v4.15.1 (#105)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

v1.3.1

Toggle v1.3.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix regression in binding simple parameters (#115)

Fixes #114

My fix for label/matrix parameter binding broke simple types. matrix/label
need to have prefixes stripped off, but I unconditionally did splitting
even for simple types.

Added a test to catch this regression in the future.

strictmiddleware/echo-v5/v1.3.1

Toggle strictmiddleware/echo-v5/v1.3.1's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fix regression in binding simple parameters (#115)

Fixes #114

My fix for label/matrix parameter binding broke simple types. matrix/label
need to have prefixes stripped off, but I unconditionally did splitting
even for simple types.

Added a test to catch this regression in the future.

v1.3.0

Toggle v1.3.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
chore: Update to go 1.24 (#111)

* chore: Update to go 1.24

Updated the top level module to require Go 1.24 and updated
dependencies

* Update CI requirement

v1.2.0

Toggle v1.2.0's commit message

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: bind Date and Time query params as scalar values (#21) (#93)

BindQueryParameter treated all structs as key-value objects in the
non-exploded form path, causing types.Date and time.Time to fail with
"property/values need to be pairs". Scalar struct types that implement
Binder or encoding.TextUnmarshaler are now bound directly via their
interface methods instead of being routed to bindSplitPartsToDestinationStruct.

Also adds Binder implementation to types.Date so it self-identifies as a
scalar binding target.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>