Skip to content

Commit c05dcc1

Browse files
renovate[bot]github-actions[bot]pmalek
authored
chore(deps): update dependency speakeasy-api/speakeasy to v1.606.3 (#149)
* chore(deps): update dependency speakeasy-api/speakeasy to v1.606.2 * Bump .speakeasy/gen.yaml based on label * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * Update provider based on openapi.yaml changes * chore: regenerate * Update provider based on openapi.yaml changes --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Patryk Małek <[email protected]>
1 parent 67de7ef commit c05dcc1

File tree

323 files changed

+1801
-669
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+1801
-669
lines changed

.github/workflows/bump-version.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
repo: speakeasy
4949
cli_name: speakeasy
5050
package_type: zip
51-
version: 1.606.2 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy
51+
version: 1.615.2 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy
5252

5353
- name: Checkout
5454
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.github/workflows/generate_on_pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ jobs:
5959
repo: speakeasy
6060
cli_name: speakeasy
6161
package_type: zip
62-
version: 1.606.2 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy
62+
version: 1.615.2 # renovate: datasource=github-releases depName=speakeasy-api/speakeasy
6363

6464
- name: Checkout current repo
6565
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.env
2+
.env.local
13
.DS_Store
24
**/.speakeasy/temp/
35
**/.speakeasy/logs/

.speakeasy/gen.lock

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ id: b81e5def-5b1e-4753-ae7c-0efccc2e6f61
33
management:
44
docChecksum: fd76c26f0f05fb50afadad8a065282d0
55
docVersion: 3.0.24
6-
speakeasyVersion: 1.606.2
7-
generationVersion: 2.687.1
6+
speakeasyVersion: 1.615.2
7+
generationVersion: 2.698.4
88
releaseVersion: 0.9.1
9-
configChecksum: 334c1a8861bf1cd9cb869461fbe5777e
9+
configChecksum: 85b671c884fc1ae73c7ebed5635f5884
1010
features:
1111
go:
1212
acceptHeaders: 2.81.2
1313
additionalDependencies: 0.1.0
1414
additionalProperties: 0.1.2
1515
constsAndDefaults: 0.1.12
16-
core: 3.9.3
16+
core: 3.9.6
1717
deepObjectParams: 0.1.1
1818
defaultEnabledRetries: 0.2.0
1919
deprecations: 2.81.3
2020
downloadStreams: 0.1.2
2121
envVarSecurityUsage: 0.3.2
2222
flattening: 2.81.1
23-
globalSecurity: 2.82.11
23+
globalSecurity: 2.82.12
2424
globalSecurityCallbacks: 0.1.0
2525
globalServerURLs: 2.82.3
2626
groups: 2.81.2
@@ -34,7 +34,7 @@ features:
3434
retries: 2.84.2
3535
sdkHooks: 0.2.0
3636
typeOverrides: 2.81.1
37-
unions: 2.85.12
37+
unions: 2.85.14
3838
generatedFiles:
3939
- .gitattributes
4040
- /models/components/acl.go

.speakeasy/gen.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ generation:
1616
auth:
1717
oAuth2ClientCredentialsEnabled: false
1818
oAuth2PasswordEnabled: false
19+
hoistGlobalSecurity: true
1920
tests:
2021
generateTests: true
2122
generateNewTests: false
@@ -42,5 +43,6 @@ go:
4243
modulePath: ""
4344
outputModelSuffix: output
4445
packageName: github.com/Kong/sdk-konnect-go
46+
respectRequiredFields: false
4547
responseFormat: envelope
4648
sdkPackageName: ""

.speakeasy/workflow.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
speakeasyVersion: 1.606.2
1+
speakeasyVersion: 1.615.2
22
sources:
33
konnect:
44
sourceNamespace: konnect
@@ -13,7 +13,7 @@ targets:
1313
sourceRevisionDigest: sha256:c639a509989846db09eb72fa0384d9d4cc7717a96710ef0075f7e4f85d3e5bed
1414
sourceBlobDigest: sha256:1d37bad2d56ec14c07aa336eab140bce5c3865b8072372dbd43c751527fa0e1d
1515
codeSamplesNamespace: konnect-go-code-samples
16-
codeSamplesRevisionDigest: sha256:2f5daf34978a8c3f649929d79b822fda25ec914e28e3a33c62fe2e78cc2de379
16+
codeSamplesRevisionDigest: sha256:27fef19fbe754914c5928e755a6d0d11fa73b5ba46d7d7addb5ba1001239b675
1717
workflow:
1818
workflowVersion: 1.0.0
1919
speakeasyVersion: latest

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05 h1:S92OBrGuL
44
github.com/ericlagergren/decimal v0.0.0-20221120152707-495c53812d05/go.mod h1:M9R1FoZ3y//hwwnJtO51ypFGwm8ZfpxPT/ZLtO1mcgQ=
55
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
66
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7-
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
8-
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
97
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
108
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
119
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=

internal/utils/json.go

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package utils
55
import (
66
"bytes"
77
"encoding/json"
8+
"errors"
89
"fmt"
910
"math/big"
1011
"reflect"
@@ -114,29 +115,35 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e
114115
}
115116
}
116117

117-
func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, disallowUnknownFields bool) error {
118+
func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool, requiredFields []string) error {
118119
if reflect.TypeOf(v).Kind() != reflect.Ptr {
119-
return fmt.Errorf("v must be a pointer")
120+
return errors.New("v must be a pointer")
120121
}
121122

122123
typ, val := dereferencePointers(reflect.TypeOf(v), reflect.ValueOf(v))
123124

124125
switch {
125126
case isModelType(typ):
126127
if topLevel || bytes.Equal(b, []byte("null")) {
127-
d := json.NewDecoder(bytes.NewReader(b))
128-
if disallowUnknownFields {
129-
d.DisallowUnknownFields()
130-
}
131-
return d.Decode(v)
128+
return json.Unmarshal(b, v)
132129
}
133130

134-
var unmarhsaled map[string]json.RawMessage
131+
var unmarshaled map[string]json.RawMessage
135132

136-
if err := json.Unmarshal(b, &unmarhsaled); err != nil {
133+
if err := json.Unmarshal(b, &unmarshaled); err != nil {
137134
return err
138135
}
139136

137+
missingFields := []string{}
138+
for _, requiredField := range requiredFields {
139+
if _, ok := unmarshaled[requiredField]; !ok {
140+
missingFields = append(missingFields, requiredField)
141+
}
142+
}
143+
if len(missingFields) > 0 {
144+
return fmt.Errorf("missing required fields: %s", strings.Join(missingFields, ", "))
145+
}
146+
140147
var additionalPropertiesField *reflect.StructField
141148
var additionalPropertiesValue *reflect.Value
142149

@@ -163,7 +170,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool
163170

164171
// If we receive a value for a const field ignore it but mark it as unmarshaled
165172
if field.Tag.Get("const") != "" {
166-
if r, ok := unmarhsaled[fieldName]; ok {
173+
if r, ok := unmarshaled[fieldName]; ok {
167174
val := string(r)
168175

169176
if strings.HasPrefix(val, `"`) && strings.HasSuffix(val, `"`) {
@@ -178,40 +185,36 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool
178185
return fmt.Errorf("const field `%s` does not match expected value `%s` got `%s`", fieldName, constValue, val)
179186
}
180187

181-
delete(unmarhsaled, fieldName)
188+
delete(unmarshaled, fieldName)
182189
}
183190
} else if !field.IsExported() {
184191
continue
185192
}
186193

187-
value, ok := unmarhsaled[fieldName]
194+
value, ok := unmarshaled[fieldName]
188195
if !ok {
189196
defaultTag, defaultOk := field.Tag.Lookup("default")
190197
if defaultOk {
191198
value = handleDefaultConstValue(defaultTag, fieldVal.Interface(), field.Tag)
192199
ok = true
193200
}
194201
} else {
195-
delete(unmarhsaled, fieldName)
202+
delete(unmarshaled, fieldName)
196203
}
197204

198205
if ok {
199-
if err := unmarshalValue(value, fieldVal, field.Tag, disallowUnknownFields); err != nil {
206+
if err := unmarshalValue(value, fieldVal, field.Tag); err != nil {
200207
return err
201208
}
202209
}
203210
}
204211

205-
keys := make([]string, 0, len(unmarhsaled))
206-
for k := range unmarhsaled {
212+
keys := make([]string, 0, len(unmarshaled))
213+
for k := range unmarshaled {
207214
keys = append(keys, k)
208215
}
209216

210217
if len(keys) > 0 {
211-
if disallowUnknownFields && (additionalPropertiesField == nil || additionalPropertiesValue == nil) {
212-
return fmt.Errorf("unknown fields: %v", keys)
213-
}
214-
215218
if additionalPropertiesField != nil && additionalPropertiesValue != nil {
216219
typeOfMap := additionalPropertiesField.Type
217220
if additionalPropertiesValue.Type().Kind() == reflect.Interface {
@@ -222,10 +225,10 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool
222225

223226
mapValue := reflect.MakeMap(typeOfMap)
224227

225-
for key, value := range unmarhsaled {
228+
for key, value := range unmarshaled {
226229
val := reflect.New(typeOfMap.Elem())
227230

228-
if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil {
231+
if err := unmarshalValue(value, val, additionalPropertiesField.Tag); err != nil {
229232
return err
230233
}
231234

@@ -244,7 +247,7 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool
244247
}
245248
}
246249
default:
247-
return unmarshalValue(b, reflect.ValueOf(v), tag, disallowUnknownFields)
250+
return unmarshalValue(b, reflect.ValueOf(v), tag)
248251
}
249252

250253
return nil
@@ -394,7 +397,7 @@ func handleDefaultConstValue(tagValue string, val interface{}, tag reflect.Struc
394397
return []byte(tagValue)
395398
}
396399

397-
func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag, disallowUnknownFields bool) error {
400+
func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTag) error {
398401
if bytes.Equal(value, []byte("null")) {
399402
if v.CanAddr() {
400403
return json.Unmarshal(value, v.Addr().Interface())
@@ -466,18 +469,18 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa
466469
}
467470
}
468471

469-
var unmarhsaled map[string]json.RawMessage
472+
var unmarshaled map[string]json.RawMessage
470473

471-
if err := json.Unmarshal(value, &unmarhsaled); err != nil {
474+
if err := json.Unmarshal(value, &unmarshaled); err != nil {
472475
return err
473476
}
474477

475478
m := reflect.MakeMap(typ)
476479

477-
for k, value := range unmarhsaled {
480+
for k, value := range unmarshaled {
478481
itemVal := reflect.New(typ.Elem())
479482

480-
if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil {
483+
if err := unmarshalValue(value, itemVal, tag); err != nil {
481484
return err
482485
}
483486

@@ -498,7 +501,7 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa
498501
for index, value := range unmarshaled {
499502
itemVal := reflect.New(typ.Elem())
500503

501-
if err := unmarshalValue(value, itemVal, tag, disallowUnknownFields); err != nil {
504+
if err := unmarshalValue(value, itemVal, tag); err != nil {
502505
return err
503506
}
504507

@@ -616,11 +619,7 @@ func unmarshalValue(value json.RawMessage, v reflect.Value, tag reflect.StructTa
616619
val = v.Interface()
617620
}
618621

619-
d := json.NewDecoder(bytes.NewReader(value))
620-
if disallowUnknownFields {
621-
d.DisallowUnknownFields()
622-
}
623-
return d.Decode(val)
622+
return json.Unmarshal(value, val)
624623
}
625624

626625
func dereferencePointers(typ reflect.Type, val reflect.Value) (reflect.Type, reflect.Value) {

internal/utils/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ func UnmarshalJsonFromResponseBody(body io.Reader, out interface{}, tag string)
4040
if err != nil {
4141
return fmt.Errorf("error reading response body: %w", err)
4242
}
43-
if err := UnmarshalJSON(data, out, reflect.StructTag(tag), true, false); err != nil {
44-
return fmt.Errorf("error unmarshalling json response body: %w", err)
43+
if err := UnmarshalJSON(data, out, reflect.StructTag(tag), true, nil); err != nil {
44+
return fmt.Errorf("error unmarshaling json response body: %w", err)
4545
}
4646

4747
return nil

models/components/apiattributelistitem.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func (a APIAttributeListItem) MarshalJSON() ([]byte, error) {
4545
}
4646

4747
func (a *APIAttributeListItem) UnmarshalJSON(data []byte) error {
48-
if err := utils.UnmarshalJSON(data, &a, "", false, false); err != nil {
48+
if err := utils.UnmarshalJSON(data, &a, "", false, []string{"id", "created_at", "updated_at", "key", "values"}); err != nil {
4949
return err
5050
}
5151
return nil

0 commit comments

Comments
 (0)