Skip to content

Commit d8b4be6

Browse files
authored
LeetCode GraphQL: fully use core graphql for printing the schema (#373)
This allows deleting several files. The new approach fails to print non-scalar default values, but other than that it's the same output as the old schema. Will bring this back in another commit.
1 parent 34b5626 commit d8b4be6

8 files changed

+168
-196
lines changed

workspaces/leetcode-api/schema.graphql

Lines changed: 12 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

workspaces/leetcode-api/src/fetchGraphQLTypeInformation.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { z } from "zod";
22

33
import { graphqlKindTypeZodType } from "@code-chronicles/util/graphqlKindTypeZodType";
4+
import { isStringEmptyOrWhitespaceOnly } from "@code-chronicles/util/isStringEmptyOrWhitespaceOnly";
45
import {
56
type OptionalInsteadOfNullishValues,
67
removeKeysWithNullishValues,
@@ -119,7 +120,12 @@ const innerTypeZodType = innerTypeZodTypeBase
119120

120121
const nameAndDescriptionZodType = z.strictObject({
121122
name: z.string(),
122-
description: z.string().nullable(),
123+
description: z
124+
.string()
125+
.nullable()
126+
.transform((desc) =>
127+
desc != null && !isStringEmptyOrWhitespaceOnly(desc) ? desc : undefined,
128+
),
123129
});
124130

125131
export const graphqlTypeZodType = z.record(

workspaces/leetcode-api/src/graphql-extraction/outputGraphQLDeprecatedDirective.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

workspaces/leetcode-api/src/graphql-extraction/outputGraphQLElementWithDescription.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)