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
Can you please add itemIdentification, resourceId and resourceIdentifier fields to InvalidInputError type? Errors only contains code and message, where as Commercetools API includes itemIdentification, resourceId and resourceIdentifier fields on errors section.
Trying to implement an API that returns a validation error message type (not message) on API response. You can test it on add line item to my cart by setting line item sku as an invalid one.
CT API Response
{
"statusCode": 400,
"message": "LineItem error: No published product with an sku 'invalidSKU' exists.",
"errors": [
{
"code": "InvalidInput",
"message": "LineItem error: No published product with an sku 'invalidSKU' exists.",
"itemIdentification": {
"sku": "invalidSKU",
"type": "LineItemSkuIdentification"
},
"resourceId": "xxxxx",
"resourceIdentifier": "cart"
}
]
}
CT TS SDK Response [{"code":"InvalidInput","message":"No published product with an sku 'invalidSKU' exists."}]
The text was updated successfully, but these errors were encountered:
The issue comes from the fact that the InvalidInput error is a quite generic one. And according to the docs no additional fields are specified. And as we don't have a formal specification of the fields we can't rely on them being in the response and implement them in the SDKs.
You should be able to access any key of the InvalidInputError but you will not get back a type safe object:
Thanks for this great library, helps a lot.
Can you please add
itemIdentification
,resourceId
andresourceIdentifier
fields toInvalidInputError
type? Errors only contains code and message, where as Commercetools API includesitemIdentification
,resourceId
andresourceIdentifier
fields on errors section.Trying to implement an API that returns a validation error message type (not message) on API response. You can test it on add line item to my cart by setting line item sku as an invalid one.
CT API Response
CT TS SDK Response
[{"code":"InvalidInput","message":"No published product with an sku 'invalidSKU' exists."}]
The text was updated successfully, but these errors were encountered: