Go version
go version go1.24.2 darwin/arm64
GoFrame version
v2.7.4
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
Defined a GET API handler with a nested struct as a query parameter:
type FilterOptions struct {
IncludeDeleted bool `dc:"Whether to include deleted records"`
}
type ListItemsReq struct {
g.Meta `path:"/items" tags:"Items" method:"get"`
Page int `dc:"Page number"`
Options FilterOptions `dc:"Query options"`
}
Then exported the OpenAPI spec via GoFrame's built-in swagger endpoint and used openapi-generator to generate a Java client SDK:
openapi-generator generate -i api.json -g java \
--library=apache-httpclient \
-o my-sdk
What did you see happen?
The generated api.json for the Options parameter was:
{
"name": "Options",
"in": "query",
"description": "Query options",
"schema": {
"$ref": "#/components/schemas/FilterOptions"
}
}
style and explode fields are missing.
As a result, openapi-generator used the default form style and serialized the nested struct by flattening it:
GET /items?IncludeDeleted=true
But GoFrame's server-side parser expects bracket notation:
GET /items?Options[IncludeDeleted]=true
So the Options struct fields are always zero values on the server — the parameter is silently ignored.
What did you expect to see?
Per OpenAPI 3.0 specification on parameter serialization, a query parameter of type object should be generated with style: deepObject and explode: true:
{
"name": "Options",
"in": "query",
"description": "Query options",
"style": "deepObject",
"explode": true,
"schema": {
"$ref": "#/components/schemas/FilterOptions"
}
}
This would cause openapi-generator to produce correct serialization:
GET /items?Options[IncludeDeleted]=true
Which matches GoFrame's own query string parsing behavior.
Suggested fix: In the OpenAPI spec generator, when a query parameter's schema resolves to an object type (directly or via $ref), automatically set style: deepObject and explode: true.
Go version
go version go1.24.2 darwin/arm64
GoFrame version
v2.7.4
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
Defined a GET API handler with a nested struct as a query parameter:
Then exported the OpenAPI spec via GoFrame's built-in swagger endpoint and used openapi-generator to generate a Java client SDK:
What did you see happen?
The generated api.json for the Options parameter was:
{ "name": "Options", "in": "query", "description": "Query options", "schema": { "$ref": "#/components/schemas/FilterOptions" } }styleandexplodefields are missing.As a result, openapi-generator used the default form style and serialized the nested struct by flattening it:
But GoFrame's server-side parser expects bracket notation:
So the
Optionsstruct fields are always zero values on the server — the parameter is silently ignored.What did you expect to see?
Per OpenAPI 3.0 specification on parameter serialization, a query parameter of type object should be generated with style: deepObject and explode: true:
{ "name": "Options", "in": "query", "description": "Query options", "style": "deepObject", "explode": true, "schema": { "$ref": "#/components/schemas/FilterOptions" } }This would cause
openapi-generatorto produce correct serialization:Which matches GoFrame's own query string parsing behavior.
Suggested fix: In the OpenAPI spec generator, when a
queryparameter's schema resolves to anobjecttype (directly or via$ref), automatically setstyle: deepObjectandexplode: true.