fikaproductions / fika-gatsby-source-cockpit

This is a Gatsby version 2.\*.\* source plugin that feeds the GraphQL tree with Cockpit Headless CMS collections and singletons data. Actually, it supports querying raw texts (and any trivial field types), Markdown, images, galleries, assets, sets, repeaters, layout(-grid)s (currently only without nested images/assets), objects, linked collections and internationalization.
GNU General Public License v3.0
23 stars 22 forks source link

Warning caused by repeater field values #10

Closed 1moeses closed 5 years ago

1moeses commented 5 years ago

Hi, I'm getting a warning caused by my repeater-field and can't query any value. Is the repeater-field already supported in your plugin?

Warning:

warning There are conflicting field types in your data. GraphQL schema will omit those fields. CockpitPages.content.value[].value:

  • type: object value: { imageField: [Object] }
  • type: string value: 'Some second content blablaa.'

Edit: Options JSON of Repeater:

{
  "fields": [
    {
      "type": "textarea",
      "name": "textField",
      "label": "Text"
    },
    {
      "type": "set",
      "name": "addGalleryField",
      "label": "Add Gallery",
      "options": {
        "fields": [
          {
            "type": "text",
            "name": "galleryTitleField",
            "label": "Gallery Title"
          },
          {
            "type": "gallery",
            "name": "galleryField",
            "label": "New Gallery"
          }
        ]
      }
    },
    {
      "type": "set",
      "name": "addImageField",
      "label": "Add Image",
      "options": {
        "fields": [
          {
            "type": "text",
            "name": "imageTitleField",
            "label": "Image Title"
          },
          {
            "type": "image",
            "name": "imageField",
            "label": "New Image"
          }
        ]
      }
    }
  ]
}

Thanks

WhippetsAintDogs commented 5 years ago

Hi, the repeater field is not currently supported by the plugin. I'll implement it soon, I'll keep you posted :)

DigitalGoldfish commented 5 years ago

There are two different "modes" in which a repeater field can operate - a repeater where each field has the same type/structure or a repeater where entries might have a different structure from each other. The first use case is already partially supported. Images, Galleries & Markdown will not be resolved but scalar values will be in the GraphQL Tree.

The above described use case is the second and trickier use case as GraphQL does not allow for differying value types for a field. In order to support this use case I guess every entry needs to be wrapped in a wrapper object like this

{
  type: "addGalleryField",
  addGalleryField: { ... },
  addImageField: null,
  textField: null
}
1moeses commented 5 years ago

This is wonderful, thank you guys. Where is your donation button ;)?

WhippetsAintDogs commented 5 years ago

@diehenne Haha, it is at the top of the web page, it's written "Star" on it ;)

WhippetsAintDogs commented 5 years ago

@diehenne Repeater are now integrated in version 1.0.13+.