Skip to content

Commit 920babf

Browse files
Merge pull request #19 from sfcompute/release-please--branches--main--changes--next
2 parents ac3e18a + 1d76a7b commit 920babf

18 files changed

Lines changed: 360 additions & 37 deletions

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.3"
2+
".": "0.1.0-alpha.4"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 13
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-92d29637c0ceda06c752ad70b078ff8dad505843c16b923130774376890baaa5.yml
3-
openapi_spec_hash: 1f20f7d76aa5575ee0601ece537af956
4-
config_hash: cf202573c712b5d91a4d496f35f0ff57
1+
configured_endpoints: 15
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-c9d6d56eabd56a40a29dc2639a77d22dd5394ecd3ec9aeaebb3a3977811571da.yml
3+
openapi_spec_hash: beda3f45c48679e14d6fe8bbe7003d51
4+
config_hash: a187153315a646ecf95709ee4a223df5

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
# Changelog
22

3+
## 0.1.0-alpha.4 (2025-12-01)
4+
5+
Full Changelog: [v0.1.0-alpha.3...v0.1.0-alpha.4](https://github.com/sfcompute/nodes-go/compare/v0.1.0-alpha.3...v0.1.0-alpha.4)
6+
7+
### Features
8+
9+
* **api:** add .zones SDK methods ([7d0d7e8](https://github.com/sfcompute/nodes-go/commit/7d0d7e8e8c2902b64ac32afc36c9ab3c2d759c3f))
10+
* **api:** api update ([9f94ea5](https://github.com/sfcompute/nodes-go/commit/9f94ea57dcaabbec647d257634ee5c550bfe823b))
11+
* **api:** api update ([1342c39](https://github.com/sfcompute/nodes-go/commit/1342c3989b487bd7725ab95ba720c7da200c6899))
12+
* **api:** api update ([02e6349](https://github.com/sfcompute/nodes-go/commit/02e6349b1823ed96fecf3353231e32b00ef3989b))
13+
* **api:** api update ([26ba165](https://github.com/sfcompute/nodes-go/commit/26ba165c4e22a00f69c89f53edf7b0445057594f))
14+
15+
16+
### Bug Fixes
17+
18+
* **client:** correctly specify Accept header with */* instead of empty ([02ed3d4](https://github.com/sfcompute/nodes-go/commit/02ed3d4181ab9b9c97e85fb3dd0b9ded24489f40))
19+
20+
21+
### Chores
22+
23+
* bump gjson version ([4190bc4](https://github.com/sfcompute/nodes-go/commit/4190bc4b5cf17ed7fda70ff9e8ccab34eb33d477))
24+
* **internal:** codegen related update ([766d0aa](https://github.com/sfcompute/nodes-go/commit/766d0aaf277f7c0733d15ba33111d5e9519660a8))
25+
* **internal:** grammar fix (it's -> its) ([1a198ba](https://github.com/sfcompute/nodes-go/commit/1a198bad6aa4689cecfaccec1953310a60a1a47c))
26+
327
## 0.1.0-alpha.3 (2025-10-13)
428

529
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/sfcompute/nodes-go/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Or to pin the version:
2828
<!-- x-release-please-start-version -->
2929

3030
```sh
31-
go get -u 'github.com/sfcompute/nodes-go@v0.1.0-alpha.3'
31+
go get -u 'github.com/sfcompute/nodes-go@v0.1.0-alpha.4'
3232
```
3333

3434
<!-- x-release-please-end -->
@@ -125,7 +125,7 @@ custom := param.Override[sfcnodes.FooParams](12)
125125

126126
### Request unions
127127

128-
Unions are represented as a struct with fields prefixed by "Of" for each of it's variants,
128+
Unions are represented as a struct with fields prefixed by "Of" for each of its variants,
129129
only one field can be non-zero. The non-zero field will be serialized.
130130

131131
Sub-properties of the union can be accessed via methods on the union struct.

api.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,15 @@ Methods:
6464
- <code title="get /v1/nodes/{id}">client.Nodes.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#NodeService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#Node">Node</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
6565
- <code title="put /v1/nodes/{id}/redeploy">client.Nodes.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#NodeService.Redeploy">Redeploy</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#NodeRedeployParams">NodeRedeployParams</a>) (<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#Node">Node</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
6666
- <code title="patch /v1/nodes/{id}/release">client.Nodes.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#NodeService.Release">Release</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#Node">Node</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
67+
68+
# Zones
69+
70+
Response Types:
71+
72+
- <a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#ZoneListResponse">ZoneListResponse</a>
73+
- <a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#ZoneGetResponse">ZoneGetResponse</a>
74+
75+
Methods:
76+
77+
- <code title="get /v0/zones">client.Zones.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#ZoneService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) (<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#ZoneListResponse">ZoneListResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
78+
- <code title="get /v0/zones/{id}">client.Zones.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#ZoneService.Get">Get</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go">sfcnodes</a>.<a href="https://pkg.go.dev/github.com/sfcompute/nodes-go#ZoneGetResponse">ZoneGetResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Client struct {
1919
Options []option.RequestOption
2020
VMs VMService
2121
Nodes NodeService
22+
Zones ZoneService
2223
}
2324

2425
// DefaultClientOptions read from the environment (SFC_NODES_BEARER_TOKEN,
@@ -45,6 +46,7 @@ func NewClient(opts ...option.RequestOption) (r Client) {
4546

4647
r.VMs = NewVMService(opts...)
4748
r.Nodes = NewNodeService(opts...)
49+
r.Zones = NewZoneService(opts...)
4850

4951
return
5052
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/sfcompute/nodes-go
33
go 1.22
44

55
require (
6-
github.com/tidwall/gjson v1.14.4
6+
github.com/tidwall/gjson v1.18.0
77
github.com/tidwall/sjson v1.2.5
88
)
99

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
2-
github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM=
3-
github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
2+
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
3+
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
44
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
55
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
66
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=

internal/apijson/encoder.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import (
1616

1717
var encoders sync.Map // map[encoderEntry]encoderFunc
1818

19+
// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have
20+
// special characters that sjson interprets as a path.
21+
var EscapeSJSONKey = strings.NewReplacer("\\", "\\\\", "|", "\\|", "#", "\\#", "@", "\\@", "*", "\\*", ".", "\\.", ":", "\\:", "?", "\\?").Replace
22+
1923
func Marshal(value any) ([]byte, error) {
2024
e := &encoder{dateFormat: time.RFC3339}
2125
return e.marshal(value)
@@ -270,7 +274,7 @@ func (e *encoder) newStructTypeEncoder(t reflect.Type) encoderFunc {
270274
if encoded == nil {
271275
continue
272276
}
273-
json, err = sjson.SetRawBytes(json, ef.tag.name, encoded)
277+
json, err = sjson.SetRawBytes(json, EscapeSJSONKey(ef.tag.name), encoded)
274278
if err != nil {
275279
return nil, err
276280
}
@@ -348,7 +352,7 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error)
348352
}
349353
encodedKeyString = string(encodedKeyBytes)
350354
}
351-
encodedKey := []byte(sjsonReplacer.Replace(encodedKeyString))
355+
encodedKey := []byte(encodedKeyString)
352356
pairs = append(pairs, mapPair{key: encodedKey, value: iter.Value()})
353357
}
354358

@@ -366,7 +370,7 @@ func (e *encoder) encodeMapEntries(json []byte, v reflect.Value) ([]byte, error)
366370
if len(encodedValue) == 0 {
367371
continue
368372
}
369-
json, err = sjson.SetRawBytes(json, string(p.key), encodedValue)
373+
json, err = sjson.SetRawBytes(json, EscapeSJSONKey(string(p.key)), encodedValue)
370374
if err != nil {
371375
return nil, err
372376
}
@@ -386,7 +390,3 @@ func (e *encoder) newMapEncoder(_ reflect.Type) encoderFunc {
386390
return json, nil
387391
}
388392
}
389-
390-
// If we want to set a literal key value into JSON using sjson, we need to make sure it doesn't have
391-
// special characters that sjson interprets as a path.
392-
var sjsonReplacer *strings.Replacer = strings.NewReplacer(".", "\\.", ":", "\\:", "*", "\\*")

internal/apijson/union.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (d *decoderBuilder) newStructUnionDecoder(t reflect.Type) decoderFunc {
7878

7979
return func(n gjson.Result, v reflect.Value, state *decoderState) error {
8080
if discriminated && n.Type == gjson.JSON && len(unionEntry.discriminatorKey) != 0 {
81-
discriminator := n.Get(unionEntry.discriminatorKey).Value()
81+
discriminator := n.Get(EscapeSJSONKey(unionEntry.discriminatorKey)).Value()
8282
for _, decoder := range discriminatedDecoders {
8383
if discriminator == decoder.discriminator {
8484
inner := v.FieldByIndex(decoder.field.Index)
@@ -162,7 +162,7 @@ func (d *decoderBuilder) newUnionDecoder(t reflect.Type) decoderFunc {
162162
}
163163

164164
if len(unionEntry.discriminatorKey) != 0 {
165-
discriminatorValue := n.Get(unionEntry.discriminatorKey).Value()
165+
discriminatorValue := n.Get(EscapeSJSONKey(unionEntry.discriminatorKey)).Value()
166166
if discriminatorValue == variant.DiscriminatorValue {
167167
inner := reflect.New(variant.Type).Elem()
168168
err := decoder(n, inner, state)

0 commit comments

Comments
 (0)