-
Notifications
You must be signed in to change notification settings - Fork 344
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
strictScalars and scalars map for graphql source codegen #3508
Comments
Perhaps it make make things a little more future-proof if the graphql source config block just forwarded a codegen config block onto graphql-codegen directly, e.g.: sources:
- name: MyGraphQLApi
handler:
graphql:
endpoint: http://my-service-url:3000/graphql
operationHeaders:
Authorization: Bearer {env.MY_API_TOKEN}
codegen:
scalars:
ScalarTypeA: string
ScalarTypeB: number
strictScalars: true |
You can add custom codegen config like below; codegen:
scalars:
... |
Hi. That works for the types emitted for the meshed schema, but it doesn't emit config for the source schemas. e.g. say in my source schema there is codegen:
scalars:
DateTime: string then in the emitted // at the top of the file
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
DateTime: string; // <-- looks good
}
// lower down in the file
namespace MySourceTypes {
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
DateTime: any; // <-- uh oh
}
} If I try to add a |
For now, it is not possible to configure InContext SDK type generation. |
Is your feature request related to a problem? Please describe.
I am stitching together several graphql sources. They define custom scalar types, and I would like to be able to tell the codegen process what the equivalent typescript type should be for those scalars via the scalars map as documented here.
I would then additionally like to be able to enable the strictScalars flag so that the build process fails if I haven't provided a Typescript mapping for a scalar.
Describe the solution you'd like
I guess this would make sense in the source config:
Describe alternatives you've considered
Leaving it as it is, which applies the type
any
to any unknown scalar. This isn't great as it will lead to bugs.The text was updated successfully, but these errors were encountered: