Skip to content

Commit

Permalink
refactor: rename schema types to avoid conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed Jul 12, 2021
1 parent 6ecfb3e commit 05324da
Show file tree
Hide file tree
Showing 23 changed files with 502 additions and 553 deletions.
142 changes: 76 additions & 66 deletions e2e-tests/contentful/schema.gql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Type definitions saved at 2021-06-10T13:26:49.703Z ###
### Type definitions saved at 2021-06-10T16:02:04.333Z ###

type File implements Node @dontInfer {
sourceInstanceName: String!
Expand Down Expand Up @@ -125,7 +125,7 @@ type MarkdownWordCount {
words: Int
}

type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["ContentfulNodeTypeText"]) @derivedTypes @dontInfer {
type MarkdownRemark implements Node @childOf(mimeTypes: ["text/markdown", "text/x-markdown"], types: ["ContentfulText"]) @dontInfer {
frontmatter: MarkdownRemarkFrontmatter
excerpt: String
rawMarkdownBody: String
Expand All @@ -135,12 +135,12 @@ type MarkdownRemarkFrontmatter {
title: String
}

interface ContentfulInternalReference implements Node {
interface ContentfulReference implements Node {
id: ID!
sys: ContentfulInternalSys
sys: ContentfulSys
}

type ContentfulInternalSys {
type ContentfulSys {
type: String!
id: String!
spaceId: String!
Expand All @@ -152,151 +152,161 @@ type ContentfulInternalSys {
locale: String!
}

type ContentfulContentType implements Node @derivedTypes @dontInfer {
type ContentfulContentType implements Node @dontInfer {
name: String!
displayField: String!
description: String!
sys: ContentfulContentTypeSys
}

type ContentfulContentTypeSys {
type: String
id: String
locale: String
spaceId: String
environmentId: String
firstPublishedAt: Date @dateformat
publishedAt: Date @dateformat
publishedVersion: Int
}

interface ContentfulEntry implements Node {
id: ID!
sys: ContentfulInternalSys
sys: ContentfulSys
}

type ContentfulAsset implements ContentfulInternalReference & Node @dontInfer {
file: ContentfulAssetFile
type ContentfulAsset implements ContentfulReference & Node @dontInfer {
sys: ContentfulSys
title: String
description: String
sys: ContentfulInternalSys
contentType: String
fileName: String
url: String
size: Int
width: Int
height: Int
}

type ContentfulAssetFile {
url: String
details: ContentfulAssetFileDetails
fileName: String
contentType: String
type ContentfulRichTextAssets {
block: [ContentfulAsset]!
hyperlink: [ContentfulAsset]!
}

type ContentfulAssetFileDetails {
size: Int
image: ContentfulAssetFileDetailsImage
type ContentfulRichTextEntries {
inline: [ContentfulEntry]!
block: [ContentfulEntry]!
hyperlink: [ContentfulEntry]!
}

type ContentfulAssetFileDetailsImage {
width: Int
height: Int
type ContentfulRichTextLinks {
assets: ContentfulRichTextAssets
entries: ContentfulRichTextEntries
}

type ContentfulNodeTypeRichText @dontInfer {
raw: JSON
references: [ContentfulInternalReference]
type ContentfulRichText @dontInfer {
json: JSON
links: ContentfulRichTextLinks
}

type ContentfulNodeTypeLocation @dontInfer {
type ContentfulLocation @dontInfer {
lat: Float!
lon: Float!
}

type ContentfulNodeTypeText implements Node @dontInfer {
type ContentfulText implements Node @dontInfer {
raw: String!
}

type ContentfulNumber implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeNumber implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
integer: Int
integerLocalized: Int
decimal: Float
decimalLocalized: Float
}

type ContentfulText implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeText implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
short: String
shortLocalized: String
shortList: [String]
shortListLocalized: [String]
longPlain: ContentfulNodeTypeText @link(by: "id", from: "longPlain___NODE")
longMarkdown: ContentfulNodeTypeText @link(by: "id", from: "longMarkdown___NODE")
longLocalized: ContentfulNodeTypeText @link(by: "id", from: "longLocalized___NODE")
longPlain: ContentfulText @link(by: "id", from: "longPlain___NODE")
longMarkdown: ContentfulText @link(by: "id", from: "longMarkdown___NODE")
longLocalized: ContentfulText @link(by: "id", from: "longLocalized___NODE")
}

type ContentfulMediaReference implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeMediaReference implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
one: ContentfulAsset @link(by: "id", from: "one___NODE")
oneLocalized: ContentfulAsset @link(by: "id", from: "oneLocalized___NODE")
many: [ContentfulAsset] @link(by: "id", from: "many___NODE")
manyLocalized: [ContentfulAsset] @link(by: "id", from: "manyLocalized___NODE")
}

type ContentfulBoolean implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeBoolean implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
boolean: Boolean
booleanLocalized: Boolean
}

type ContentfulDate implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeDate implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
date: Date @dateformat
dateTime: Date @dateformat
dateTimeTimezone: Date @dateformat
dateLocalized: Date @dateformat
}

type ContentfulLocation implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeLocation implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
location: ContentfulNodeTypeLocation
locationLocalized: ContentfulNodeTypeLocation
location: ContentfulLocation
locationLocalized: ContentfulLocation
}

type ContentfulJson implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeJson implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
json: JSON
jsonLocalized: JSON
}

type ContentfulRichText implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeRichText implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
richText: ContentfulNodeTypeRichText
richTextLocalized: ContentfulNodeTypeRichText
richTextValidated: ContentfulNodeTypeRichText
richText: ContentfulRichText
richTextLocalized: ContentfulRichText
richTextValidated: ContentfulRichText
}

type ContentfulContentReference implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeContentReference implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
one: ContentfulEntry @link(by: "id", from: "one___NODE")
oneLocalized: ContentfulEntry @link(by: "id", from: "oneLocalized___NODE")
many: [ContentfulEntry] @link(by: "id", from: "many___NODE")
manyLocalized: [ContentfulEntry] @link(by: "id", from: "manyLocalized___NODE")
}

type ContentfulValidatedContentReference implements ContentfulInternalReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulInternalSys
type ContentfulContentTypeValidatedContentReference implements ContentfulReference & ContentfulEntry & Node @dontInfer {
sys: ContentfulSys
title: String
oneItemSingleType: ContentfulEntry @link(by: "id", from: "oneItemSingleType___NODE")
oneItemManyTypes: ContentfulEntry @link(by: "id", from: "oneItemManyTypes___NODE")
oneItemAllTypes: ContentfulEntry @link(by: "id", from: "oneItemAllTypes___NODE")
multipleItemsSingleType: [ContentfulEntry] @link(by: "id", from: "multipleItemsSingleType___NODE")
multipleItemsManyTypes: [ContentfulEntry] @link(by: "id", from: "multipleItemsManyTypes___NODE")
multipleItemsAllTypes: [ContentfulEntry] @link(by: "id", from: "multipleItemsAllTypes___NODE")
}

type ContentfulContentTypeContentType implements Node @dontInfer {
name: String
displayField: String
description: String
sys: ContentfulContentTypeContentTypeSys
}

type ContentfulContentTypeContentTypeSys {
type: String
id: String
locale: String
spaceId: String
environmentId: String
firstPublishedAt: Date @dateformat
publishedAt: Date @dateformat
publishedVersion: Int
}
42 changes: 21 additions & 21 deletions e2e-tests/contentful/snapshots.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react"

export const ContentfulContentReference = ({ one, many, title }) => {
export const ContentfulContentTypeContentReference = ({ one, many, title }) => {
const references = [one, ...(many || [])].filter(Boolean)
return (
<p data-cy-id="reference">
[ContentfulReference] {title}: [
[ContentfulContentTypeContentReference] {title}: [
{references.map(ref => ref.title).join(", ")}]
</p>
)
Expand Down
8 changes: 4 additions & 4 deletions e2e-tests/contentful/src/components/references/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { ContentfulContentReference } from "./content-reference"
export { ContentfulLocation } from "./location"
export { ContentfulNumber } from "./number"
export { ContentfulText } from "./text"
export { ContentfulContentTypeContentReference } from "./content-reference"
export { ContentfulContentTypeLocation } from "./location"
export { ContentfulContentTypeNumber } from "./number"
export { ContentfulContentTypeText } from "./text"
4 changes: 2 additions & 2 deletions e2e-tests/contentful/src/components/references/location.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react"

export const ContentfulLocation = ({ location }) => (
export const ContentfulContentTypeLocation = ({ location }) => (
<p data-cy-id="location">
[ContentfulLocation] Lat: {location.lat}, Long: {location.lon}
[ContentfulContentTypeLocation] Lat: {location.lat}, Long: {location.lon}
</p>
)
4 changes: 2 additions & 2 deletions e2e-tests/contentful/src/components/references/number.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"

export const ContentfulNumber = ({ integer, decimal }) => (
<p data-cy-id="integer">[ContentfulNumber] {integer || decimal}</p>
export const ContentfulContentTypeNumber = ({ integer, decimal }) => (
<p data-cy-id="integer">[ContentfulContentTypeNumber] {integer || decimal}</p>
)
4 changes: 2 additions & 2 deletions e2e-tests/contentful/src/components/references/text.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"

export const ContentfulText = ({ short, longPlain }) => (
<p data-cy-id="text">[ContentfulText] {short || longPlain?.raw}</p>
export const ContentfulContentTypeText = ({ short, longPlain }) => (
<p data-cy-id="text">[ContentfulContentTypeText] {short || longPlain?.raw}</p>
)
6 changes: 3 additions & 3 deletions e2e-tests/contentful/src/pages/boolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default BooleanPage

export const pageQuery = graphql`
query BooleanQuery {
default: allContentfulBoolean(
default: allContentfulContentTypeBoolean(
sort: { fields: sys___id }
filter: {
sys: { locale: { eq: "en-US" } }
Expand All @@ -61,7 +61,7 @@ export const pageQuery = graphql`
boolean
}
}
english: allContentfulBoolean(
english: allContentfulContentTypeBoolean(
sort: { fields: sys___id }
filter: {
sys: { locale: { eq: "en-US" } }
Expand All @@ -73,7 +73,7 @@ export const pageQuery = graphql`
booleanLocalized
}
}
german: allContentfulBoolean(
german: allContentfulContentTypeBoolean(
sort: { fields: sys___id }
filter: {
sys: { locale: { eq: "de-DE" } }
Expand Down
Loading

0 comments on commit 05324da

Please sign in to comment.