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

Add schema customisation to gatsby-source-contentful #24117

Closed
2 tasks
wardpeet opened this issue May 15, 2020 · 2 comments
Closed
2 tasks

Add schema customisation to gatsby-source-contentful #24117

wardpeet opened this issue May 15, 2020 · 2 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: source-contentful Related to Gatsby's integration with Contentful type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.

Comments

@wardpeet
Copy link
Contributor

wardpeet commented May 15, 2020

Summary

Enable schema customization for contentful data. Contentful gives us all the information we need to create typings.

Rich Text is the hardest one because it contains a JSON blob. In my opinion, it should stay that way. I'm not certain how we handle it currently in the plugin, so it might become a breaking change.

Schema customization gives us faster type creation and also better error messaging when not all content is present yet.

Rich Text preview:
{
  "fields": [
    {
      "id": "title",
      "name": "Title",
      "type": "Symbol",
      "localized": false,
      "required": false,
      "validations": [],
      "disabled": false,
      "omitted": false
    },
    {
      "id": "test",
      "name": "test",
      "type": "RichText",
      "localized": false,
      "required": false,
      "validations": [
        {
          "nodes": {}
        },
        {
          "enabledMarks": [
            "bold",
            "italic",
            "underline"
          ],
          "message": "Only bold, italic, and underline marks are allowed"
        }
      ],
      "disabled": false,
      "omitted": false
    }
  ],
}
An entry with one reference:
{
  "fields": [
    {
      "id": "parentPage",
      "name": "Parent Page",
      "type": "Link",
      "localized": false,
      "required": false,
      "validations": [
        {
          "linkContentType": [
            "page"
          ]
        }
      ],
      "disabled": false,
      "omitted": false,
      "linkType": "Entry"
    },
  ]
}
An entry with multiple references:
{
  "fields": [
    {
      "id": "associatedPage",
      "name": "Associated Page",
      "type": "Link",
      "localized": false,
      "required": false,
      "validations": [
        {
          "linkContentType": [
            "jobsBlock",
            "keyvisual",
            "page"
          ]
        }
      ],
      "disabled": false,
      "omitted": false,
      "linkType": "Entry"
    },
  ]
}

Todo

  • create an option in gatsby-contentful-plugin to enable schema customization
  • Setup schema customization

Prior art: #12816

@wardpeet wardpeet added the type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. label May 15, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 15, 2020
@wardpeet wardpeet added status: inkteam assigned 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 15, 2020
@github-actions
Copy link

github-actions bot commented Jun 5, 2020

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jun 5, 2020
@github-actions
Copy link

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

Contentful source plugin improvements automation moved this from To do to Done Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. topic: source-contentful Related to Gatsby's integration with Contentful type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Development

No branches or pull requests

1 participant