From b21c06fea77a1105567a73c6811b624772e7387d Mon Sep 17 00:00:00 2001 From: Lukasz Ostrowski Date: Mon, 4 Sep 2023 09:44:10 +0200 Subject: [PATCH 1/2] Mark query in manifest required --- .changeset/tender-news-do.md | 9 +++++++++ src/types.ts | 13 +++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .changeset/tender-news-do.md diff --git a/.changeset/tender-news-do.md b/.changeset/tender-news-do.md new file mode 100644 index 00000000..63f77a4c --- /dev/null +++ b/.changeset/tender-news-do.md @@ -0,0 +1,9 @@ +--- +"@saleor/app-sdk": patch +--- + +In AppManifest, webhook query field is not required. Saleor rejects empty query, so Manifest was wrong before with with field optional + +This is technically a breaking change, but app without a query specified couldn't be installed in Saleor. + +Now Typescript will early show the error diff --git a/src/types.ts b/src/types.ts index f38fbcca..927d108d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -213,8 +213,17 @@ export interface WebhookManifest { name: string; asyncEvents?: AsyncWebhookEventType[]; syncEvents?: SyncWebhookEventType[]; - /** If query is not provided, the default webhook payload will be used */ - query?: string; + /** + * Query is required for a subscription. + * If you don't need a payload, you can provide empty query like this: + * + * subscription { + * event { + * __typename + * } + * } + */ + query: string; /** The full URL of the endpoint where request will be sent */ targetUrl: string; isActive?: boolean; From f7dedcea92008c2d36f6c619479b49482ef84c5b Mon Sep 17 00:00:00 2001 From: Lukasz Ostrowski Date: Wed, 6 Sep 2023 09:11:17 +0200 Subject: [PATCH 2/2] Update tender-news-do.md --- .changeset/tender-news-do.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.changeset/tender-news-do.md b/.changeset/tender-news-do.md index 63f77a4c..fe4960a3 100644 --- a/.changeset/tender-news-do.md +++ b/.changeset/tender-news-do.md @@ -2,8 +2,10 @@ "@saleor/app-sdk": patch --- -In AppManifest, webhook query field is not required. Saleor rejects empty query, so Manifest was wrong before with with field optional +Changed the "query" field in the AppManifest webhook to be required. Previously, this field was optional. -This is technically a breaking change, but app without a query specified couldn't be installed in Saleor. +For subscription events, Saleor rejects webhooks without query, so this field was valid only with legacy non-subscription webhooks. -Now Typescript will early show the error +Now, the query is obligatory. + +Warning: This can be a breaking change for some scenarios where legacy webhooks were used!