This repository was archived by the owner on Jun 2, 2026. It is now read-only.
fix: Correct AuditEntry queryParams/body types in OpenAPI spec#592
Merged
Conversation
`AuditEntry.queryParams` is `url.Values` (`map[string][]string`) and
`AuditEntry.body` is `map[string]interface{}` in both the API model
(`api/pkg/api/model/audit_entry.go`) and the DB model
(`db/pkg/db/model/audit_entry.go` — both jsonb). The audit middleware
also unmarshals the raw request body into a `map[string]interface{}`
before persisting (`api/pkg/middleware/audit.go`), so the wire shape
on `GET /audit` is a JSON object, not a string.
The spec, however, declared both fields as `type: string` with examples
written as stringified JSON (e.g. `'{"key1":"value1"}'`). That produced
a generated Go SDK whose `AuditEntry.Body` and `QueryParams` were
`*string`, which silently failed to unmarshal real responses.
Realign the schema with the implementation:
- `queryParams`: `type: object` with `additionalProperties: {type: array,
items: {type: string}}` — mirrors `url.Values` exactly.
- `body`: `type: object` — free-form JSON, with a note on the
sensitive-field obfuscation the middleware performs.
- Update both inline endpoint examples and the schema-level example to
use nested objects instead of stringified JSON, which also clears the
Redocly `no-invalid-media-type-examples` warnings on these paths.
`extraData` was already `type: object`, so it is unchanged.
Run `make publish-openapi && make generate-sdk` and commit the updated
`docs/index.html` and `sdk/standard/` in a follow-up commit.
Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Output of `make publish-openapi && make generate-sdk` against the
AuditEntry spec fix in the previous commit.
`sdk/standard/model_audit_entry.go` is the substantive change: `Body`
and `QueryParams` flip from `*string` to `map[string]interface{}` and
`map[string][]string` respectively, matching the wire shape that the
API server already produces.
The rest of `sdk/standard/` and `docs/index.html` is generator-version
drift from previous PRs that did not rerun the regen targets — most of
it is whitespace/alignment that `gofmt` normalises, a couple of fields
gaining descriptions that were always present in the spec, and a
`defer file.Close()` swap in the generated client. None of these
require source changes; they are simply the artifacts catching up to
their inputs. CI was going to flag them as stale on the next regen
either way.
The handful of non-SDK file changes (`flow/internal/task/...`,
`common/pkg/util/converter_test.go`) are SPDX-header style fixes from
`scripts/check_source_headers.py --fix`, which the `generate-sdk`
target runs and which normalises any file still using the old
multi-line `/* … */` SPDX block to the two-line `//` form adopted in
b7b0cc4 ("chore: Switch file headers to two-line SPDX license style").
These files were added after b7b0cc4 and slipped through. Folding
them in here so the next `make generate-sdk` run produces no diff.
Signed-off-by: Kun Zhao <kunzhao@nvidia.com>
Contributor
WalkthroughThis pull request modernizes the SDK and OpenAPI specifications through four distinct technical changes: administrative licensing updates, API contract evolution, data model type refinement, and systematic pagination behavior correction across 27 endpoints. ChangesSDK and API Specification Modernization
Sequence DiagramsequenceDiagram
participant Client as SDK Client
participant Execute as GetAllXxxExecute
participant Query as parameterAddToHeaderOrQuery
participant Params as localVarQueryParams
Client->>Execute: ApiGetAllXxxRequest(pageNumber=nil)
Execute->>Execute: r.pageNumber == nil?
Execute->>Query: pageNumber, defaultValue(1)
Query->>Params: Add pageNumber=1
Params-->>Execute: Updated query parameters
Execute->>Execute: r.pageNumber = &defaultValue
Execute-->>Client: HTTP GET ?pageNumber=1&...
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
AuditEntry.queryParamsandAuditEntry.bodywere declared astype: stringinopenapi/spec.yaml, but the Go API model, DB model, and audit middleware all useurl.Values(=map[string][]string) andmap[string]interface{}respectively, so the wire shape onGET /auditis a JSON object, not a stringified JSON.Regenerate
docs/index.htmlandsdk/standard/accordingly.Type of Change
Services Affected
Related Issues (Optional)
Breaking Changes
Testing
Additional Notes