inakiabt / etsy-php

Etsy API wrapper for PHP
74 stars 59 forks source link

added support for param type stringJSON #27

Closed kievins closed 7 years ago

kievins commented 7 years ago

Etsy API method "updateInventory" requires params to be passed with type "stringJSON". This commit ads support for this param type in etsy-php RequestValidator. Previously trying to PUT product inventory like described here resulted in validation error.

inakiabt commented 7 years ago

👍 Can you add a test? I'll merge this after that. Thanks.

kievins commented 7 years ago

I tried coding the tests for this param type, but I ran into issues with how JSON params are coded and validated in general. The way the data array with JSON is structured makes it impossible to assertEqual because the validation intentionally converts this: [products] => Array ( [json] => [1,2,3] ) to this: Array ( [products] => [1,2,3] )

The later being the required format for Etsy API. Can you comment on why the JSON params are structured the way they are?

kievins commented 7 years ago

Hey, I modified the validation function as well as created tests.