Deleting Custom Type and updating gatsby-config

Hi,

Currently I'm moving content to slice architecture and since some content types are redundant I deleted them from prismic (with all documents). I wanted to update gatsby source plugin as well. I deleted custom type file and remove schema from gatsby-config file. However on build I'm still getting "Invalid plugin options for "gatsby-source-prismic": JSON schema is missing ". I'm new to prismic so please guide me on what I'm missing here...

Hi @errorac,

I am not sure about the issue, but have you followed this article on how to migrate into gatsby-source-plugin?

Suppose you have followed this article and still can't figure out this issue. Can you share with us your gatsby-config.js file and your Prismic repository name (in a private message if possible) to investigate this further issue?

Looking forward to your response,
Fares

1 Like

I have got some input from my team; this issue can be because you are not passing all the custom types.

If you can't figure this out, can you please share your plugin configurations?

1 Like

Hi @errorac,

To add to Fares' response, the error comes from not providing all Custom Type schemas. All Custom Types, including deleted Custom Types that have been used at least once, must be provided.

Since you are no longer using the Custom Types you deleted, you may provide the schema as an empty object like this in gatsby-config.js:

// Example plugin configuration 
plugins: [
  {
    resolve: 'gatsby-source-prismic',
    options: {
      // ...
      schemas: {
        my_custom_type: require('./custom_types/my_custom_type.json'),
        my_deleted_type: {}
      },
      // ...
    },
  },
]

The plugin queries the Prismic REST API for a list of all Custom Types for the repository. This includes currently used types as well as any deleted types that have been used at least once. The plugin uses this list to verify that all Custom Type schemas have been provided.

This has the side-effect of requiring the empty object for deleted types, but also ensures all the types you are using are provided.

I hope that helps!

2 Likes

Actually this cover everything. I will add empty objects for deleted types. Thanks! :slight_smile:

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.