Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gatsby): Allow printing type definitions to file (schema lock-do…
…wn) (#16291) * Allow printing type definitions to file * Fix docs * Remove debug * Cleanup * Fix Loki dejavu
- Loading branch information
1 parent
90a345e
commit 23a460a
Showing
9 changed files
with
849 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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 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
171 changes: 171 additions & 0 deletions
171
packages/gatsby/src/schema/__tests__/__snapshots__/print.js.snap
This file contains 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,171 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Print type definitions allows explicitly listing types to include without including field types 1`] = ` | ||
"### Type definitions saved at 2019-01-01 ### | ||
type InlineTest implements Node & ITest @childOf(types: [\\"OneMoreTest\\"]) @dontInfer { | ||
first: Inline | ||
second(bar: Baz): Date @dateformat(formatString: \\"MM/DD/YYYY\\") | ||
}" | ||
`; | ||
|
||
exports[`Print type definitions allows specifying types owned by plugins to exclude 1`] = ` | ||
"### Type definitions saved at 2019-01-01 ### | ||
type InlineTest implements Node & ITest @childOf(types: [\\"OneMoreTest\\"]) @dontInfer { | ||
first: Inline | ||
second(bar: Baz): Date @dateformat(formatString: \\"MM/DD/YYYY\\") | ||
} | ||
interface ITest @nodeInterface { | ||
id: ID! | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
} | ||
type Inline { | ||
foo: Nested | ||
} | ||
type Nested { | ||
baz: Boolean | ||
} | ||
input Baz { | ||
qux: Boolean | ||
} | ||
type Test implements Node @dontInfer { | ||
foo: Int | ||
}" | ||
`; | ||
|
||
exports[`Print type definitions allows specifying types owned by plugins to include 1`] = ` | ||
"### Type definitions saved at 2019-01-01 ### | ||
type InlineTest implements Node & ITest @childOf(types: [\\"OneMoreTest\\"]) @dontInfer { | ||
first: Inline | ||
second(bar: Baz): Date @dateformat(formatString: \\"MM/DD/YYYY\\") | ||
} | ||
interface ITest @nodeInterface { | ||
id: ID! | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
} | ||
type Inline { | ||
foo: Nested | ||
} | ||
type Nested { | ||
baz: Boolean | ||
} | ||
input Baz { | ||
qux: Boolean | ||
}" | ||
`; | ||
|
||
exports[`Print type definitions allows specifying types to exclude 1`] = ` | ||
"### Type definitions saved at 2019-01-01 ### | ||
type AnotherTest implements Node & ITest @dontInfer { | ||
nested: Nested | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
hello(planet: String = \\"world\\", language: [Language!]!): String! | ||
} | ||
interface ITest @nodeInterface { | ||
id: ID! | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
} | ||
type Nested { | ||
baz: Boolean | ||
} | ||
input Language { | ||
lang: String | ||
hello: String | ||
} | ||
type OneMoreTest implements Node @dontInfer { | ||
bar: Boolean | ||
} | ||
union ThisOrThat = AnotherTest | OneMoreTest | ||
type Test implements Node @dontInfer { | ||
foo: Int | ||
}" | ||
`; | ||
|
||
exports[`Print type definitions allows specifying types to include (and includes interfaces and field types) 1`] = ` | ||
"### Type definitions saved at 2019-01-01 ### | ||
type AnotherTest implements Node & ITest @dontInfer { | ||
nested: Nested | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
hello(planet: String = \\"world\\", language: [Language!]!): String! | ||
} | ||
interface ITest @nodeInterface { | ||
id: ID! | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
} | ||
type Nested { | ||
baz: Boolean | ||
} | ||
input Language { | ||
lang: String | ||
hello: String | ||
}" | ||
`; | ||
|
||
exports[`Print type definitions saves correct type definitions 1`] = ` | ||
"### Type definitions saved at 2019-01-01 ### | ||
type AnotherTest implements Node & ITest @dontInfer { | ||
nested: Nested | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
hello(planet: String = \\"world\\", language: [Language!]!): String! | ||
} | ||
interface ITest @nodeInterface { | ||
id: ID! | ||
date: Date @dateformat(formatString: \\"YYYY\\") | ||
} | ||
type Nested { | ||
baz: Boolean | ||
} | ||
input Language { | ||
lang: String | ||
hello: String | ||
} | ||
type OneMoreTest implements Node @dontInfer { | ||
bar: Boolean | ||
} | ||
union ThisOrThat = AnotherTest | OneMoreTest | ||
type InlineTest implements Node & ITest @childOf(types: [\\"OneMoreTest\\"]) @dontInfer { | ||
first: Inline | ||
second(bar: Baz): Date @dateformat(formatString: \\"MM/DD/YYYY\\") | ||
} | ||
type Inline { | ||
foo: Nested | ||
} | ||
input Baz { | ||
qux: Boolean | ||
} | ||
type Test implements Node @dontInfer { | ||
foo: Int | ||
}" | ||
`; |
Oops, something went wrong.