Issue: Image field type in data files throws error #428

Open
opened 2026-10-05 02:46:48 +02:00 by adam · 4 comments
Owner

I modeled a file for my website data and wanted to add the image field type but it throws the following error:

Message: schema is invalid: data/properties/homeImage/type must be equal to one of the allowed values, data/properties/homeImage/type must be array, data/properties/homeImage/type must match a schema in anyOf

This is the code from the frontmatter.json config file:

"frontMatter.data.files": [
    {
      "id": "websiteData",
      "title": "Website Data",
      "file": "[[workspace]]/data/website.json",
      "fileType": "json",
      "labelField": "name",
      "schema": {
        "title": "Website Data",
        "type": "object",
        "properties": {
          "homeTitle": {
            "title": "Home Title",
            "name": "homeTitle",
            "type": "string"
          },
          "homeImage": {
              "title": "Home Image",
              "name": "homeImage",
              "type": "image",
              "multiple": false,
              "isPreviewImage": true
          },
          "example": {
            "title": "Example data",
            "type": "string"
          }
        }
      }
    }
  ],

Maybe i'm missing something but i can't find any solutions so far. Best regards and thanks for helping out.

I modeled a file for my website data and wanted to add the image field type but it throws the following error: Message: schema is invalid: data/properties/homeImage/type must be equal to one of the allowed values, data/properties/homeImage/type must be array, data/properties/homeImage/type must match a schema in anyOf This is the code from the frontmatter.json config file: ```json "frontMatter.data.files": [ { "id": "websiteData", "title": "Website Data", "file": "[[workspace]]/data/website.json", "fileType": "json", "labelField": "name", "schema": { "title": "Website Data", "type": "object", "properties": { "homeTitle": { "title": "Home Title", "name": "homeTitle", "type": "string" }, "homeImage": { "title": "Home Image", "name": "homeImage", "type": "image", "multiple": false, "isPreviewImage": true }, "example": { "title": "Example data", "type": "string" } } } } ], ``` Maybe i'm missing something but i can't find any solutions so far. Best regards and thanks for helping out. <!-- github-sync-id:1627353234 -->
Author
Owner

Hi @anthonykasabian,

The data view only supports a valid JSON schema and types, as we use a library, called uniforms for it.

In your case using the image type will let the form rendering fail as it is not a valid type and should be one of the following:

  • string
  • number
  • array
  • object

That said, supporting more types or even our own internal fields would be a hug win, but requires some work to enhance the experience.

Thanks for reporting this.

Hi @anthonykasabian, The data view only supports a valid JSON schema and types, as we use a library, called [uniforms](uniforms.tools) for it. In your case using the `image` type will let the form rendering fail as it is not a valid type and should be one of the following: - string - number - array - object That said, supporting more types or even our own internal fields would be a hug win, but requires some work to enhance the experience. Thanks for reporting this. <!-- github-comment-id:1472070085 -->
Author
Owner

Hy again @estruyf and thanks for your kind words. And yes it would be definetly a good thing to extend those functionalities. I saw alot of people bumping around with all this frontmatter stuff and i did a bunch of projects using forestry. The good thing was, yes blocks is fine but a better approach was to make things more sperated. Like the good old SOC. So we managed all additional data in data files and inside the templates we reused those data inside the markdown files. It's way more cleaner to handle it that way and make it maintainable. The approach to store everything into frontmatter is like css in js :p

But more or less your tool is a fine piece of software so far. Keep up the good work.

Hy again @estruyf and thanks for your kind words. And yes it would be definetly a good thing to extend those functionalities. I saw alot of people bumping around with all this frontmatter stuff and i did a bunch of projects using forestry. The good thing was, yes blocks is fine but a better approach was to make things more sperated. Like the good old SOC. So we managed all additional data in data files and inside the templates we reused those data inside the markdown files. It's way more cleaner to handle it that way and make it maintainable. The approach to store everything into frontmatter is like css in js :p But more or less your tool is a fine piece of software so far. Keep up the good work. <!-- github-comment-id:1472725754 -->
Author
Owner

Great to hear, and data view does deserve some more attention, so keep the feedback coming for it.

Great to hear, and data view does deserve some more attention, so keep the feedback coming for it. <!-- github-comment-id:1473593168 -->
Author
Owner

Hello! I'm currently looking exactly at this to support a person uploading galleries, and so something that allows them to work with something akin to the image preview selector to make an array of images would be the cleanest way to do so.

This is a neat little project, and probably going to be very helpful to me personally actually getting my own personal projects happening too.

Hello! I'm currently looking exactly at this to support a person uploading galleries, and so something that allows them to work with something akin to the image preview selector to make an array of images would be the cleanest way to do so. This is a neat little project, and probably going to be very helpful to me personally actually getting my own personal projects happening too. <!-- github-comment-id:2972236960 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#428