fix: add TypeHint-aware parameter binding and styling for []byte (#97) by mromaszewicz · Pull Request #98 · oapi-codegen/runtime

@mromaszewicz @claude

…api-codegen#97)

When an OpenAPI spec uses type: string, format: byte, the generated Go
code produces *[]byte fields. Previously the runtime treated []byte as
a generic []uint8 slice -- splitting on commas and parsing individual
integers -- instead of base64-encoding/decoding it as a single value.

This commit adds Type and Format string fields (matching the OpenAPI
spec type/format) to the Options structs for parameter binding and
styling functions. When Format is "byte" and the destination is
[]byte, the runtime base64-encodes (styling) or base64-decodes
(binding) the value as a single string.

New WithOptions functions and options structs:
- BindStringToObjectWithOptions + BindStringToObjectOptions
- StyleParamWithOptions + StyleParamOptions
- BindQueryParameterWithOptions + BindQueryParameterOptions

Extended existing options struct:
- BindStyledParameterOptions: added Type and Format fields

Existing functions delegate to WithOptions with zero-value options,
preserving backward compatibility for all current callers.

Encoding uses base64.StdEncoding (standard alphabet, padded) per
OpenAPI 3.0 / RFC 4648 Section 4. Decoding is lenient: it inspects
padding and URL-safe characters to select the correct decoder,
avoiding the silent corruption that occurs when RawStdEncoding
accepts padded input.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>