yeah the SDL schema is bad, its not generated programatically - and appears to contain other errors.
There are plenty of tools that can create an SDL from an introspection JSON though. If you even need to create the SDL. If you’re using TS/JS and are looking for the schema for purposes of autocomplete with the LSP then something like below works.
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
import { config as initEnv } from "dotenv";
import type { IGraphQLConfig } from "graphql-config";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
initEnv({ path: resolve(__dirname, ".env.local") });
const config: IGraphQLConfig = {
projects: {
monday: {
schema: [
{
"https://api.monday.com/v2/": {
headers: {
Authorization: process.env.MONDAY_ACCESS_TOKEN as string,
},
},
},
],
documents: ["packages/**/*.{ts,mts,js,mjs,jsx,tsx,graphql}"],
},
},
};
export { config as defaultGraphQLConfig };
export default config;
Or if you want to use codegen to create Typescript types for example:
import type { CodegenConfig } from "@graphql-codegen/cli";
import { config as initEnv } from "dotenv";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
initEnv({ path: resolve(__dirname, ".env.local") });
const config: CodegenConfig = {
schema: [
{
"https://api.monday.com/v2/": {
headers: {
Authorization: process.env.MONDAY_ACCESS_TOKEN as string,
},
},
},
],
generates: {
"./src/types/monday-api-stable.ts": {
plugins: ["typescript"],
},
},
};
export default config;
You can update the headers to include the API-Version as well and get them specifically. You could also use any other codegen plugins to generate things you might need.