open-api
open-api copied to clipboard
[BUG]: createDraftListing returns array
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the bug
When I called createDraftListing, the response I got was a JSON object inside an array:
[{"path":"\/title\/1","type":"invalid_characters","message":"contains invalid characters"}]
I'm not sure why the response was an array instead of just a normal object.
Steps to reproduce
quantity=1&title=gepr%C3%83%C2%83%C3%82%C2%A4gter%20Ring%20aus%20Silber%20mit%20graviertem%20Bernstein&description=%5Bempty%20description%5D&price=10.00&who_made=i_did&when_made=made_to_order&taxonomy_id=1&shipping_profile_id=182228598289
Expected behavior
A response like this:
{"error":"contains invalid characters"}
UPDATE:
A better response:
{"error":"unable to update listing","error_list":[{"path":"\/title\/1","type":"invalid_characters","message":"contains invalid characters"}]}
Additional context
No response
As a side question... why did the title fail?
- The return is an array because we return more information than just a single error message in some cases.
- The title failed because it has characters in it that our system does not allow. When the url is decoded, the title becomes an unreadable string of unicode characters.
What endpoints return error arrays instead of error objects? The default behavior for every error I've received in the past was an object. Because an array response breaks code/the standard, I think the API docs should label which give an array of errors.
What do you think of a response like this:
{"error":"unable to update listing","error_list":[{"path":"\/title\/1","type":"invalid_characters","message":"contains invalid characters"}]}