diff --git a/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache b/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache index 62c00930baa..47fe46dcb28 100644 --- a/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache +++ b/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache @@ -111,6 +111,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm index 5bfd2561c17..5c2e9307faa 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AllOfWithSingleRef.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AllOfWithSingleRef.pm index e0b67ee9957..0a57730d257 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AllOfWithSingleRef.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AllOfWithSingleRef.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm index 19935a5a67b..a757b284e30 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm index 82724eea0ed..3000b9d6d53 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm index ef86dfd227f..4fdc48339ab 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm index d94cc4fa339..0b57da9f12b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm index bc9709867d2..afe2349c045 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm index f325e1957e1..f42063375c3 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm index c54a69e9875..cde97e88819 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm @@ -161,6 +161,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/CatAllOf.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/CatAllOf.pm index 406e840c19f..311f549abc0 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/CatAllOf.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/CatAllOf.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm index e3afa3ab932..f10dd9a33a6 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm index f30461a570c..2223cd047bf 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm index 41884d9766d..dd092c96356 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DeprecatedObject.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DeprecatedObject.pm index f1cea97088a..a38312f0641 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DeprecatedObject.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DeprecatedObject.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm index 75c1ec4b120..96ba8329f5b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm @@ -161,6 +161,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DogAllOf.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DogAllOf.pm index 91a7955661a..7215d703f46 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DogAllOf.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DogAllOf.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm index d643ec1c312..eeaa2820f8d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm index de44e861e1f..7f1c21376ac 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm index 44309f3b798..7365ea1180d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm @@ -155,6 +155,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm index b1f2fabb439..3635691c470 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm index 6db1af4d32c..83abbe603a2 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm index 0f46ea56d7a..9d2fddd95cd 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm index 58b68406407..d67c0207c82 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm index 86502821293..e107e0697e0 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm index b4d3279295a..cfea73981da 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm index 3597ad7910d..6899aeb0119 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm index 4079df60b5d..6c993449c53 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm index 6e1eef560a4..00659865491 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm index 14b36c0b9d3..b39798d87ec 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm index bf5e8982fdb..8dd6bbecc47 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm index 830cd139e25..19170e5806a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm index 98bc8cb8e5d..fe693fb563d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm index ecff0012613..e83d3d247ea 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm index e68bf9c2578..285b49d5f24 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ObjectWithDeprecatedFields.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ObjectWithDeprecatedFields.pm index b1645a4c9d5..52fddf1b0e3 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ObjectWithDeprecatedFields.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ObjectWithDeprecatedFields.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm index 6420432525d..546fa99bd5e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm index c41a1bf7165..bd556a015ae 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm index b891f0e7c46..dcaf89b59b5 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm index 28aa622afe0..de637b622ce 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm index 7c501836251..8ea3c91dba3 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm index c2e3b5bff31..4e2d7f322d1 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm index 54e2310624d..aa593caa74e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm @@ -152,6 +152,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm index c94165e2837..4d8e35e755f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm @@ -153,6 +153,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm index 23f5d6e6863..f3eaa616cb3 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SingleRefType.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SingleRefType.pm index a2d098a691b..6840aa6a3c6 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SingleRefType.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SingleRefType.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm index 5814b31aae9..a392080eef8 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm index 2e220492dc0..a1aa0ab4055 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm index f46fab05d56..5f750981a4d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm @@ -151,6 +151,8 @@ sub _to_json_primitives { return $data->rfc3339; } return $data .q(); + } else { # hash (model), In this case, the TO_JSON of the $data object is executed + return $data; } } diff --git a/samples/client/petstore/perl/tests/02_store_api.t b/samples/client/petstore/perl/tests/02_store_api.t index 36e54ed12f8..188471ec3e2 100644 --- a/samples/client/petstore/perl/tests/02_store_api.t +++ b/samples/client/petstore/perl/tests/02_store_api.t @@ -1,4 +1,4 @@ -use Test::More tests => 52; +use Test::More tests => 56; use Test::Exception; use lib 'lib'; @@ -170,4 +170,18 @@ like $order_to_json, qr/2020-11-06T09:20:48Z/, '$order{shipDate} to date-time fo like $order_to_json, qr/"101112"/, '$order{status} is number. But json type is string'; -like $order_to_json, qr/false/, '$order{complete} is number. But json type is boolean'; \ No newline at end of file +like $order_to_json, qr/false/, '$order{complete} is number. But json type is boolean'; + +my $pet_object = WWW::OpenAPIClient::Object::Pet->new->from_hash({ + tags => [ + WWW::OpenAPIClient::Object::Tag->new->from_hash({id => 123, name => 1000}), + WWW::OpenAPIClient::Object::Tag->new->from_hash({id => 456, name => 'test2'}), + ] +}); + + +my $pet_object_to_json = JSON->new->convert_blessed->encode($pet_object); +like $pet_object_to_json, qr/\"id\":123/, '$pet_object->tags->[0]->id'; +like $pet_object_to_json, qr/\"name\":\"1000\"/, '$pet_object->tags->[0]->name'; +like $pet_object_to_json, qr/\"id\":456/, '$pet_object->tags->[1]->id'; +like $pet_object_to_json, qr/\"name\":\"test2\"/, '$pet_object->tags->[1]->name'; \ No newline at end of file