Skip to content
Merged
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
10 changes: 6 additions & 4 deletions clients/algoliasearch-client-go/algolia/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func (v Nullable[T]) Get() *T {

func (v *Nullable[T]) Set(val *T) {
v.value = val
v.isSet = true
v.isSet = val != nil
}

func (v Nullable[T]) IsSet() bool {
Expand All @@ -39,16 +39,18 @@ func (v *Nullable[T]) Unset() {
}

func NewNullable[T any](val *T) *Nullable[T] {
return &Nullable[T]{value: val, isSet: true}
return &Nullable[T]{value: val, isSet: val != nil}
}

func (v Nullable[T]) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}

func (v *Nullable[T]) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
err := json.Unmarshal(src, &v.value)
v.isSet = v.value != nil

return err
}

// IsNilOrEmpty checks if an input is nil or empty.
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ apic() {
export apic

_list_languages() {
cat $ROOT/config/clients.config.json | jq -r 'keys[]'
cat $ROOT/config/clients.config.json | jq -r 'keys[] | select(. != "$schema")'
}

_list_languages_all() {
Expand Down
12 changes: 8 additions & 4 deletions specs/ingestion/common/schemas/event.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ Event:
minimum: 0
multipleOf: 1
data:
type: object
additionalProperties: true
oneOf:
- type: object
additionalProperties: true
- type: 'null'
publishedAt:
$ref: './common.yml#/publishedAt'
required:
Expand All @@ -31,8 +33,10 @@ Event:
- publishedAt

EventStatus:
type: string
enum: [created, started, retried, failed, succeeded, critical]
oneOf:
- type: string
enum: [created, started, retried, failed, succeeded, critical]
- type: 'null'

EventType:
type: string
Expand Down
2 changes: 1 addition & 1 deletion specs/ingestion/common/schemas/source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ SourceDocker:
properties:
image:
type: string
description: Shortname of the image, as returned by the referential.
description: Name of the connector.
example: zendesk
configuration:
type: object
Expand Down
16 changes: 13 additions & 3 deletions templates/go/model_simple.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,26 @@ func (o {{classname}}) MarshalJSON() ([]byte, error) {
}
{{/vendorExtensions.x-golang-is-container}}
{{^vendorExtensions.x-golang-is-container}}
if {{#required}}true{{/required}}{{^required}}o.{{name}}.IsSet(){{/required}} {
{{#required}}
toSerialize["{{baseName}}"] = o.{{name}}.Get()
{{/required}}
{{^required}}
if o.{{name}}.IsSet() {
toSerialize["{{baseName}}"] = o.{{name}}.Get()
}
{{/required}}
{{/vendorExtensions.x-golang-is-container}}
{{/isNullable}}
{{! if argument is not nullable, don't set it if it is nil}}
{{^isNullable}}
if {{#required}}true{{/required}}{{^required}}o.{{name}} != nil{{/required}} {
{{#required}}
toSerialize["{{baseName}}"] = o.{{name}}
{{/required}}
{{^required}}
if o.{{name}} != nil {
toSerialize["{{baseName}}"] = o.{{name}}
}
{{/required}}
{{/isNullable}}
{{/vars}}
{{#isAdditionalPropertiesTrue}}
Expand Down Expand Up @@ -443,4 +453,4 @@ func (o {{classname}}) String() string {
}
{{/isAdditionalPropertiesTrue}}
return fmt.Sprintf("{{classname}} {\n%s}", out)
}
}
2 changes: 1 addition & 1 deletion templates/python/model_generic.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{> model_description}}

{{#vars}}
{{name}}: {{^required}}Optional[{{/required}}{{{dataType}}}{{^required}}]{{/required}}{{^required}} = None{{/required}}
{{name}}: {{^required}}Optional[{{/required}}{{#required}}{{#isNullable}}Union[{{/isNullable}}{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}, None]{{/isNullable}}{{/required}}{{^required}}]{{/required}}{{^required}} = None{{/required}}
{{#description}}
""" {{{.}}} """
{{/description}}
Expand Down
4 changes: 3 additions & 1 deletion tests/CTS/client/ingestion/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@
},
"expected": {
"type": "response",
"match": {"message":"OK"}
"match": {
"message": "OK"
}
}
}
]
Expand Down