Repository navigation
fix(net/goai): add style=deepObject and explode=true for query params with object schema (#4784) - #4813
Merged
hailaz merged 2 commits intoJul 30, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates GoFrame’s OpenAPI v3 generator (net/goai) to emit style: deepObject and explode: true for query parameters whose schema is an object (e.g., nested structs), aligning generated specs with GoFrame’s bracket-notation query parsing and improving compatibility with client generators like openapi-generator.
Changes:
- Detect query parameters with an object schema in
newParameterRefWithStructMethod. - Populate OpenAPI parameter serialization fields (
style=deepObject,explode=true) for those query parameters.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…lied when not explicitly set
hailaz
approved these changes
Jul 30, 2026
social4hyq
pushed a commit
to social4hyq/homebrew-core
that referenced
this pull request
Sep 20, 2026
gf 2.10.3 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * fix: update gf cli to v2.10.2 by @github-actions[bot] in gogf/gf#4773 * feat(cmd/gf): gen dao suppport for dm database by @hailaz in gogf/gf#4776 * fix(ghttp): resolve the issue where the GetCertificate callback in TLS listener gets overwritten by @cashtang in gogf/gf#4789 * fix(net/ghttp): report invalid json body errors by @puneetdixit200 in gogf/gf#4775 * fix(gclient): add timeout configuration methods and improve client initialization by @hailaz in gogf/gf#4779 * fix(cmd/gf): missing pointer in generated service file (#4741) by @UncleChair in gogf/gf#4742 * fix(util/gvalid): date validation allows invalid formats like Y-MMMM and invalid dates like 2026-13-33 by @cococolanosugar in gogf/gf#4740 * fix(container/gmap): added WithError methods for KVMap and ListKVMap by @LanceAdd in gogf/gf#4714 * feat(contrib/drivers/mssql): convert uniqueidentifier to uuid.UUID by @NickWilde18 in gogf/gf#4756 * fix(os/glog): JsonHandler outputs flat JSON suitable for ES ingestion (#4790) by @yangyanqing in gogf/gf#4791 * feat(database/gdb): Added OmitZero function to filter zero value parameters by @LanceAdd in gogf/gf#4713 * Revert "feat(database/gdb): Added OmitZero function to filter zero value parameters" by @hailaz in gogf/gf#4818 * fix(net/ghttp): normalize HTTP method to uppercase in getHandlersWithCache to prevent route cache pollution (#4765) by @waterWang in gogf/gf#4812 * fix(os/gcfg): normalize config pattern in GetWithEnv by @webguosai in gogf/gf#4748 * fix(encoding/ghash): PJW64 should use 64-bit width by @guoxing-li in gogf/gf#4728 * fix(net/goai): add style=deepObject and explode=true for query params with object schema (#4784) by @waterWang in gogf/gf#4813 * feat(os/grpool): let can set limit/cap dynamically by @joy999 in gogf/gf#4794 * test(contrib/drivers/pgsql): expand test coverage to MySQL/MariaDB baseline + 3 framework fixes by @lingcoder in gogf/gf#4763 * fix(net/ghttp): use a case-preserving key for the router searching cache by @lingcoder in gogf/gf#4833 * chore(openspec): remove openspec docs from repo by @gqcn in gogf/gf#4838 * fix(util/gconv): support array-backed unmarshalling values by @ErzerLP in gogf/gf#4810 * fix(net/ghttp): windows web admin restart only shutdowns but doesn't restart by @lonevle in gogf/gf#4809 * feat(container/gtree): Add the function of popping left and right nodes of red-black tree by @LanceAdd in gogf/gf#4793 * feat:To support the loong64 architecture upgrade, we have upgraded go-sqlite and modernc.org/libc. by @lijunting2020 in gogf/gf#4847 * fix(util/gconv): unwrap reflect.Value and support pointer element slices by @hailaz in gogf/gf#4848 * fix(net/goai): nil pointer dereference when an array with enum has an interface element (#4746) by @lingcoder in gogf/gf#4844 * ci: update the CI/CD dependency versions and scripts by @lingcoder in gogf/gf#4852 * fix(os/grpool): stop Test_Limit4 asserting a sum that has a race window by @lingcoder in gogf/gf#4854 * fix(contrib/nacos): move to the upstream commit that fixes the RpcClient data race by @lingcoder in gogf/gf#4856 * ci: make the Apollo and nacos containers actually ready before tests run by @lingcoder in gogf/gf#4857 * fix(database/gdb): stop reporting an aborted row iteration as success by @jiang-bx in gogf/gf#4858 * ci: wait for the Apollo database before starting Apollo by @lingcoder in gogf/gf#4860 * test(contrib/drivers): expand gaussdb coverage to the MySQL/PgSQL baseline + 8 related bug fixes by @lingcoder in gogf/gf#4840 * fix(os/grpool): read the array before the queue in Test_Limit4 assertions by @lingcoder in gogf/gf#4862 * fix: v2.10.3 by @hailaz in gogf/gf#4866 ## New Contributors * @cashtang made their first contribution in gogf/gf#4789 * @puneetdixit200 made their first contribution in gogf/gf#4775 * @NickWilde18 made their first contribution in gogf/gf#4756 * @waterWang made their first contribution in gogf/gf#4812 * @webguosai made their first contribution in gogf/gf#4748 * @guoxing-li made their first contribution in gogf/gf#4728 * @ErzerLP made their first contribution in gogf/gf#4810 * @lonevle made their first contr 8000 ibution in gogf/gf#4809 * @lijunting2020 made their first contribution in gogf/gf#4847 * @jiang-bx made their first contribution in gogf/gf#4858 **Full Changelog**: https://github.com/gogf/gf/compare/v2.10.2...v2.10.3</pre> <p>View the full release notes at <a href="https://github.com/gogf/gf/releases/tag/v2.10.3">https://github.com/gogf/gf/releases/tag/v2.10.3</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!17794
ChamHerry
pushed a commit
to ChamHerry/gf
that referenced
this pull request
Oct 21, 2026
… with object schema (gogf#4784) (gogf#4813) ## Summary When a GET/DELETE handler defines a query parameter with a nested struct type (e.g. `FilterOptions`), the generated OpenAPI spec currently omits `style` and `explode` on the parameter. This causes client generators (like openapi-generator) to default to form-style serialization (`?IncludeDeleted=true`), which GoFrame's server-side parser does not accept — the nested struct fields are silently ignored. Per the [OpenAPI 3.0 spec on parameter serialization](https://swagger.io/docs/specification/serialization/), query parameters of object type should use `style: deepObject` and `explode: true` so that clients serialize them as `?Options[IncludeDeleted]=true`, matching GoFrame's own query string parsing. ## Changes Modified `net/goai/goai_parameter_ref.go` — in `newParameterRefWithStructMethod`, after setting the parameter schema, check if the parameter is a query parameter with an object schema. If so, set `style: deepObject` and `explode: true`. ## Before ```json { "name": "Options", "in": "query", "schema": { "$ref": "#/components/schemas/FilterOptions" } } ``` ## After ```json { "name": "Options", "in": "query", "style": "deepObject", "explode": true, "schema": { "$ref": "#/components/schemas/FilterOptions" } } ``` Fixes gogf#4784 --------- Co-authored-by: hailaz <739476267@qq.com>
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
When a GET/DELETE handler defines a query parameter with a nested struct type (e.g.
FilterOptions), the generated OpenAPI spec currently omitsstyleandexplodeon the parameter. This causes client generators (like openapi-generator) to default to form-style serialization (?IncludeDeleted=true), which GoFrame's server-side parser does not accept — the nested struct fields are silently ignored.Per the OpenAPI 3.0 spec on parameter serialization, query parameters of object type should use
style: deepObjectandexplode: trueso that clients serialize them as?Options[IncludeDeleted]=true, matching GoFrame's own query string parsing.Changes
Modified
net/goai/goai_parameter_ref.go— innewParameterRefWithStructMethod, after setting the parameter schema, check if the parameter is a query parameter with an object schema. If so, setstyle: deepObjectandexplode: true.Before
{ "name": "Options", "in": "query", "schema": { "$ref": "#/components/schemas/FilterOptions" } }After
{ "name": "Options", "in": "query", "style": "deepObject", "explode": true, "schema": { "$ref": "#/components/schemas/FilterOptions" } }Fixes #4784