-
Notifications
You must be signed in to change notification settings - Fork 116
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
How to use api-codegen-preset in checkout UI extensions? #1081
Comments
Hi @nboliver-ventureweb, what version of api-codegen-preset are you using? |
We are closing this issue because we did not hear back regarding additional details we needed to resolve this issue. If the issue persists and you are able to provide the missing clarification we need, feel free to respond and reopen this issue. We appreciate your understanding as we try to manage our number of open issues. |
@nboliver-ventureweb were you able to fix it? |
@matteodepalo I'm not sure what version it was, it would have been the latest version out when this ticket was created. I have since removed it from the project because it wasn't working. @pinktonio No, I haven't had a chance to revisit it, but would be keen to get it working! |
I tried multiple versions. 1.0.1, 1.0.0 and 0.0.7 but couldn't get it to work. It couldn't find any of my |
Did you try adding the extension |
@matteodepalo Yes I did. I finally got it to work by using the |
I had the same issue, but I was able to resolve it. I hope this helps others as well. // .graphqlrc.ts
import {ApiType, shopifyApiProject} from '@shopify/api-codegen-preset';
export default {
schema: 'https://shopify.dev/admin-graphql-direct-proxy',
documents: ['src/graphql/*.ts'], // This doesn't work
projects: {
default: shopifyApiProject({
apiType: ApiType.Admin,
apiVersion: '2024-10',
outputDir: './types',
documents: ['src/graphql/*.ts'], // This configuration works
}),
documents: ['src/graphql/*.ts'], // This doesn't work
},
}; This is my configuration file. One thing to be careful about is that you need to include documents within // src/graphql/query.ts
export const SHOP_QUERY = /* GraphQL */ `
query Shop {
shop {
name
}
}
`; This is the query I wrote. There is another important thing to note here: you must use |
Glad you hear that you've solved this! I'm going to close this issue then. |
@ujike-ryota Thanks for providing that code example. I'll try implementing the same way 🤞 @matteodepalo Given that the working configuration differs from what it listed in the @shopify/api-codegen-preset docs, perhaps it would be helpful to add some specific documentation to this repo in the hopes of making the setup easy for others to figure out? |
@nboliver-ventureweb good point, I'll reopen this so that we can keep track of the change to the docs. |
Is it possible to use api-codegen-preset within a checkout UI extension? I tried setting it up according to the docs, but it didn't work.
Here is the .graphqlrc.ts:
Here is the output:
Am I missing something, or does it not work in a UI extension?
I double checked the paths were correct.
I confirmed the query was named:
The text was updated successfully, but these errors were encountered: