Skip to content

Conversation

@damian-rakus
Copy link
Collaborator

@damian-rakus damian-rakus commented Dec 29, 2025

This PR adds support for multiple GraphQL "projects" for code-generation. Thanks to that, we are able to reference experimental endpoints from 'dev' schema. All queries referencing dev schema must be in file with file extension graphql-dev.ts.

The goal is to have 1 default client (based on stable/current version) and 1 dev client for experimental features.

"watch": "rollup -c -w",
"fetch:schema": "bash fetch-schema.sh",
"codegen": "graphql-codegen",
"codegen": "graphql-codegen --config codegen.yml && graphql-codegen --config codegen.yml --project dev",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means you will alwasy have to fix dev together with regular, I suggest makig it separate command that does both so if dev breaks (and I think it will) but you try to coedegene for the happy flow that is not dev you wont have bugs of otehr people to solve

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, parametrized fetching schema, codegen and fetch+codegen able to process only specific schemas (or both by default)


export const getFilteredToolInstances = (
instanceOptions: { apiClient: ApiClient; apiToken: string; context?: MondayApiToolContext },
instanceOptions: { apiClient: ApiClient; devApiClient: ApiClient; apiToken: string; context?: MondayApiToolContext },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use the latest version of the api client package, there is param that allows you to pass version, so I think if a tool expects to be on dev version which is irregular it can be marked somhow or just directly pass the param, passingm multiple client can be problematic lets say we want now 3 different versions...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's amazing, it makes it even simpler. I was not aware we can override version in the .request() method, thanks for that 👑

schema: 'src/monday-graphql/schema.graphql'
documents:
- 'src/**/*.graphql.ts'
- '!src/**/*.graphql-dev.ts'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need it? it looked into it by default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not as it does not match the pattern but I wanted to be explicit

- node -e "const fs = require('fs'); fs.writeFileSync('src/monday-graphql/generated/graphql/index.ts', '/* eslint-disable */\nexport * from \'./gql\';');"
dev:
schema: 'src/monday-graphql/schema-dev.graphql'
documents: 'src/**/*.graphql-dev.ts'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wdyt about graphql.dev instead? idk actaully whatever you want :)

Copy link
Collaborator Author

@damian-rakus damian-rakus Dec 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me, I'll adjust

@damian-rakus damian-rakus merged commit 658b118 into master Dec 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants