Skip to content

Commit d01a373

Browse files
axe312gerwardpeet
andauthored
feat(gatsby-source-contentful): move types into createSchemaCustomization (#33207)
Co-authored-by: Ward Peeters <[email protected]>
1 parent dacff72 commit d01a373

16 files changed

+1437
-2428
lines changed

e2e-tests/contentful/schema.gql

+110-83
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Type definitions saved at 2021-05-21T17:02:49.951Z ###
1+
### Type definitions saved at 2021-09-25T11:33:25.217Z ###
22

33
type File implements Node @dontInfer {
44
sourceInstanceName: String!
@@ -96,43 +96,23 @@ type SitePage implements Node @dontInfer {
9696
internalComponentName: String!
9797
componentChunkName: String!
9898
matchPath: String
99+
pageContext: JSON
99100
}
100101

101-
type MarkdownHeading {
102-
id: String
103-
value: String
104-
depth: Int
105-
}
106-
107-
enum MarkdownHeadingLevels {
108-
h1
109-
h2
110-
h3
111-
h4
112-
h5
113-
h6
114-
}
115-
116-
enum MarkdownExcerptFormats {
117-
PLAIN
118-
HTML
119-
MARKDOWN
120-
}
121-
122-
type MarkdownWordCount {
123-
paragraphs: Int
124-
sentences: Int
125-
words: Int
126-
}
127-
128-
type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["contentfulTextLongPlainTextNode", "contentfulTextLongMarkdownTextNode", "contentfulTextLongLocalizedTextNode"]) @derivedTypes @dontInfer {
129-
frontmatter: MarkdownRemarkFrontmatter
130-
excerpt: String
131-
rawMarkdownBody: String
102+
type SitePlugin implements Node @dontInfer {
103+
resolve: String
104+
name: String
105+
version: String
106+
nodeAPIs: [String]
107+
browserAPIs: [String]
108+
ssrAPIs: [String]
109+
pluginFilepath: String
110+
pluginOptions: JSON
111+
packageJson: JSON
132112
}
133113

134-
type MarkdownRemarkFrontmatter {
135-
title: String
114+
type SiteBuildMetadata implements Node @dontInfer {
115+
buildTime: Date @dateformat
136116
}
137117

138118
interface ContentfulEntry implements Node {
@@ -184,15 +164,16 @@ type ContentfulNumber implements ContentfulReference & ContentfulEntry & Node @d
184164
contentful_id: String!
185165
node_locale: String!
186166
title: String
187-
decimal: Float
167+
integerLocalized: Int
188168
spaceId: String
189169
createdAt: Date @dateformat
190170
updatedAt: Date @dateformat
191171
sys: ContentfulNumberSys
172+
metadata: ContentfulNumberMetadata
173+
decimal: Float
192174
integer: Int
193175
content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE")
194176
decimalLocalized: Float
195-
integerLocalized: Int
196177
}
197178

198179
type ContentfulNumberSys @derivedTypes {
@@ -211,22 +192,31 @@ type ContentfulNumberSysContentTypeSys {
211192
id: String
212193
}
213194

195+
type ContentfulNumberMetadata {
196+
tags: [ContentfulTag] @link(by: "id", from: "tags___NODE")
197+
}
198+
199+
type ContentfulTag implements Node @dontInfer {
200+
name: String!
201+
contentful_id: String!
202+
}
203+
214204
type ContentfulContentReference implements ContentfulReference & ContentfulEntry & Node @derivedTypes @dontInfer {
215205
contentful_id: String!
216206
node_locale: String!
217207
title: String
218-
manyLocalized: [ContentfulNumberContentfulTextUnion] @link(by: "id", from: "manyLocalized___NODE")
208+
one: ContentfulContentReferenceContentfulTextUnion @link(by: "id", from: "one___NODE")
209+
content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE")
219210
spaceId: String
220211
createdAt: Date @dateformat
221212
updatedAt: Date @dateformat
222213
sys: ContentfulContentReferenceSys
223214
oneLocalized: ContentfulNumber @link(by: "id", from: "oneLocalized___NODE")
224-
one: ContentfulContentReferenceContentfulTextUnion @link(by: "id", from: "one___NODE")
225-
content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE")
226215
many: [ContentfulContentReferenceContentfulNumberContentfulTextUnion] @link(by: "id", from: "many___NODE")
216+
manyLocalized: [ContentfulNumberContentfulTextUnion] @link(by: "id", from: "manyLocalized___NODE")
227217
}
228218

229-
union ContentfulNumberContentfulTextUnion = ContentfulNumber | ContentfulText
219+
union ContentfulContentReferenceContentfulTextUnion = ContentfulContentReference | ContentfulText
230220

231221
type ContentfulContentReferenceSys @derivedTypes {
232222
type: String
@@ -244,10 +234,10 @@ type ContentfulContentReferenceSysContentTypeSys {
244234
id: String
245235
}
246236

247-
union ContentfulContentReferenceContentfulTextUnion = ContentfulContentReference | ContentfulText
248-
249237
union ContentfulContentReferenceContentfulNumberContentfulTextUnion = ContentfulContentReference | ContentfulNumber | ContentfulText
250238

239+
union ContentfulNumberContentfulTextUnion = ContentfulNumber | ContentfulText
240+
251241
type ContentfulText implements ContentfulReference & ContentfulEntry & Node @derivedTypes @dontInfer {
252242
contentful_id: String!
253243
node_locale: String!
@@ -257,12 +247,12 @@ type ContentfulText implements ContentfulReference & ContentfulEntry & Node @der
257247
createdAt: Date @dateformat
258248
updatedAt: Date @dateformat
259249
sys: ContentfulTextSys
260-
shortLocalized: String
261250
longMarkdown: contentfulTextLongMarkdownTextNode @link(by: "id", from: "longMarkdown___NODE")
251+
shortLocalized: String
262252
longPlain: contentfulTextLongPlainTextNode @link(by: "id", from: "longPlain___NODE")
253+
shortList: [String]
263254
short: String
264255
content_reference: [ContentfulContentReference] @link(by: "id", from: "content reference___NODE") @proxy(from: "content reference___NODE")
265-
shortList: [String]
266256
}
267257

268258
type contentfulTextLongLocalizedTextNode implements Node @derivedTypes @childOf(types: ["ContentfulText"]) @dontInfer {
@@ -312,14 +302,14 @@ type ContentfulMediaReference implements ContentfulReference & ContentfulEntry &
312302
contentful_id: String!
313303
node_locale: String!
314304
title: String
315-
manyLocalized: [ContentfulAsset] @link(by: "id", from: "manyLocalized___NODE")
305+
one: ContentfulAsset @link(by: "id", from: "one___NODE")
316306
spaceId: String
317307
createdAt: Date @dateformat
318308
updatedAt: Date @dateformat
319309
sys: ContentfulMediaReferenceSys
320-
many: [ContentfulAsset] @link(by: "id", from: "many___NODE")
321310
oneLocalized: ContentfulAsset @link(by: "id", from: "oneLocalized___NODE")
322-
one: ContentfulAsset @link(by: "id", from: "one___NODE")
311+
many: [ContentfulAsset] @link(by: "id", from: "many___NODE")
312+
manyLocalized: [ContentfulAsset] @link(by: "id", from: "manyLocalized___NODE")
323313
}
324314

325315
type ContentfulMediaReferenceSys @derivedTypes {
@@ -370,14 +360,14 @@ type ContentfulDate implements ContentfulReference & ContentfulEntry & Node @der
370360
contentful_id: String!
371361
node_locale: String!
372362
title: String
373-
dateLocalized: Date @dateformat
363+
dateTimeTimezone: Date @dateformat
374364
spaceId: String
375365
createdAt: Date @dateformat
376366
updatedAt: Date @dateformat
377367
sys: ContentfulDateSys
378-
dateTime: Date @dateformat
379-
dateTimeTimezone: Date @dateformat
380368
date: Date @dateformat
369+
dateLocalized: Date @dateformat
370+
dateTime: Date @dateformat
381371
}
382372

383373
type ContentfulDateSys @derivedTypes {
@@ -409,8 +399,8 @@ type ContentfulLocation implements ContentfulReference & ContentfulEntry & Node
409399
}
410400

411401
type ContentfulLocationLocationLocalized {
412-
lat: Float
413402
lon: Float
403+
lat: Float
414404
}
415405

416406
type ContentfulLocationSys @derivedTypes {
@@ -438,25 +428,39 @@ type ContentfulJson implements ContentfulReference & ContentfulEntry & Node @der
438428
contentful_id: String!
439429
node_locale: String!
440430
title: String
441-
jsonLocalized: contentfulJsonJsonLocalizedJsonNode @link(by: "id", from: "jsonLocalized___NODE")
431+
json: contentfulJsonJsonJsonNode @link(by: "id", from: "json___NODE")
442432
spaceId: String
443433
createdAt: Date @dateformat
444434
updatedAt: Date @dateformat
445435
sys: ContentfulJsonSys
446-
json: contentfulJsonJsonJsonNode @link(by: "id", from: "json___NODE")
436+
jsonLocalized: contentfulJsonJsonLocalizedJsonNode @link(by: "id", from: "jsonLocalized___NODE")
447437
}
448438

449-
type contentfulJsonJsonLocalizedJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer {
439+
type contentfulJsonJsonJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer {
450440
age: Int
451441
city: String
452442
name: String
453-
sys: contentfulJsonJsonLocalizedJsonNodeSys
443+
sys: contentfulJsonJsonJsonNodeSys
444+
Actors: [contentfulJsonJsonJsonNodeActors]
454445
}
455446

456-
type contentfulJsonJsonLocalizedJsonNodeSys {
447+
type contentfulJsonJsonJsonNodeSys {
457448
type: String
458449
}
459450

451+
type contentfulJsonJsonJsonNodeActors {
452+
age: Int
453+
name: String
454+
wife: String
455+
photo: String
456+
weight: Float
457+
Born_At: String @proxy(from: "Born At")
458+
children: [String]
459+
Birthdate: String
460+
hasChildren: Boolean
461+
hasGreyHair: Boolean
462+
}
463+
460464
type ContentfulJsonSys @derivedTypes {
461465
type: String
462466
revision: Int
@@ -473,50 +477,36 @@ type ContentfulJsonSysContentTypeSys {
473477
id: String
474478
}
475479

476-
type contentfulJsonJsonJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer {
477-
Actors: [contentfulJsonJsonJsonNodeActors]
478-
sys: contentfulJsonJsonJsonNodeSys
480+
type contentfulJsonJsonLocalizedJsonNode implements Node @derivedTypes @childOf(types: ["ContentfulJson"]) @dontInfer {
479481
name: String
480482
age: Int
481483
city: String
484+
sys: contentfulJsonJsonLocalizedJsonNodeSys
482485
}
483486

484-
type contentfulJsonJsonJsonNodeActors {
485-
name: String
486-
age: Int
487-
Born_At: String @proxy(from: "Born At")
488-
Birthdate: String
489-
photo: String
490-
wife: String
491-
weight: Float
492-
hasChildren: Boolean
493-
hasGreyHair: Boolean
494-
children: [String]
495-
}
496-
497-
type contentfulJsonJsonJsonNodeSys {
487+
type contentfulJsonJsonLocalizedJsonNodeSys {
498488
type: String
499489
}
500490

501491
type ContentfulRichText implements ContentfulReference & ContentfulEntry & Node @derivedTypes @dontInfer {
502492
contentful_id: String!
503493
node_locale: String!
504494
title: String
505-
richTextValidated: ContentfulRichTextRichTextValidated
495+
richText: ContentfulRichTextRichText
506496
spaceId: String
507497
createdAt: Date @dateformat
508498
updatedAt: Date @dateformat
509499
sys: ContentfulRichTextSys
500+
richTextValidated: ContentfulRichTextRichTextValidated
510501
richTextLocalized: ContentfulRichTextRichTextLocalized
511-
richText: ContentfulRichTextRichText
512502
}
513503

514-
type ContentfulRichTextRichTextValidated {
504+
type ContentfulRichTextRichText {
515505
raw: String
516-
references: [ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion] @link(by: "id", from: "references___NODE")
506+
references: [ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion] @link(by: "id", from: "references___NODE")
517507
}
518508

519-
union ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion = ContentfulAsset | ContentfulLocation | ContentfulNumber | ContentfulText
509+
union ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion = ContentfulAsset | ContentfulContentReference | ContentfulLocation | ContentfulText
520510

521511
type ContentfulRichTextSys @derivedTypes {
522512
type: String
@@ -534,22 +524,59 @@ type ContentfulRichTextSysContentTypeSys {
534524
id: String
535525
}
536526

537-
type ContentfulRichTextRichTextLocalized {
527+
type ContentfulRichTextRichTextValidated {
538528
raw: String
529+
references: [ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion] @link(by: "id", from: "references___NODE")
539530
}
540531

541-
type ContentfulRichTextRichText {
532+
union ContentfulAssetContentfulLocationContentfulNumberContentfulTextUnion = ContentfulAsset | ContentfulLocation | ContentfulNumber | ContentfulText
533+
534+
type ContentfulRichTextRichTextLocalized {
542535
raw: String
543-
references: [ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion] @link(by: "id", from: "references___NODE")
544536
}
545537

546-
union ContentfulAssetContentfulContentReferenceContentfulLocationContentfulTextUnion = ContentfulAsset | ContentfulContentReference | ContentfulLocation | ContentfulText
547-
548538
type ContentfulValidatedContentReference implements ContentfulReference & ContentfulEntry & Node @dontInfer {
549539
contentful_id: String!
550540
node_locale: String!
551541
}
552542

543+
type MarkdownHeading {
544+
id: String
545+
value: String
546+
depth: Int
547+
}
548+
549+
enum MarkdownHeadingLevels {
550+
h1
551+
h2
552+
h3
553+
h4
554+
h5
555+
h6
556+
}
557+
558+
enum MarkdownExcerptFormats {
559+
PLAIN
560+
HTML
561+
MARKDOWN
562+
}
563+
564+
type MarkdownWordCount {
565+
paragraphs: Int
566+
sentences: Int
567+
words: Int
568+
}
569+
570+
type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["contentfulTextLongPlainTextNode", "contentfulTextLongMarkdownTextNode", "contentfulTextLongLocalizedTextNode"]) @derivedTypes @dontInfer {
571+
frontmatter: MarkdownRemarkFrontmatter
572+
excerpt: String
573+
rawMarkdownBody: String
574+
}
575+
576+
type MarkdownRemarkFrontmatter {
577+
title: String
578+
}
579+
553580
type ContentfulContentType implements Node @derivedTypes @dontInfer {
554581
name: String
555582
displayField: String

0 commit comments

Comments
 (0)