commercetools / commercetools-sdk-typescript

The e-commerce SDK from commercetools for JavaScript written in TypeScript.
https://commercetools.github.io/commercetools-sdk-typescript/
MIT License
45 stars 25 forks source link

`source` not present in EventBridge subscription response type #773

Open Tohaker opened 1 month ago

Tohaker commented 1 month ago

Describe the bug When creating or getting a subscription with sdk-client-v2 that targets EventBridge, the response has the source property under destination but the type omits this field.

To Reproduce Observe the types in https://github.com/commercetools/commercetools-sdk-typescript/blob/master/packages/platform-sdk/src/generated/models/subscription.ts#L254

Expected behavior The source field should be string | undefined

Screenshots/Code snippet

const subscription = await client.requestBuilder
    .subscriptions()
    .withKey({ key })
    .get()
    .execute();

  if (
    subscription.statusCode === 200 &&
    subscription.body.destination.type === "EventBridge"
  ) {
    // @ts-ignore The EventBridge destination has a source field
    return subscription.body.destination.source as string;
  }

Stack information (please complete the following information):

jenschude commented 1 month ago

The field source is not documented and should not be used.

https://docs.commercetools.com/api/projects/subscriptions#eventbridgedestination

Tohaker commented 1 month ago

It is documented here. https://docs.commercetools.com/tutorials/subscriptions-eventbridge#configure-an-event-source-by-setting-up-a-subscription

jenschude commented 1 month ago

Oh nice catch. I will forward it to the respective team if it should be public and then be documented or not.