8000 fix(net/goai): add style=deepObject and explode=true for query params with object schema (#4784) by waterWang · Pull Request #4813 · gogf/gf · GitHub
[go: up one dir, main page]

Skip to content

fix(net/goai): add style=deepObject and explode=true for query params with object schema (#4784) - #4813

Merged
hailaz merged 2 commits into
gogf:masterfrom
waterWang:fix/openapi-query-param-deepobject
Jul 30, 2026
Merged

hailaz merged 2 commits into
gogf:masterfrom
waterWang:fix/openapi-query-param-deepobject

Conversation

@waterWang
Copy link
Copy Markdown

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, 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

{
  "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

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread net/goai/goai_parameter_ref.go Resolved
Comment thread net/goai/goai_parameter_ref.go Resolved
@hailaz
hailaz merged commit e3367a4 into gogf:master Jul 30, 2026
18 of 24 checks passed
@hailaz hailaz changed the title fix(goai): add style=deepObject and explode=true for query params with object schema (#4784) fix(net/goai): add style=deepObject and explode=true for query params with object schema (#4784) 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Nested struct query params in GET handler are silently ignored by generated SDK clients

3 participants

0