ebay-api icon indicating copy to clipboard operation
ebay-api copied to clipboard

The InventoryItem type does not match.

Open naotoman opened this issue 1 year ago • 2 comments

  • [x] Are you running the latest version?
  • [x] Have you included sample input, output, error, and expected output?
  • [x] Have you checked if you are using correct configuration?

Describe the bug

In the createOrReplaceInventoryItem function, the type of the aspects in the body argument is set to string, but assigning a string causes it to fail. However, it succeeded when I passed an object directly.

Code

await client.sell.inventory.createOrReplaceInventoryItem("testSku", {
  availability: {
    shipToLocationAvailability: {
      quantity: 1,
    },
  },
  condition: "USED_EXCELLENT",
  product: {
    title: "test title",
    description: "test description",
    imageUrls: ["https:/xxx.com/example.jpg"],
    aspects: JSON.stringify({ Type: ["Action Figure"] }),
    // When I changed the aspects as below with @ts-ignore marker, it succeeded.
    // @ts-ignore
    // aspects: { Type: ["Action Figure"] }
  },
});

Output

The following is part of the error output.

errorCode: 2004,
  firstError: {
    errorId: 2004,
    domain: 'ACCESS',
    category: 'REQUEST',
    message: 'Invalid request',
    longMessage: 'The request has errors. For help, see the documentation for this API.',
    parameters: [
      {
        name: 'reason',
        value: 'Could not serialize field [product.aspects]'
      }
    ]
  }

Would you like to work on this issue?

  • [ ] Yes
  • [ ] No
  • [x] Maybe

naotoman avatar Oct 10 '24 13:10 naotoman

The TS Definition is based on eBay Open-API. Either this is a new version or the eBay Open-API is not correct. Thank you for reporting, I will check it. For now, I would ignore the error.

dantio avatar Oct 10 '24 17:10 dantio

Ah, I understand now. Thank you.

naotoman avatar Oct 11 '24 02:10 naotoman

@naotoman The latest sell inventory api version 1.18.0 also does not fix this problem. I'll close this issue for now otherwise I have to monkey patch the generated type...

dantio avatar Dec 20 '24 22:12 dantio