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-v6: Rename schema types #31286

Conversation

axe312ger
Copy link
Collaborator

@axe312ger axe312ger commented May 6, 2021

This is part of #30855 and renames all types closer to what the Contentful GraphQL API does

Breaking changes / steps to migrate

New content type naming pattern

The old naming pattern for generated node types based on your Contentful content model was pretty simple. This gave us shorter queries, but came with restrictions for content type names. Content type names like entity, reference, tag, asset did cause problems or simply did not work.

  1. Generated GraphQL node types are now prefixed with ContentfulContentType instead of Contentful
  2. Hardcoded types and interfaces stay short. For example: ContentfulEntry, ContentfulAsset, ContentfulLocation or
    ContentfulRichText

This is close to the behaviour of the Contentful GraphQL API:

If the generated name starts with a number or collides with a reserved type name, it gets prefixed with 'ContentType'

Instead of doing this on a collision, we always prefix for consistency.

export const pageQuery = graphql`
  query {
-    allContentfulProduct {
+    allContentfulContentTypeProduct {
       ...
    }
  }
`

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 6, 2021
@axe312ger axe312ger changed the base branch from master to feat/contentful-schema-generation May 6, 2021 14:25
@axe312ger axe312ger added breaking change If implemented, this proposed work would break functionality for older versions of Gatsby 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 May 6, 2021
@axe312ger axe312ger changed the title Refactor(contentful): rename schema types CTF-v6: Rename schema types May 12, 2021
@axe312ger axe312ger force-pushed the refactor/contentful-rename-schema-types branch 2 times, most recently from e8bf32f to d560a17 Compare May 12, 2021 15:04
@axe312ger axe312ger force-pushed the refactor/contentful-rename-schema-types branch from d560a17 to 8d6fb8d Compare May 20, 2021 09:09
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 810ba34 to 95366fc Compare May 20, 2021 09:11
@axe312ger axe312ger force-pushed the refactor/contentful-rename-schema-types branch from 8d6fb8d to 3842e1f Compare May 20, 2021 09:16
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 95366fc to 4656166 Compare May 20, 2021 14:10
@axe312ger axe312ger force-pushed the refactor/contentful-rename-schema-types branch from 3842e1f to 115ee2a Compare May 21, 2021 10:00
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch 2 times, most recently from 61f846c to a5ddad2 Compare June 10, 2021 16:06
@axe312ger axe312ger force-pushed the refactor/contentful-rename-schema-types branch 2 times, most recently from c7ff45c to d0ae16e Compare June 11, 2021 09:04
@axe312ger axe312ger force-pushed the refactor/contentful-rename-schema-types branch from d0ae16e to f7d6a16 Compare June 11, 2021 10:16
@axe312ger axe312ger marked this pull request as ready for review June 11, 2021 11:29
@axe312ger axe312ger merged commit 849e5a3 into feat/contentful-schema-generation Jun 11, 2021
@axe312ger axe312ger deleted the refactor/contentful-rename-schema-types branch June 11, 2021 11:30
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 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