Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTF-next: Generate GraphQL schema WITHOUT TEST CHANGES #34032

Closed

Conversation

axe312ger
Copy link
Collaborator

This is the same PR as #30855, but without any changes to unit tests, fixtures or e2e tests.

The changes in the tests are massive, so I decided to create this sidecar PR to highlight what actually changes in #30053.

axe312ger and others added 27 commits November 18, 2021 11:02
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 19, 2021
})
}
})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more content type name restrictions 🎉

ImagePlaceholderType,
ImageResizingBehavior,
} from "./schemes"
import { ImageCropFocusType, ImageResizingBehavior } from "./schemes"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done outside of this PR. Just a import cleanup 🤷

e
)}`,
},
})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tags are enabled by default 🎉

export { setFieldsOnGraphQLNodeType } from "./extend-node-type"
export { sourceNodes } from "./source-nodes"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a import cleanup. Could be done before this new version gets released 🤷

aspectRatio =
image.file.details.image.width / image.file.details.image.height
width = args.width
height = args.height
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One else less. YAY!

@@ -0,0 +1,368 @@
import { getRichTextEntityLinks } from "@contentful/rich-text-links"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is where the actual magic 🧙 🪄 is happening

)

// Assets
generateAssetTypes({ createTypes })
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get rid of this function, not need to extract it here only for assets!

node?.sys?.id &&
node?.sys?.type === entityType &&
links.includes(node.sys.id)
// @todo how can we check for correct space and environment? We need to access the sys field of the fields parent entry.
Copy link
Collaborator Author

@axe312ger axe312ger Nov 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unresolved @todo

)

// Text
// @todo Is there a way to have this as string and let transformer-remark replace it with an object?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unresolved @todo

fields: {
raw: `String!`,
},
// @todo do we need a node interface here?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unresolved @todo


return JSONNode
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more ContentfulJSON nodes! 🎉


entryItemFields[`${entryItemFieldKey}___NODE`].push(jsonNodeId)
})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more ContentfulJSON and ContentfulRichText nodes 🎉

url: file.url,
size: file.details.size,
width: file.details?.image?.width || null,
height: file.details?.image?.height || null,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assets are now flat 🎉

@@ -11,7 +11,6 @@ const defaultOptions = {
localeFilter: () => true,
pageLimit: DEFAULT_PAGE_LIMIT,
useNameForId: true,
enableTags: false,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 enableTags

@@ -1,46 +1,52 @@
// @ts-check
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WAY less magic in here thanks to pure JSON in our GraphQL DB 🎉

foreignReferenceMap[id].forEach(foreignReference => {
// Add reverse links
if (n[foreignReference.name]) {
n[foreignReference.name].push(foreignReference.id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space,
})
)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change could/should also happen before this major. Just a cleanup/restructure.

const {
file: { contentType, url: imgUrl, fileName },
} = asset
const { contentType, url: imgUrl, fileName } = asset
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flat assets 🎉

@axe312ger axe312ger changed the title CTF-v6: Generate GraphQL schema WITHOUT TEST CHANGES CTF-next: Generate GraphQL schema WITHOUT TEST CHANGES Nov 19, 2021
@axe312ger axe312ger added breaking change If implemented, this proposed work would break functionality for older versions of Gatsby status: blocked This issue/PR can't be solved at the moment and shouldn't be closed/merged topic: source-contentful Related to Gatsby's integration with Contentful and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 25, 2021
@axe312ger
Copy link
Collaborator Author

This can be closed as #30855 test changes are minimal after #34584

@axe312ger axe312ger closed this Feb 16, 2022
@LekoArts LekoArts deleted the feat/contentful-schema-generation-without-tests branch April 12, 2022 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change If implemented, this proposed work would break functionality for older versions of Gatsby status: blocked This issue/PR can't be solved at the moment and shouldn't be closed/merged topic: source-contentful Related to Gatsby's integration with Contentful
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant