-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse saleor schema version and add it to context #339
Conversation
🦋 Changeset detectedLatest commit: 6e59049 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
import { AppManifest } from "../../types"; | ||
|
||
export type CreateManifestHandlerOptions = { | ||
manifestFactory(context: { | ||
appBaseUrl: string; | ||
request: NextApiRequest; | ||
schemaVersion: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think it should fallback to zero. I think it should be number | null
. If field is not supported, then its not supported. No need for ambiguous values
@@ -149,4 +150,27 @@ describe("processAsyncSaleorWebhook", () => { | |||
}) | |||
).rejects.toThrow("Request signature check failed"); | |||
}); | |||
|
|||
it("Fallback to 0 if saleor-schema-version header is missing", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add test for parsing correct value
import { AppManifest } from "../../types"; | ||
|
||
export type CreateManifestHandlerOptions = { | ||
manifestFactory(context: { | ||
appBaseUrl: string; | ||
request: NextApiRequest; | ||
schemaVersion: number | null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non blocking; you can add comment (jsdoc) mentioning here that null means <3.15
IDEs are using comments for hints
Released snapshot build with Install it with pnpm add @saleor/[email protected] |
|
Parse the
saleor-schema-version
header and include the parsed version in the contexts ofcreateHandler
andwebhookFactory
. If the header is absent (Saleor version below 3.15), the version will default to 0.Connected RFC.