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

refactor: reintroduce contentful sys commen resource attribute #31007

Conversation

axe312ger
Copy link
Collaborator

@axe312ger axe312ger commented Apr 22, 2021

This is part of #30855 and introduces the following changes:

One side effect of this change is that we later can remove the Contentful SDK link resolution. This will lead to performance improvements and code simplification (https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-contentful/src/gatsby-node.js#L446-L492)

(Breaking) Changes

Metadata / Data from sys

Old Path New Path Comment
node_locale sys.locale this does not exists in Contentful's sys but we need it (for now) as Contentful GraphQL handles locales different
contentful_id sys.id
spaceId sys.spaceId
createdAt sys.firstPublishedAt
updatedAt sys.publishedAt
revision sys.publishedVersion
new sys.environmentId
sys.type sys.contentType (and is now a real reference)

Sorting

allContentfulBoolean(sort: { fields: contentful_id }) {}

becomes

allContentfulBoolean(sort: { fields: sys___id }) {}

Filtering

contentfulDate(contentful_id: { eq: "38akBjGb3T1t4AjB87wQjo" }) {}

becomes

contentfulDate(sys: { id: { eq: "38akBjGb3T1t4AjB87wQjo" } }) {}

Rich Text fields

  1. you can now query all Contentful content types in the references subfield, not matter if they are linked or not
  2. the entry id can now be queried directly as child-field of references instead of fields within each referenced content type

JSON fields

Spaces within keys of JSON fields are now kept.

<p data-cy-value-born-at>Born at: {actor.Born_At}</p>

becomes

<p data-cy-value-born-at>Born at: {actor["Born At"]}</p>

@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 labels Apr 22, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 22, 2021
@axe312ger
Copy link
Collaborator Author

This includes code from #31008 and is blocked thill the other one is merged & this one rebased

@axe312ger axe312ger removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Apr 22, 2021
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 135a5c5 to 08522e7 Compare April 27, 2021 07:30
@axe312ger axe312ger force-pushed the refactor/contentful-schema-generic-sys branch from 30405f3 to 70937e1 Compare April 27, 2021 07:30
@axe312ger axe312ger force-pushed the feat/contentful-schema-generation branch from 08522e7 to e498203 Compare April 27, 2021 07:33
@axe312ger axe312ger force-pushed the refactor/contentful-schema-generic-sys branch from 70937e1 to 4a1301a Compare April 27, 2021 07:34
@axe312ger axe312ger marked this pull request as ready for review April 29, 2021 10:24
@axe312ger axe312ger merged commit b0baf70 into feat/contentful-schema-generation Apr 29, 2021
@axe312ger axe312ger deleted the refactor/contentful-schema-generic-sys branch April 29, 2021 10:25
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