feat(params): support unspecified type parameters#1583
Merged
ernado merged 1 commit intoogen-go:mainfrom Nov 24, 2025
Merged
Conversation
Add support for OpenAPI parameters with no type specified
(schema: {}) by representing them as Go `any` type.
Parameters are decoded as strings from URIs and encoded using
fmt.Sprint() on client side. Updates IR type system to return
"any" for URI contexts instead of "jx.Raw" for JSON contexts.
Includes integration tests and documentation.
lanej
added a commit
to lanej/ogen
that referenced
this pull request
Nov 24, 2025
Merged from ogen-go/ogen PR ogen-go#1583 which adds support for OpenAPI parameters with no type specified (schema: {}). These parameters are now represented as Go 'any' type instead of causing errors. Key changes: - Added IsAny case to URI decode/encode templates - Updated gen_parameters.go to allow any type parameters - Added feature check in ir/type.go for URI contexts - Resolved conflicts with existing IsSum support - Updated all imports to use github.com/lanej/ogen module path - Regenerated all code and updated golden files Co-authored-by: Josh Lane <lanej@gmail.com>
ernado
approved these changes
Nov 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for OpenAPI parameters with no type specified (
schema: {}). Previously, these parameters would cause "any type parameter not supported" errors. Now they are represented as Goanytype.Motivation
OpenAPI allows parameters to have schemas with no
typefield specified, which means the parameter can be of any type. ogen was rejecting these with an error, making it impossible to work with specs that use this pattern (common in legacy APIs or APIs with dynamic parameter types).Implementation
Core Changes (5 files, 21 lines changed):
IsAnycase to decode URI strings into GoanytypeIsAnycase with nil check, usesfmt.Sprint()for encoding"any"for URI contexts vs"jx.Raw"for JSON bodiesDesign Decisions:
anytype: More semantically accurate than forcing tostring- if the schema says "any", the Go type should beanyfmt.Sprint()for flexibility (allows passing strings, ints, bools, etc.)jx.Raw, URI parameters useany(different serialization contexts)Test Coverage
Breaking Changes
None - this is purely additive. Existing code continues to work unchanged.
Example Usage
Server side:
Client side: