Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc v1, Speakeasy CLI 1.126.0
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Dec 12, 2023
1 parent e4acf25 commit bf840e4
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ func main() {

<!-- Start Special Types [types] -->
## Special Types


<!-- End Special Types [types] -->


Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,14 @@ Based on:
### Generated
- [go v0.5.3] .
### Releases
- [Go v0.5.3] https://github.com/speakeasy-sdks/test-without-webhooks-go-sdk/releases/tag/v0.5.3 - .
- [Go v0.5.3] https://github.com/speakeasy-sdks/test-without-webhooks-go-sdk/releases/tag/v0.5.3 - .

## 2023-12-12 01:30:40
### Changes
Based on:
- OpenAPI Doc v1
- Speakeasy CLI 1.126.0 (2.213.3) https://github.com/speakeasy-api/speakeasy
### Generated
- [go v0.6.0] .
### Releases
- [Go v0.6.0] https://github.com/speakeasy-sdks/test-without-webhooks-go-sdk/releases/tag/v0.6.0 - .
8 changes: 4 additions & 4 deletions gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ configVersion: 1.0.0
management:
docChecksum: 0f4dc7d494564b62ed0526ffebf7d3cd
docVersion: v1
speakeasyVersion: 1.123.0
generationVersion: 2.202.2
speakeasyVersion: 1.126.0
generationVersion: 2.213.3
generation:
comments: {}
sdkClassName: test-without-webhooks
Expand All @@ -12,10 +12,10 @@ generation:
optionalPropertyRendering: withExample
features:
go:
core: 3.1.5
core: 3.2.0
globalServerURLs: 2.82.1
go:
version: 0.5.3
version: 0.6.0
clientServerStatusCodesAsErrors: true
flattenGlobalSecurity: true
imports:
Expand Down
29 changes: 23 additions & 6 deletions pkg/utils/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e
}
}

if isNil(field.Type, fieldVal) {
if isNil(field.Type, fieldVal) && field.Tag.Get("const") == "" {
if omitEmpty {
continue
}
Expand All @@ -66,7 +66,11 @@ func MarshalJSON(v interface{}, tag reflect.StructTag, topLevel bool) ([]byte, e
}

if additionalProperties == "true" {
if field.Type.Kind() != reflect.Map {
if isNil(field.Type, fieldVal) {
continue
}
fieldVal := trueReflectValue(fieldVal)
if fieldVal.Type().Kind() != reflect.Map {
return nil, fmt.Errorf("additionalProperties must be a map")
}

Expand Down Expand Up @@ -202,20 +206,33 @@ func UnmarshalJSON(b []byte, v interface{}, tag reflect.StructTag, topLevel bool
}

if additionalPropertiesField != nil && additionalPropertiesValue != nil {
if additionalPropertiesValue.Kind() != reflect.Map {
typeOfMap := additionalPropertiesField.Type
if additionalPropertiesValue.Type().Kind() == reflect.Interface {
typeOfMap = reflect.TypeOf(map[string]interface{}{})
} else if additionalPropertiesValue.Type().Kind() != reflect.Map {
return fmt.Errorf("additionalProperties must be a map")
}

additionalPropertiesValue.Set(reflect.MakeMap(additionalPropertiesField.Type))
mapValue := reflect.MakeMap(typeOfMap)

for key, value := range unmarhsaled {
val := reflect.New(additionalPropertiesField.Type.Elem())
val := reflect.New(typeOfMap.Elem())

if err := unmarshalValue(value, val, additionalPropertiesField.Tag, disallowUnknownFields); err != nil {
return err
}

additionalPropertiesValue.SetMapIndex(reflect.ValueOf(key), val.Elem())
if val.Elem().Type().String() == typeOfMap.Elem().String() {
mapValue.SetMapIndex(reflect.ValueOf(key), val.Elem())
} else {
mapValue.SetMapIndex(reflect.ValueOf(key), trueReflectValue(val))
}

}
if additionalPropertiesValue.Type().Kind() == reflect.Interface {
additionalPropertiesValue.Set(mapValue)
} else {
additionalPropertiesValue.Set(mapValue)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions testwithoutwebhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ func New(opts ...SDKOption) *TestWithoutWebhooks {
sdkConfiguration: sdkConfiguration{
Language: "go",
OpenAPIDocVersion: "v1",
SDKVersion: "0.5.3",
GenVersion: "2.202.2",
UserAgent: "speakeasy-sdk/go 0.5.3 2.202.2 v1 github.com/speakeasy-sdks/test-without-webhooks-go-sdk",
SDKVersion: "0.6.0",
GenVersion: "2.213.3",
UserAgent: "speakeasy-sdk/go 0.6.0 2.213.3 v1 github.com/speakeasy-sdks/test-without-webhooks-go-sdk",
},
}
for _, opt := range opts {
Expand Down

0 comments on commit bf840e4

Please sign in to comment.