-
-
Notifications
You must be signed in to change notification settings - Fork 19
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
Feature: Add support for custom GraphQL scalars @gql(scalars: { website: "AWSURL" })
#88
Comments
Possibly yes, but would need to find the right syntax... There is already a custom notation in place (not documented yet) that allows customising the generated GraphQL schema. /// @gql(queries: { list: null, count: "countyPosts" }, fields: { text: null }, subscriptions: null)
model Post {
text String?
urlPhoto String?
} The above notation equals to:
One option could be: /// @gql(scalars: { urlPhoto: "AWSURL" })
model Post {
urlPhoto String?
} Implementing the above would be quite simple, as the code to read the What do you think? |
I think that makes sense yes! Until documentation gets written, is there a way to know where exactly the code involving that custom notation is in place? |
Parsing the prisma-appsync/packages/generator/src/compiler.ts Lines 367 to 375 in 37b4a68
The following is the config object where to add prisma-appsync/packages/generator/src/compiler.ts Lines 393 to 406 in 37b4a68
Here is where the check to ignore fields is done: prisma-appsync/packages/generator/src/compiler.ts Lines 544 to 567 in 37b4a68
For example, we could do: const scalar = gqlConfig?._scalars?.[field.name] || this.getFieldScalar(field) |
@Tenrys do you want to work on a PR for this feature? |
@gql(scalars: { website: "AWSURL" })
Will be released as part of |
Right now it seems like only fields that are named
url
oremail
have been hardcoded to use theAWSURL
andAWSEmail
scalar types from AWS, however I would like to be able to use these types on fields likeurlPhoto
or something likesecondaryEmail
.As seen here:
prisma-appsync/packages/generator/src/compiler.ts
Lines 859 to 868 in 37b4a68
Would it be possible to use triple slash comments in the Prisma schema to define which fields turn up as what scalar types in the GraphQL schema?
The text was updated successfully, but these errors were encountered: