diff --git a/modules/openapi-generator/src/main/resources/go-experimental/model.mustache b/modules/openapi-generator/src/main/resources/go-experimental/model.mustache index c72fab46a94a..cbffd1fc340f 100644 --- a/modules/openapi-generator/src/main/resources/go-experimental/model.mustache +++ b/modules/openapi-generator/src/main/resources/go-experimental/model.mustache @@ -25,32 +25,6 @@ const ( {{/enumVars}} {{/allowableValues}} ) - -type Nullable{{{classname}}} struct { - Value {{{classname}}} - ExplicitNull bool -} - -func (v Nullable{{{classname}}}) MarshalJSON() ([]byte, error) { - switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable - case v.ExplicitNull: - return []byte("null"), nil - default: - return json.Marshal(v.Value) - } -} - -func (v *Nullable{{{classname}}}) UnmarshalJSON(src []byte) error { - if bytes.Equal(src, []byte("null")) { - v.ExplicitNull = true - return nil - } - - return json.Unmarshal(src, &v.Value) -} - {{/isEnum}} {{^isEnum}} // {{classname}}{{#description}} {{{description}}}{{/description}}{{^description}} struct for {{{classname}}}{{/description}} @@ -121,6 +95,7 @@ func (o *{{classname}}) Set{{name}}(v {{dataType}}) { {{/required}} {{/vars}} +{{/isEnum}} type Nullable{{{classname}}} struct { Value {{{classname}}} ExplicitNull bool @@ -132,7 +107,7 @@ func (v Nullable{{{classname}}}) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *Nullable{{{classname}}}) UnmarshalJSON(src []byte) error { @@ -143,7 +118,5 @@ func (v *Nullable{{{classname}}}) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } -{{/isEnum}} - {{/model}} {{/models}} diff --git a/samples/client/petstore/go-experimental/go-petstore/model_200_response.go b/samples/client/petstore/go-experimental/go-petstore/model_200_response.go index 6aa7f9b6a79e..b4e9becc59cb 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_200_response.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_200_response.go @@ -97,7 +97,7 @@ func (v NullableModel200Response) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableModel200Response) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableModel200Response) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_any_type.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_any_type.go index c6fbcc703b3c..72a28831595c 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_any_type.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_any_type.go @@ -63,7 +63,7 @@ func (v NullableAdditionalPropertiesAnyType) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesAnyType) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableAdditionalPropertiesAnyType) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_array.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_array.go index b1bf7f332828..1a20f680cb96 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_array.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_array.go @@ -63,7 +63,7 @@ func (v NullableAdditionalPropertiesArray) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesArray) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableAdditionalPropertiesArray) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_boolean.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_boolean.go index c1aacbc1eb51..218547d406c2 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_boolean.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_boolean.go @@ -63,7 +63,7 @@ func (v NullableAdditionalPropertiesBoolean) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesBoolean) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableAdditionalPropertiesBoolean) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go index 3c1e8db6244f..1a9c27fbd664 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go @@ -403,7 +403,7 @@ func (v NullableAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { @@ -414,4 +414,3 @@ func (v *NullableAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_integer.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_integer.go index 07c11d9cdcd0..40e13711d006 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_integer.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_integer.go @@ -63,7 +63,7 @@ func (v NullableAdditionalPropertiesInteger) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesInteger) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableAdditionalPropertiesInteger) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_number.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_number.go index 59759fb409ee..36cd75cd687e 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_number.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_number.go @@ -63,7 +63,7 @@ func (v NullableAdditionalPropertiesNumber) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesNumber) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableAdditionalPropertiesNumber) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_object.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_object.go index df2b0305a4d5..3b284106f61a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_object.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_object.go @@ -63,7 +63,7 @@ func (v NullableAdditionalPropertiesObject) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesObject) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableAdditionalPropertiesObject) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_string.go b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_string.go index 47eb4dd0de5e..c0e754757bdc 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_string.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_additional_properties_string.go @@ -63,7 +63,7 @@ func (v NullableAdditionalPropertiesString) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesString) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableAdditionalPropertiesString) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_animal.go b/samples/client/petstore/go-experimental/go-petstore/model_animal.go index dfae59606ed3..b54f59dbe612 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_animal.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_animal.go @@ -79,7 +79,7 @@ func (v NullableAnimal) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAnimal) UnmarshalJSON(src []byte) error { @@ -90,4 +90,3 @@ func (v *NullableAnimal) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_api_response.go b/samples/client/petstore/go-experimental/go-petstore/model_api_response.go index e2d80e220741..0b9eab9f7595 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_api_response.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_api_response.go @@ -131,7 +131,7 @@ func (v NullableApiResponse) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableApiResponse) UnmarshalJSON(src []byte) error { @@ -142,4 +142,3 @@ func (v *NullableApiResponse) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go b/samples/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go index cf5e59622f39..f2dbbb1f21e2 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go @@ -63,7 +63,7 @@ func (v NullableArrayOfArrayOfNumberOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableArrayOfArrayOfNumberOnly) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableArrayOfArrayOfNumberOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go b/samples/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go index 7495577a4ce5..9268a2ae608a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go @@ -63,7 +63,7 @@ func (v NullableArrayOfNumberOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableArrayOfNumberOnly) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableArrayOfNumberOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_array_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_array_test_.go index 01d310fd480a..84123ef137ba 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_array_test_.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_array_test_.go @@ -131,7 +131,7 @@ func (v NullableArrayTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableArrayTest) UnmarshalJSON(src []byte) error { @@ -142,4 +142,3 @@ func (v *NullableArrayTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_capitalization.go b/samples/client/petstore/go-experimental/go-petstore/model_capitalization.go index 281f380508c3..8288d903b7ba 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_capitalization.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_capitalization.go @@ -234,7 +234,7 @@ func (v NullableCapitalization) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCapitalization) UnmarshalJSON(src []byte) error { @@ -245,4 +245,3 @@ func (v *NullableCapitalization) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_cat.go b/samples/client/petstore/go-experimental/go-petstore/model_cat.go index a4390348e393..a9f83cc8c408 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_cat.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_cat.go @@ -113,7 +113,7 @@ func (v NullableCat) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCat) UnmarshalJSON(src []byte) error { @@ -124,4 +124,3 @@ func (v *NullableCat) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_cat_all_of.go b/samples/client/petstore/go-experimental/go-petstore/model_cat_all_of.go index 5fe06820a255..60ba5b0259fb 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_cat_all_of.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_cat_all_of.go @@ -63,7 +63,7 @@ func (v NullableCatAllOf) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCatAllOf) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableCatAllOf) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_category.go b/samples/client/petstore/go-experimental/go-petstore/model_category.go index 1a4d80c25abf..0bf8c0a2fd2c 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_category.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_category.go @@ -79,7 +79,7 @@ func (v NullableCategory) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCategory) UnmarshalJSON(src []byte) error { @@ -90,4 +90,3 @@ func (v *NullableCategory) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_class_model.go b/samples/client/petstore/go-experimental/go-petstore/model_class_model.go index cb217ea0b938..1621fc4acbde 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_class_model.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_class_model.go @@ -63,7 +63,7 @@ func (v NullableClassModel) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableClassModel) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableClassModel) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_client.go b/samples/client/petstore/go-experimental/go-petstore/model_client.go index 1c2d82dbaa25..45f3fce18b43 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_client.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_client.go @@ -63,7 +63,7 @@ func (v NullableClient) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableClient) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableClient) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_dog.go b/samples/client/petstore/go-experimental/go-petstore/model_dog.go index 1e12cf2030e2..eb2d7f05d41a 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_dog.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_dog.go @@ -113,7 +113,7 @@ func (v NullableDog) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableDog) UnmarshalJSON(src []byte) error { @@ -124,4 +124,3 @@ func (v *NullableDog) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_dog_all_of.go b/samples/client/petstore/go-experimental/go-petstore/model_dog_all_of.go index 0572953d4691..c88dfaca2e0b 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_dog_all_of.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_dog_all_of.go @@ -63,7 +63,7 @@ func (v NullableDogAllOf) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableDogAllOf) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableDogAllOf) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_enum_arrays.go b/samples/client/petstore/go-experimental/go-petstore/model_enum_arrays.go index 68b520550b3a..181a9287220f 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_enum_arrays.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_enum_arrays.go @@ -97,7 +97,7 @@ func (v NullableEnumArrays) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableEnumArrays) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableEnumArrays) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_enum_class.go b/samples/client/petstore/go-experimental/go-petstore/model_enum_class.go index 8864dc38698e..4311401eac6d 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_enum_class.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_enum_class.go @@ -31,13 +31,11 @@ type NullableEnumClass struct { func (v NullableEnumClass) MarshalJSON() ([]byte, error) { switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable case v.ExplicitNull: return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableEnumClass) UnmarshalJSON(src []byte) error { @@ -48,6 +46,3 @@ func (v *NullableEnumClass) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - - - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_enum_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_enum_test_.go index 8594082a56ae..c774c9b8f4f4 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_enum_test_.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_enum_test_.go @@ -181,7 +181,7 @@ func (v NullableEnumTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableEnumTest) UnmarshalJSON(src []byte) error { @@ -192,4 +192,3 @@ func (v *NullableEnumTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_file.go b/samples/client/petstore/go-experimental/go-petstore/model_file.go index d35f12c08879..23da628abcc5 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_file.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_file.go @@ -64,7 +64,7 @@ func (v NullableFile) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableFile) UnmarshalJSON(src []byte) error { @@ -75,4 +75,3 @@ func (v *NullableFile) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go b/samples/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go index 5c6a45436bea..50145af12233 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go @@ -97,7 +97,7 @@ func (v NullableFileSchemaTestClass) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableFileSchemaTestClass) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableFileSchemaTestClass) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_format_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_format_test_.go index 6676cf826fbf..608a083d7eb1 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_format_test_.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_format_test_.go @@ -435,7 +435,7 @@ func (v NullableFormatTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableFormatTest) UnmarshalJSON(src []byte) error { @@ -446,4 +446,3 @@ func (v *NullableFormatTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go b/samples/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go index 4d6a4ade3bab..5394aa4007da 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go @@ -97,7 +97,7 @@ func (v NullableHasOnlyReadOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableHasOnlyReadOnly) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableHasOnlyReadOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_list.go b/samples/client/petstore/go-experimental/go-petstore/model_list.go index 2e341b13fe21..6259d7507a39 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_list.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_list.go @@ -63,7 +63,7 @@ func (v NullableList) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableList) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableList) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_map_test_.go b/samples/client/petstore/go-experimental/go-petstore/model_map_test_.go index 482e2dcaa546..820f26413474 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_map_test_.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_map_test_.go @@ -165,7 +165,7 @@ func (v NullableMapTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableMapTest) UnmarshalJSON(src []byte) error { @@ -176,4 +176,3 @@ func (v *NullableMapTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go b/samples/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go index 29a15dd4b9bb..c4a7dba81820 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go @@ -132,7 +132,7 @@ func (v NullableMixedPropertiesAndAdditionalPropertiesClass) MarshalJSON() ([]by return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { @@ -143,4 +143,3 @@ func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(src return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_name.go b/samples/client/petstore/go-experimental/go-petstore/model_name.go index 15cb31cf79f0..2f3716aad24b 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_name.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_name.go @@ -147,7 +147,7 @@ func (v NullableName) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableName) UnmarshalJSON(src []byte) error { @@ -158,4 +158,3 @@ func (v *NullableName) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_number_only.go b/samples/client/petstore/go-experimental/go-petstore/model_number_only.go index a844fb8128ab..afa9c1b403a2 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_number_only.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_number_only.go @@ -63,7 +63,7 @@ func (v NullableNumberOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableNumberOnly) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableNumberOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_order.go b/samples/client/petstore/go-experimental/go-petstore/model_order.go index d138fa95cbae..448d6a975a47 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_order.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_order.go @@ -235,7 +235,7 @@ func (v NullableOrder) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOrder) UnmarshalJSON(src []byte) error { @@ -246,4 +246,3 @@ func (v *NullableOrder) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_outer_composite.go b/samples/client/petstore/go-experimental/go-petstore/model_outer_composite.go index b22599eb6722..423d3e5ad373 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_outer_composite.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_outer_composite.go @@ -131,7 +131,7 @@ func (v NullableOuterComposite) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOuterComposite) UnmarshalJSON(src []byte) error { @@ -142,4 +142,3 @@ func (v *NullableOuterComposite) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_outer_enum.go b/samples/client/petstore/go-experimental/go-petstore/model_outer_enum.go index b6385fcb5630..c2a75fee8461 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_outer_enum.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_outer_enum.go @@ -31,13 +31,11 @@ type NullableOuterEnum struct { func (v NullableOuterEnum) MarshalJSON() ([]byte, error) { switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable case v.ExplicitNull: return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOuterEnum) UnmarshalJSON(src []byte) error { @@ -48,6 +46,3 @@ func (v *NullableOuterEnum) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - - - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_pet.go b/samples/client/petstore/go-experimental/go-petstore/model_pet.go index 405a179218b7..7c1228c8b61c 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_pet.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_pet.go @@ -198,7 +198,7 @@ func (v NullablePet) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullablePet) UnmarshalJSON(src []byte) error { @@ -209,4 +209,3 @@ func (v *NullablePet) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_read_only_first.go b/samples/client/petstore/go-experimental/go-petstore/model_read_only_first.go index bdd9807ca899..424ef8b81f30 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_read_only_first.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_read_only_first.go @@ -97,7 +97,7 @@ func (v NullableReadOnlyFirst) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableReadOnlyFirst) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableReadOnlyFirst) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_return.go b/samples/client/petstore/go-experimental/go-petstore/model_return.go index 14821a5ca747..785303c992d6 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_return.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_return.go @@ -63,7 +63,7 @@ func (v NullableReturn) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableReturn) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableReturn) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_special_model_name.go b/samples/client/petstore/go-experimental/go-petstore/model_special_model_name.go index abafacb4e4dd..e1827cee8961 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_special_model_name.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_special_model_name.go @@ -63,7 +63,7 @@ func (v NullableSpecialModelName) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableSpecialModelName) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableSpecialModelName) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_tag.go b/samples/client/petstore/go-experimental/go-petstore/model_tag.go index a702f37f0939..bcb30265ab28 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_tag.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_tag.go @@ -97,7 +97,7 @@ func (v NullableTag) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableTag) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableTag) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_default.go b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_default.go index 173bd1c1b98e..e57edcc4aa6f 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_default.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_default.go @@ -109,7 +109,7 @@ func (v NullableTypeHolderDefault) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableTypeHolderDefault) UnmarshalJSON(src []byte) error { @@ -120,4 +120,3 @@ func (v *NullableTypeHolderDefault) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go index 6cd9a0867caf..3837bcdbb603 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_type_holder_example.go @@ -125,7 +125,7 @@ func (v NullableTypeHolderExample) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableTypeHolderExample) UnmarshalJSON(src []byte) error { @@ -136,4 +136,3 @@ func (v *NullableTypeHolderExample) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_user.go b/samples/client/petstore/go-experimental/go-petstore/model_user.go index 4411c284794d..a427f7f7c247 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_user.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_user.go @@ -302,7 +302,7 @@ func (v NullableUser) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableUser) UnmarshalJSON(src []byte) error { @@ -313,4 +313,3 @@ func (v *NullableUser) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/client/petstore/go-experimental/go-petstore/model_xml_item.go b/samples/client/petstore/go-experimental/go-petstore/model_xml_item.go index ddf16b84247f..6f81fca2b949 100644 --- a/samples/client/petstore/go-experimental/go-petstore/model_xml_item.go +++ b/samples/client/petstore/go-experimental/go-petstore/model_xml_item.go @@ -1015,7 +1015,7 @@ func (v NullableXmlItem) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableXmlItem) UnmarshalJSON(src []byte) error { @@ -1026,4 +1026,3 @@ func (v *NullableXmlItem) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_200_response.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_200_response.go index f578c71ae1db..f746eb97c50c 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_200_response.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_200_response.go @@ -97,7 +97,7 @@ func (v NullableModel200Response) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableModel200Response) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableModel200Response) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model__special_model_name_.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model__special_model_name_.go index e8e5786195db..a327da2f86fa 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model__special_model_name_.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model__special_model_name_.go @@ -63,7 +63,7 @@ func (v NullableSpecialModelName) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableSpecialModelName) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableSpecialModelName) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go index ea7b0eb7d773..2448275032bc 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_additional_properties_class.go @@ -97,7 +97,7 @@ func (v NullableAdditionalPropertiesClass) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_animal.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_animal.go index 1bca9d7f269b..bec70d7337ae 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_animal.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_animal.go @@ -79,7 +79,7 @@ func (v NullableAnimal) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableAnimal) UnmarshalJSON(src []byte) error { @@ -90,4 +90,3 @@ func (v *NullableAnimal) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_api_response.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_api_response.go index 24e672579876..94b4983c8b3c 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_api_response.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_api_response.go @@ -131,7 +131,7 @@ func (v NullableApiResponse) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableApiResponse) UnmarshalJSON(src []byte) error { @@ -142,4 +142,3 @@ func (v *NullableApiResponse) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go index d3a9679bf034..02cbaaae2463 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_array_of_number_only.go @@ -63,7 +63,7 @@ func (v NullableArrayOfArrayOfNumberOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableArrayOfArrayOfNumberOnly) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableArrayOfArrayOfNumberOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go index 34dfd56be884..dca9e7022ab4 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_of_number_only.go @@ -63,7 +63,7 @@ func (v NullableArrayOfNumberOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableArrayOfNumberOnly) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableArrayOfNumberOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_test_.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_test_.go index 959ec1702dbe..b4566967aaf4 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_test_.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_array_test_.go @@ -131,7 +131,7 @@ func (v NullableArrayTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableArrayTest) UnmarshalJSON(src []byte) error { @@ -142,4 +142,3 @@ func (v *NullableArrayTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_capitalization.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_capitalization.go index 9fa45b1b216f..a4489cc259c5 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_capitalization.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_capitalization.go @@ -234,7 +234,7 @@ func (v NullableCapitalization) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCapitalization) UnmarshalJSON(src []byte) error { @@ -245,4 +245,3 @@ func (v *NullableCapitalization) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go index 8c79d36766a4..952bf040204a 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat.go @@ -113,7 +113,7 @@ func (v NullableCat) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCat) UnmarshalJSON(src []byte) error { @@ -124,4 +124,3 @@ func (v *NullableCat) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat_all_of.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat_all_of.go index af2e351aa803..53da305ec111 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat_all_of.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_cat_all_of.go @@ -63,7 +63,7 @@ func (v NullableCatAllOf) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCatAllOf) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableCatAllOf) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_category.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_category.go index b4e6f0fecd80..f942863971d5 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_category.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_category.go @@ -79,7 +79,7 @@ func (v NullableCategory) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableCategory) UnmarshalJSON(src []byte) error { @@ -90,4 +90,3 @@ func (v *NullableCategory) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_class_model.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_class_model.go index a4d8428053ae..9ac228a5ebad 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_class_model.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_class_model.go @@ -63,7 +63,7 @@ func (v NullableClassModel) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableClassModel) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableClassModel) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_client.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_client.go index b564954b90e4..5d959e49a77e 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_client.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_client.go @@ -63,7 +63,7 @@ func (v NullableClient) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableClient) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableClient) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go index 71c6cf17e2c3..9cf3882d97cc 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog.go @@ -113,7 +113,7 @@ func (v NullableDog) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableDog) UnmarshalJSON(src []byte) error { @@ -124,4 +124,3 @@ func (v *NullableDog) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog_all_of.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog_all_of.go index e7df31a2e4d1..19e817171397 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog_all_of.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_dog_all_of.go @@ -63,7 +63,7 @@ func (v NullableDogAllOf) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableDogAllOf) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableDogAllOf) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_arrays.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_arrays.go index 5944a22e0350..104d4a22b399 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_arrays.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_arrays.go @@ -97,7 +97,7 @@ func (v NullableEnumArrays) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableEnumArrays) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableEnumArrays) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_class.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_class.go index 8271d1de643a..4f97b16b8ef0 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_class.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_class.go @@ -31,13 +31,11 @@ type NullableEnumClass struct { func (v NullableEnumClass) MarshalJSON() ([]byte, error) { switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable case v.ExplicitNull: return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableEnumClass) UnmarshalJSON(src []byte) error { @@ -48,6 +46,3 @@ func (v *NullableEnumClass) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - - - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_test_.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_test_.go index 1dc3c855a55c..426a4bfe9888 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_test_.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_enum_test_.go @@ -283,7 +283,7 @@ func (v NullableEnumTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableEnumTest) UnmarshalJSON(src []byte) error { @@ -294,4 +294,3 @@ func (v *NullableEnumTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file.go index bff1e6aab19f..72ba963d094d 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file.go @@ -64,7 +64,7 @@ func (v NullableFile) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableFile) UnmarshalJSON(src []byte) error { @@ -75,4 +75,3 @@ func (v *NullableFile) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go index 9a4c8d2293fe..6520daf25992 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_file_schema_test_class.go @@ -97,7 +97,7 @@ func (v NullableFileSchemaTestClass) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableFileSchemaTestClass) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableFileSchemaTestClass) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_foo.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_foo.go index 4f8c45e33185..7aed18852c69 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_foo.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_foo.go @@ -63,7 +63,7 @@ func (v NullableFoo) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableFoo) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableFoo) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_format_test_.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_format_test_.go index 48639a972f30..55d40bd04b7c 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_format_test_.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_format_test_.go @@ -471,7 +471,7 @@ func (v NullableFormatTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableFormatTest) UnmarshalJSON(src []byte) error { @@ -482,4 +482,3 @@ func (v *NullableFormatTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go index 6ff753d07448..ba4d6b6bc0fe 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_has_only_read_only.go @@ -97,7 +97,7 @@ func (v NullableHasOnlyReadOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableHasOnlyReadOnly) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableHasOnlyReadOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_health_check_result.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_health_check_result.go index 936c1fc88805..d6b450bb9107 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_health_check_result.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_health_check_result.go @@ -63,7 +63,7 @@ func (v NullableHealthCheckResult) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableHealthCheckResult) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableHealthCheckResult) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object.go index 1dd06726eb5e..051528026698 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object.go @@ -99,7 +99,7 @@ func (v NullableInlineObject) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableInlineObject) UnmarshalJSON(src []byte) error { @@ -110,4 +110,3 @@ func (v *NullableInlineObject) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_1.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_1.go index 9deaf79e09f6..b718912b2705 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_1.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_1.go @@ -100,7 +100,7 @@ func (v NullableInlineObject1) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableInlineObject1) UnmarshalJSON(src []byte) error { @@ -111,4 +111,3 @@ func (v *NullableInlineObject1) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_2.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_2.go index 9db10a658bb4..fe7e129e3f52 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_2.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_2.go @@ -99,7 +99,7 @@ func (v NullableInlineObject2) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableInlineObject2) UnmarshalJSON(src []byte) error { @@ -110,4 +110,3 @@ func (v *NullableInlineObject2) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_3.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_3.go index 17c1a53b2fc1..e840bc4d75c5 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_3.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_3.go @@ -449,7 +449,7 @@ func (v NullableInlineObject3) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableInlineObject3) UnmarshalJSON(src []byte) error { @@ -460,4 +460,3 @@ func (v *NullableInlineObject3) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_4.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_4.go index ec72ab8d1f13..8a17ec87e228 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_4.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_4.go @@ -63,7 +63,7 @@ func (v NullableInlineObject4) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableInlineObject4) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableInlineObject4) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_5.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_5.go index c65df83e7af5..8f4553ae2803 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_5.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_object_5.go @@ -82,7 +82,7 @@ func (v NullableInlineObject5) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableInlineObject5) UnmarshalJSON(src []byte) error { @@ -93,4 +93,3 @@ func (v *NullableInlineObject5) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_response_default.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_response_default.go index 5d974dfc4c6a..9caab8b3791d 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_response_default.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_inline_response_default.go @@ -63,7 +63,7 @@ func (v NullableInlineResponseDefault) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableInlineResponseDefault) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableInlineResponseDefault) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_list.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_list.go index 70b77ab66420..18ef3c182ad8 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_list.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_list.go @@ -63,7 +63,7 @@ func (v NullableList) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableList) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableList) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_map_test_.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_map_test_.go index a0731be78501..f4e3ea57c902 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_map_test_.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_map_test_.go @@ -165,7 +165,7 @@ func (v NullableMapTest) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableMapTest) UnmarshalJSON(src []byte) error { @@ -176,4 +176,3 @@ func (v *NullableMapTest) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go index 4ccc42689a34..1a0d83380c7a 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_mixed_properties_and_additional_properties_class.go @@ -132,7 +132,7 @@ func (v NullableMixedPropertiesAndAdditionalPropertiesClass) MarshalJSON() ([]by return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(src []byte) error { @@ -143,4 +143,3 @@ func (v *NullableMixedPropertiesAndAdditionalPropertiesClass) UnmarshalJSON(src return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_name.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_name.go index b37ee67d2339..6256aa5c2b3e 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_name.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_name.go @@ -147,7 +147,7 @@ func (v NullableName) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableName) UnmarshalJSON(src []byte) error { @@ -158,4 +158,3 @@ func (v *NullableName) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_nullable_class.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_nullable_class.go index 4ab8dfc1c2a8..74d39932b112 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_nullable_class.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_nullable_class.go @@ -438,7 +438,7 @@ func (v NullableNullableClass) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableNullableClass) UnmarshalJSON(src []byte) error { @@ -449,4 +449,3 @@ func (v *NullableNullableClass) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_number_only.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_number_only.go index f7b79fd08aac..db549197413b 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_number_only.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_number_only.go @@ -63,7 +63,7 @@ func (v NullableNumberOnly) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableNumberOnly) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableNumberOnly) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_order.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_order.go index 20c5d9c1384f..b90caa6101ef 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_order.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_order.go @@ -235,7 +235,7 @@ func (v NullableOrder) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOrder) UnmarshalJSON(src []byte) error { @@ -246,4 +246,3 @@ func (v *NullableOrder) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_composite.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_composite.go index 1943fda269f9..cd40b7109882 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_composite.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_composite.go @@ -131,7 +131,7 @@ func (v NullableOuterComposite) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOuterComposite) UnmarshalJSON(src []byte) error { @@ -142,4 +142,3 @@ func (v *NullableOuterComposite) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum.go index c1763b7bd2f7..8e7b562c1e5a 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum.go @@ -31,13 +31,11 @@ type NullableOuterEnum struct { func (v NullableOuterEnum) MarshalJSON() ([]byte, error) { switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable case v.ExplicitNull: return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOuterEnum) UnmarshalJSON(src []byte) error { @@ -48,6 +46,3 @@ func (v *NullableOuterEnum) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - - - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_default_value.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_default_value.go index e19de0cdc500..3305aa215fea 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_default_value.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_default_value.go @@ -31,13 +31,11 @@ type NullableOuterEnumDefaultValue struct { func (v NullableOuterEnumDefaultValue) MarshalJSON() ([]byte, error) { switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable case v.ExplicitNull: return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOuterEnumDefaultValue) UnmarshalJSON(src []byte) error { @@ -48,6 +46,3 @@ func (v *NullableOuterEnumDefaultValue) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - - - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer.go index e80a8e2522e7..2d144b70d55b 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer.go @@ -31,13 +31,11 @@ type NullableOuterEnumInteger struct { func (v NullableOuterEnumInteger) MarshalJSON() ([]byte, error) { switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable case v.ExplicitNull: return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOuterEnumInteger) UnmarshalJSON(src []byte) error { @@ -48,6 +46,3 @@ func (v *NullableOuterEnumInteger) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - - - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer_default_value.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer_default_value.go index 5d1811ef9d74..d72903020944 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer_default_value.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_outer_enum_integer_default_value.go @@ -31,13 +31,11 @@ type NullableOuterEnumIntegerDefaultValue struct { func (v NullableOuterEnumIntegerDefaultValue) MarshalJSON() ([]byte, error) { switch { - case v.ExplicitNull && v.Value != "": - return nil, ErrInvalidNullable case v.ExplicitNull: return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableOuterEnumIntegerDefaultValue) UnmarshalJSON(src []byte) error { @@ -48,6 +46,3 @@ func (v *NullableOuterEnumIntegerDefaultValue) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - - - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_pet.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_pet.go index bbd29397b4cb..0986a6740662 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_pet.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_pet.go @@ -198,7 +198,7 @@ func (v NullablePet) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullablePet) UnmarshalJSON(src []byte) error { @@ -209,4 +209,3 @@ func (v *NullablePet) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_read_only_first.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_read_only_first.go index 3b9b68414c0b..24f821d7bdf4 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_read_only_first.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_read_only_first.go @@ -97,7 +97,7 @@ func (v NullableReadOnlyFirst) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableReadOnlyFirst) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableReadOnlyFirst) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_return.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_return.go index 4d5af7cda2b8..c5b2d1aaeccc 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_return.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_return.go @@ -63,7 +63,7 @@ func (v NullableReturn) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableReturn) UnmarshalJSON(src []byte) error { @@ -74,4 +74,3 @@ func (v *NullableReturn) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_tag.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_tag.go index 885ba363bd2c..f50a11101e43 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_tag.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_tag.go @@ -97,7 +97,7 @@ func (v NullableTag) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableTag) UnmarshalJSON(src []byte) error { @@ -108,4 +108,3 @@ func (v *NullableTag) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } - diff --git a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_user.go b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_user.go index 1b280a841ce8..dc7234de91b5 100644 --- a/samples/openapi3/client/petstore/go-experimental/go-petstore/model_user.go +++ b/samples/openapi3/client/petstore/go-experimental/go-petstore/model_user.go @@ -302,7 +302,7 @@ func (v NullableUser) MarshalJSON() ([]byte, error) { return []byte("null"), nil default: return json.Marshal(v.Value) - } + } } func (v *NullableUser) UnmarshalJSON(src []byte) error { @@ -313,4 +313,3 @@ func (v *NullableUser) UnmarshalJSON(src []byte) error { return json.Unmarshal(src, &v.Value) } -