Skip to content

Commit 849e5a3

Browse files
authored
refactor: rename schema types to avoid conflicts
1 parent 0321b20 commit 849e5a3

File tree

23 files changed

+502
-553
lines changed

23 files changed

+502
-553
lines changed

e2e-tests/contentful/schema.gql

Lines changed: 76 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### Type definitions saved at 2021-06-10T13:26:49.703Z ###
1+
### Type definitions saved at 2021-06-10T16:02:04.333Z ###
22

33
type File implements Node @dontInfer {
44
sourceInstanceName: String!
@@ -125,7 +125,7 @@ type MarkdownWordCount {
125125
words: Int
126126
}
127127

128-
type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["ContentfulNodeTypeText"]) @derivedTypes @dontInfer {
128+
type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["ContentfulText"]) @dontInfer {
129129
frontmatter: MarkdownRemarkFrontmatter
130130
excerpt: String
131131
rawMarkdownBody: String
@@ -135,12 +135,12 @@ type MarkdownRemarkFrontmatter {
135135
title: String
136136
}
137137

138-
interface ContentfulInternalReference implements Node {
138+
interface ContentfulReference implements Node {
139139
id: ID!
140-
sys: ContentfulInternalSys
140+
sys: ContentfulSys
141141
}
142142

143-
type ContentfulInternalSys {
143+
type ContentfulSys {
144144
type: String!
145145
id: String!
146146
spaceId: String!
@@ -152,151 +152,161 @@ type ContentfulInternalSys {
152152
locale: String!
153153
}
154154

155-
type ContentfulContentType implements Node @derivedTypes @dontInfer {
155+
type ContentfulContentType implements Node @dontInfer {
156156
name: String!
157157
displayField: String!
158158
description: String!
159-
sys: ContentfulContentTypeSys
160-
}
161-
162-
type ContentfulContentTypeSys {
163-
type: String
164-
id: String
165-
locale: String
166-
spaceId: String
167-
environmentId: String
168-
firstPublishedAt: Date @dateformat
169-
publishedAt: Date @dateformat
170-
publishedVersion: Int
171159
}
172160

173161
interface ContentfulEntry implements Node {
174162
id: ID!
175-
sys: ContentfulInternalSys
163+
sys: ContentfulSys
176164
}
177165

178-
type ContentfulAsset implements ContentfulInternalReference & Node @dontInfer {
179-
file: ContentfulAssetFile
166+
type ContentfulAsset implements ContentfulReference & Node @dontInfer {
167+
sys: ContentfulSys
180168
title: String
181169
description: String
182-
sys: ContentfulInternalSys
170+
contentType: String
171+
fileName: String
172+
url: String
173+
size: Int
174+
width: Int
175+
height: Int
183176
}
184177

185-
type ContentfulAssetFile {
186-
url: String
187-
details: ContentfulAssetFileDetails
188-
fileName: String
189-
contentType: String
178+
type ContentfulRichTextAssets {
179+
block: [ContentfulAsset]!
180+
hyperlink: [ContentfulAsset]!
190181
}
191182

192-
type ContentfulAssetFileDetails {
193-
size: Int
194-
image: ContentfulAssetFileDetailsImage
183+
type ContentfulRichTextEntries {
184+
inline: [ContentfulEntry]!
185+
block: [ContentfulEntry]!
186+
hyperlink: [ContentfulEntry]!
195187
}
196188

197-
type ContentfulAssetFileDetailsImage {
198-
width: Int
199-
height: Int
189+
type ContentfulRichTextLinks {
190+
assets: ContentfulRichTextAssets
191+
entries: ContentfulRichTextEntries
200192
}
201193

202-
type ContentfulNodeTypeRichText @dontInfer {
203-
raw: JSON
204-
references: [ContentfulInternalReference]
194+
type ContentfulRichText @dontInfer {
195+
json: JSON
196+
links: ContentfulRichTextLinks
205197
}
206198

207-
type ContentfulNodeTypeLocation @dontInfer {
199+
type ContentfulLocation @dontInfer {
208200
lat: Float!
209201
lon: Float!
210202
}
211203

212-
type ContentfulNodeTypeText implements Node @dontInfer {
204+
type ContentfulText implements Node @dontInfer {
213205
raw: String!
214206
}
215207

216-
type ContentfulNumber implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
217-
sys: ContentfulInternalSys
208+
type ContentfulContentTypeNumber implements ContentfulReference & ContentfulEntry & Node @dontInfer {
209+
sys: ContentfulSys
218210
title: String
219211
integer: Int
220212
integerLocalized: Int
221213
decimal: Float
222214
decimalLocalized: Float
223215
}
224216

225-
type ContentfulText implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
226-
sys: ContentfulInternalSys
217+
type ContentfulContentTypeText implements ContentfulReference & ContentfulEntry & Node @dontInfer {
218+
sys: ContentfulSys
227219
title: String
228220
short: String
229221
shortLocalized: String
230222
shortList: [String]
231223
shortListLocalized: [String]
232-
longPlain: ContentfulNodeTypeText @link(by: "id", from: "longPlain___NODE")
233-
longMarkdown: ContentfulNodeTypeText @link(by: "id", from: "longMarkdown___NODE")
234-
longLocalized: ContentfulNodeTypeText @link(by: "id", from: "longLocalized___NODE")
224+
longPlain: ContentfulText @link(by: "id", from: "longPlain___NODE")
225+
longMarkdown: ContentfulText @link(by: "id", from: "longMarkdown___NODE")
226+
longLocalized: ContentfulText @link(by: "id", from: "longLocalized___NODE")
235227
}
236228

237-
type ContentfulMediaReference implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
238-
sys: ContentfulInternalSys
229+
type ContentfulContentTypeMediaReference implements ContentfulReference & ContentfulEntry & Node @dontInfer {
230+
sys: ContentfulSys
239231
title: String
240232
one: ContentfulAsset @link(by: "id", from: "one___NODE")
241233
oneLocalized: ContentfulAsset @link(by: "id", from: "oneLocalized___NODE")
242234
many: [ContentfulAsset] @link(by: "id", from: "many___NODE")
243235
manyLocalized: [ContentfulAsset] @link(by: "id", from: "manyLocalized___NODE")
244236
}
245237

246-
type ContentfulBoolean implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
247-
sys: ContentfulInternalSys
238+
type ContentfulContentTypeBoolean implements ContentfulReference & ContentfulEntry & Node @dontInfer {
239+
sys: ContentfulSys
248240
title: String
249241
boolean: Boolean
250242
booleanLocalized: Boolean
251243
}
252244

253-
type ContentfulDate implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
254-
sys: ContentfulInternalSys
245+
type ContentfulContentTypeDate implements ContentfulReference & ContentfulEntry & Node @dontInfer {
246+
sys: ContentfulSys
255247
title: String
256248
date: Date @dateformat
257249
dateTime: Date @dateformat
258250
dateTimeTimezone: Date @dateformat
259251
dateLocalized: Date @dateformat
260252
}
261253

262-
type ContentfulLocation implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
263-
sys: ContentfulInternalSys
254+
type ContentfulContentTypeLocation implements ContentfulReference & ContentfulEntry & Node @dontInfer {
255+
sys: ContentfulSys
264256
title: String
265-
location: ContentfulNodeTypeLocation
266-
locationLocalized: ContentfulNodeTypeLocation
257+
location: ContentfulLocation
258+
locationLocalized: ContentfulLocation
267259
}
268260

269-
type ContentfulJson implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
270-
sys: ContentfulInternalSys
261+
type ContentfulContentTypeJson implements ContentfulReference & ContentfulEntry & Node @dontInfer {
262+
sys: ContentfulSys
271263
title: String
272264
json: JSON
273265
jsonLocalized: JSON
274266
}
275267

276-
type ContentfulRichText implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
277-
sys: ContentfulInternalSys
268+
type ContentfulContentTypeRichText implements ContentfulReference & ContentfulEntry & Node @dontInfer {
269+
sys: ContentfulSys
278270
title: String
279-
richText: ContentfulNodeTypeRichText
280-
richTextLocalized: ContentfulNodeTypeRichText
281-
richTextValidated: ContentfulNodeTypeRichText
271+
richText: ContentfulRichText
272+
richTextLocalized: ContentfulRichText
273+
richTextValidated: ContentfulRichText
282274
}
283275

284-
type ContentfulContentReference implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
285-
sys: ContentfulInternalSys
276+
type ContentfulContentTypeContentReference implements ContentfulReference & ContentfulEntry & Node @dontInfer {
277+
sys: ContentfulSys
286278
title: String
287279
one: ContentfulEntry @link(by: "id", from: "one___NODE")
288280
oneLocalized: ContentfulEntry @link(by: "id", from: "oneLocalized___NODE")
289281
many: [ContentfulEntry] @link(by: "id", from: "many___NODE")
290282
manyLocalized: [ContentfulEntry] @link(by: "id", from: "manyLocalized___NODE")
291283
}
292284

293-
type ContentfulValidatedContentReference implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
294-
sys: ContentfulInternalSys
285+
type ContentfulContentTypeValidatedContentReference implements ContentfulReference & ContentfulEntry & Node @dontInfer {
286+
sys: ContentfulSys
295287
title: String
296288
oneItemSingleType: ContentfulEntry @link(by: "id", from: "oneItemSingleType___NODE")
297289
oneItemManyTypes: ContentfulEntry @link(by: "id", from: "oneItemManyTypes___NODE")
298290
oneItemAllTypes: ContentfulEntry @link(by: "id", from: "oneItemAllTypes___NODE")
299291
multipleItemsSingleType: [ContentfulEntry] @link(by: "id", from: "multipleItemsSingleType___NODE")
300292
multipleItemsManyTypes: [ContentfulEntry] @link(by: "id", from: "multipleItemsManyTypes___NODE")
301293
multipleItemsAllTypes: [ContentfulEntry] @link(by: "id", from: "multipleItemsAllTypes___NODE")
294+
}
295+
296+
type ContentfulContentTypeContentType implements Node @dontInfer {
297+
name: String
298+
displayField: String
299+
description: String
300+
sys: ContentfulContentTypeContentTypeSys
301+
}
302+
303+
type ContentfulContentTypeContentTypeSys {
304+
type: String
305+
id: String
306+
locale: String
307+
spaceId: String
308+
environmentId: String
309+
firstPublishedAt: Date @dateformat
310+
publishedAt: Date @dateformat
311+
publishedVersion: Int
302312
}

e2e-tests/contentful/snapshots.js

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

e2e-tests/contentful/src/components/references/content-reference.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from "react"
22

3-
export const ContentfulContentReference = ({ one, many, title }) => {
3+
export const ContentfulContentTypeContentReference = ({ one, many, title }) => {
44
const references = [one, ...(many || [])].filter(Boolean)
55
return (
66
<p data-cy-id="reference">
7-
[ContentfulReference] {title}: [
7+
[ContentfulContentTypeContentReference] {title}: [
88
{references.map(ref => ref.title).join(", ")}]
99
</p>
1010
)
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { ContentfulContentReference } from "./content-reference"
2-
export { ContentfulLocation } from "./location"
3-
export { ContentfulNumber } from "./number"
4-
export { ContentfulText } from "./text"
1+
export { ContentfulContentTypeContentReference } from "./content-reference"
2+
export { ContentfulContentTypeLocation } from "./location"
3+
export { ContentfulContentTypeNumber } from "./number"
4+
export { ContentfulContentTypeText } from "./text"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react"
22

3-
export const ContentfulLocation = ({ location }) => (
3+
export const ContentfulContentTypeLocation = ({ location }) => (
44
<p data-cy-id="location">
5-
[ContentfulLocation] Lat: {location.lat}, Long: {location.lon}
5+
[ContentfulContentTypeLocation] Lat: {location.lat}, Long: {location.lon}
66
</p>
77
)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react"
22

3-
export const ContentfulNumber = ({ integer, decimal }) => (
4-
<p data-cy-id="integer">[ContentfulNumber] {integer || decimal}</p>
3+
export const ContentfulContentTypeNumber = ({ integer, decimal }) => (
4+
<p data-cy-id="integer">[ContentfulContentTypeNumber] {integer || decimal}</p>
55
)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react"
22

3-
export const ContentfulText = ({ short, longPlain }) => (
4-
<p data-cy-id="text">[ContentfulText] {short || longPlain?.raw}</p>
3+
export const ContentfulContentTypeText = ({ short, longPlain }) => (
4+
<p data-cy-id="text">[ContentfulContentTypeText] {short || longPlain?.raw}</p>
55
)

e2e-tests/contentful/src/pages/boolean.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default BooleanPage
4949

5050
export const pageQuery = graphql`
5151
query BooleanQuery {
52-
default: allContentfulBoolean(
52+
default: allContentfulContentTypeBoolean(
5353
sort: { fields: sys___id }
5454
filter: {
5555
sys: { locale: { eq: "en-US" } }
@@ -61,7 +61,7 @@ export const pageQuery = graphql`
6161
boolean
6262
}
6363
}
64-
english: allContentfulBoolean(
64+
english: allContentfulContentTypeBoolean(
6565
sort: { fields: sys___id }
6666
filter: {
6767
sys: { locale: { eq: "en-US" } }
@@ -73,7 +73,7 @@ export const pageQuery = graphql`
7373
booleanLocalized
7474
}
7575
}
76-
german: allContentfulBoolean(
76+
german: allContentfulContentTypeBoolean(
7777
sort: { fields: sys___id }
7878
filter: {
7979
sys: { locale: { eq: "de-DE" } }

0 commit comments

Comments
 (0)