Is there a way to createSchemaCustomization but only if the type is incorrect

exports.createSchemaCustomization = ({ actions }) => {
  const { createTypes } = actions;
  const typeDefs = `
  type AirtableData implements Node {
    ${constants.claimsField}: [Airtable]
    ${constants.interruptsField}: [Airtable]
    ${constants.demographicsField}: [Airtable]
    ${constants.carouselsField}: [Airtable]
  }
`;

In the above example, is it possible for me to define only the fields that are the incorrect type (such as being String) rather than explicitly defining my fields as such. I want to just add defaults to my schema (its created by a plugin). The plugin generates incorrect types for when data is not there on my backend, and this breaks all my queries and causes builds to fail. If I use the above strategy of being explicit...then my queries also stop working. I am using https://www.gatsbyjs.com/plugins/gatsby-source-airtable/ and need to do this as a last step to ensure my schema allows for "non-existent" values. How would I go about this?


AFAIK it's not possible to give the same field different types i.e sometimes String, sometimes Int.. I think what you want to do is to use union type:

type MyUnionType = String | Int

type Data implements Node {
  fieldName: [MyUnionType]
}