-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix array/object types #20
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey thanks! :)
I have added some suggestions to this before it should be merged
if($pdetails['items']) { | ||
$parameter['items']=$pdetails['items']; | ||
}else if ($pdetails['properties']) { | ||
$parameter['properties']=$pdetails['properties']['rendered']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this make sense to you? I see properties.raw and properties.rendered on some woocommerce endpoints. I just decided to keep the rendered as there appears to be more information. Works for my cases.
'properties'=> $prop['items']['properties'] | ||
); | ||
if($prop['type']=='array' && !$prop['items']){ | ||
$prop['items']=array('type'=>'string'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed I was effectively assigning this property to itself...the property items are already set, they were just overriding themselves to string. This works as a fallback in this manner I believe.
Previously all array and object types defaulted to strings. This should instead look at the array/object item's type and (if the item is an object) all the properties within that item. I've tested it against two levels deep of arrays of objects and it seems to work correctly now.