You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run perl test.pl with all the necessary modules installed. You will get the following error message:
Can't call method "from_hash" on an undefined value at lib/WWW/SwaggerClient/Object/Pet.pm
The reason this problem doesn't come up in the normal test is because all the necessary objects are included as part of the test. This means, in order to use a perl client generated by swagger, you would need to require the end-user to include both the object and all the object's property dependencies transitively. That hardly seem reasonable.
Suggest a fix/enhancement
In the "use" block there should be a bundle of lines that refers to all the datatypes, like use {{moduleName}}::Object::{{datatype}} for each datatype. That way, when the eval is called the $_instance variable won't be undefined. Please make sure to handle ARRAY properties correctly, as well.
The text was updated successfully, but these errors were encountered:
Description
When I have nested objects in a perl client, it doesn't work correctly. I get an error on deserialization:
This happens whenever the type is "number" or when I use a referenced object type. This issue is about the latter case.
Swagger-codegen version
2.2.3
Swagger declaration file content or url
This happens in the PetStore example, and I use that in this test case.
Steps to reproduce
Save this file as
test.pl
in the samples directory.Run
perl test.pl
with all the necessary modules installed. You will get the following error message:The reason this problem doesn't come up in the normal test is because all the necessary objects are included as part of the test. This means, in order to use a perl client generated by swagger, you would need to require the end-user to include both the object and all the object's property dependencies transitively. That hardly seem reasonable.
Suggest a fix/enhancement
In the "use" block there should be a bundle of lines that refers to all the datatypes, like
use {{moduleName}}::Object::{{datatype}}
for eachdatatype
. That way, when the eval is called the$_instance
variable won't be undefined. Please make sure to handle ARRAY properties correctly, as well.The text was updated successfully, but these errors were encountered: