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
Currently, to maintain type-safety, developers are encouraged to define the payload from the API, which should ideally be imported from the generated GraphQL code. However, locating and extracting this generated code can be a tedious process.
Describe a proposed solution
Smart solution and better DX with pregenerated code inside saleor-app-sdk
Since saleor-app-sdk is built against a specific version of Saleor, please generate the generated GraphQL code as part of saleor-app-sdk and allow direct import like import { OrderPayload } from "@saleor/app-sdk/handlers/payloads";
If payload from API means the query field of the webhook and is hard to pregen and bake into saleor-app-sdk then at least the lazy solution (below) would already improve DX somewhat.
Lazy solution - a faster way to read Saleor's doc and build a webhook:
Please provide a link to a page where it describes what is the most common, easiest and fastest way to get the generated GraphQL code and where I can find the type-safe ready-for-import TS code within the generated GraphQL code.
The text was updated successfully, but these errors were encountered:
Hey, as I little written here I don't think app-sdk is a good place to do that. It will introduce a circular dependency - App SDK needs app, to provide a generated queries, but App needs SDK to generate schemas from them
I understand its not perfect at the moment - you need to provide the fragment manually and its not runtime safe (however graphQL should be enough IMO).
But the fact that every app defines its unique set of queries, subscriptions, mutations - we can't pre-build them in sdk
You can modify you graphql codegen config and use package like this to ensure runtime safety
What I'm trying to achieve
Build a Saleor app with webhooks.
Problem Statement
Currently, to maintain type-safety, developers are encouraged to define the payload from the API, which should ideally be imported from the generated GraphQL code. However, locating and extracting this generated code can be a tedious process.
Describe a proposed solution
Smart solution and better DX with pregenerated code inside saleor-app-sdk
Since
saleor-app-sdk
is built against a specific version of Saleor, please generate thegenerated GraphQL code
as part ofsaleor-app-sdk
and allow direct import likeimport { OrderPayload } from "@saleor/app-sdk/handlers/payloads";
If
payload from API
means thequery
field of the webhook and is hard to pregen and bake intosaleor-app-sdk
then at least the lazy solution (below) would already improve DX somewhat.Lazy solution - a faster way to read Saleor's doc and build a webhook:
Please provide a link to a page where it describes what is the most common, easiest and fastest way to get the
generated GraphQL code
and where I can find the type-safe ready-for-import TS code within thegenerated GraphQL code
.The text was updated successfully, but these errors were encountered: