This repository was archived by the owner on Dec 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Fix invalid schema and typos in graphql-config #54
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6dc5108
Fix typo in package.json exports in graphq-config
IzumiSy 89173e6
Kind.DOCUMENT as const
IzumiSy 86a5ffc
Add test for schemaDefinition
IzumiSy 85b981f
Fix invalid extraction of custom operation schema
IzumiSy 51affbe
Fix lint errors
IzumiSy a616d99
Revert changes in constraint.graphql
IzumiSy 90af572
Use @graphql-tools/merge
IzumiSy 13f248f
Use buildASTSchema to test schema
IzumiSy 90d8382
Skip schema.test.ts for now
IzumiSy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| declare module "*.graphql" { | ||
| const Document: import("graphql").DocumentNode; | ||
| const Document: string; | ||
| export default Document; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { buildASTSchema } from "graphql"; | ||
| import { schemaDefinition } from "./schema"; | ||
|
|
||
| describe.skip("schemaDefinition", () => { | ||
| it("should be buildable", () => { | ||
| expect(buildASTSchema(schemaDefinition)).not.toThrow(); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,18 @@ | ||
| import { DocumentNode, Kind } from "graphql"; | ||
| import { parse } from "graphql"; | ||
| import { mergeTypeDefs } from "@graphql-tools/merge"; | ||
| import CommonSchema from "./schema/common.graphql"; | ||
| import ViewDirectiveSchema from "./schema/view.graphql"; | ||
| import FormDirectiveSchema from "./schema/form.graphql"; | ||
| import ConstraintSchema from "./schema/constraint.graphql"; | ||
|
|
||
| const mergeDocumentNodes = (docs: DocumentNode[]) => ({ | ||
| kind: Kind.DOCUMENT, | ||
| definitions: docs.flatMap((doc) => doc.definitions), | ||
| }); | ||
|
Comment on lines
-7
to
-10
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Found that merging like this is not working as expected, so now here is using use |
||
| const parseStringSchemas = (rawDefinition: string[]) => | ||
| rawDefinition.map((def) => parse(def)); | ||
|
|
||
| export const schemaDefinition = mergeDocumentNodes([ | ||
| CommonSchema, | ||
| ViewDirectiveSchema, | ||
| FormDirectiveSchema, | ||
| ConstraintSchema, | ||
| ]); | ||
| export const schemaDefinition = mergeTypeDefs( | ||
| parseStringSchemas([ | ||
| CommonSchema, | ||
| ViewDirectiveSchema, | ||
| FormDirectiveSchema, | ||
| ConstraintSchema, | ||
| ]), | ||
| ); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to remove
skiphere when I work on #56.