Skip to content

gatsby-source-contentful: Warn/error when content model uses Entry or Reference as content type #30089

@axe312ger

Description

@axe312ger

Oh right, I've misunderstood the question at first. Now I see that the problem is not with fields but with type names. The plugin defines interface types here:

createTypes(`
interface ContentfulEntry @nodeInterface {
contentful_id: String!
id: ID!
node_locale: String!
}
`)
createTypes(`
interface ContentfulReference {
contentful_id: String!
id: ID!
}
`)

But if someone uses Entry or Reference in Contentful model names - they cause conflicts with those internal plugin types (because in the contentful plugin those model names are also transformed to ContentfulEntry and ContentfulReference).

So this is a conflict on a plugin level - Gatsby doesn't restrict type names (as long as they are prefixed with Contentful). So I think for list-based exceptions you can just go with Reference and Entry (and whatever other internal type names the plugin has). Alternatively, you can rename plugin interface types to something else, e.g. InternalContentfulReference (but that will be a breaking change).

Originally posted by @vladar in #29446 (reply in thread)

Metadata

Metadata

Assignees

No one assigned

    Labels

    stale?Issue that may be closed soon due to the original author not responding any more.topic: source-contentfulRelated to Gatsby's integration with Contentful

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions