Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.28.0"
".": "0.29.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 97
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-d430a8e3407ceb608d912cabadbcb016b4fcf057ca56b3bbd179ea3b3121b484.yml
openapi_spec_hash: 8adbf013baf77abacaf04ed067749397
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-6c4fc624f12ead2f790c0f12148bc78f25d0b720080cae878b8a0fc0b5e5cd93.yml
openapi_spec_hash: ab25e882fbeeb782507576a442c1e15b
config_hash: b470456b217bb9502f5212311d395a6f
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.29.0 (2026-01-26)

Full Changelog: [v0.28.0...v0.29.0](https://github.com/kernel/kernel-go-sdk/compare/v0.28.0...v0.29.0)

### Features

* **client:** add a convenient param.SetJSON helper ([00e86b2](https://github.com/kernel/kernel-go-sdk/commit/00e86b280372cea0186578a4e73bf857310233e8))

## 0.28.0 (2026-01-22)

Full Changelog: [v0.27.0...v0.28.0](https://github.com/kernel/kernel-go-sdk/compare/v0.27.0...v0.28.0)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/kernel/kernel-go-sdk@v0.28.0'
go get -u 'github.com/kernel/kernel-go-sdk@v0.29.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.28.0" // x-release-please-version
const PackageVersion = "0.29.0" // x-release-please-version
18 changes: 18 additions & 0 deletions packages/param/param.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ func Override[T ParamStruct, PtrT InferPtr[T]](v any) T {
return *pt
}

// SetJSON configures a param struct to serialize with the provided raw JSON data.
// Use this when you have existing JSON that you want to send as request parameters.
//
// var req example.NewUserParams
// var rawJSON = []byte(`{"name": "...", "age": 40}`)
// param.SetJSON(rawJSON, &req)
// res, err := client.Users.New(ctx, req)
//
// Note: The struct's existing fields will be ignored; only the provided JSON is serialized.
func SetJSON(rawJSON []byte, ptr anyParamStruct) {
ptr.setMetadata(json.RawMessage(rawJSON))
}
Copy link

Choose a reason for hiding this comment

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

Nil input causes inconsistent null detection behavior

Low Severity

When SetJSON receives a nil byte slice, it converts it to json.RawMessage(nil) (a typed nil) rather than treating it as a null value. This causes param.IsNull() to return false on the resulting struct, yet the struct serializes to "null". The inconsistency arises because setMetadata only recognizes untyped nil for setting metadataNull{}, while json.RawMessage(nil) is a typed nil that passes the override == nil check. This differs from Override[T](nil) which works correctly.

Fix in Cursor Fix in Web


// IsOmitted returns true if v is the zero value of its type.
//
// If IsOmitted is true, and the field uses a `json:"...,omitzero"` tag,
Expand Down Expand Up @@ -91,6 +104,11 @@ type ParamStruct interface {
extraFields() map[string]any
}

// A pointer to ParamStruct
type anyParamStruct interface {
setMetadata(any)
}

// This is an implementation detail and should never be explicitly set.
type InferPtr[T ParamStruct] interface {
setMetadata(any)
Expand Down