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

Issue: VSCode issues shows path not allowed in frontMatter.data.files #343

Closed
davidsneighbour opened this issue May 26, 2022 · 5 comments
Closed
Labels
bug Something isn't working Project: v8.0.0

Comments

@davidsneighbour
Copy link

Latest version.

Describe the bug
Working on my configuration file in VSCode I see a yellow underline in the path-property of the following code sample:

{
  "$schema": "https://frontmatter.codes/frontmatter.schema.json",
  "frontMatter.data.files": [
    {
      "id": "all-sponsors",
      "path": "[[workspace]]/kollitsch/music.toml",
      "type": "sponsors"
    }
  ],
  "frontMatter.data.folders": [],
  "frontMatter.data.types": [
    {
      "id": "sponsors",
      "title": "Sponsors",
      "fileType": "json",
      "labelField": "name",
      "schema": {
        "title": "Sponsors",
        "type": "object",
        "required": [
          "name",
          "url"
        ],
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "url": {
            "type": "string",
            "title": "URL"
          },
          "description": {
            "type": "string",
            "title": "Description"
          }
        }
      }
    }
  ]
}

The overlay says: "Property path is not allowed.". The documentation of that feature includes a path property: https://frontmatter.codes/docs/dashboard#re-using-a-data-type-for-files-or-folders

Either the docs or the schema used to parse the config has an issue here.

20220526-20:51:02-Selection-001

@davidsneighbour davidsneighbour added the bug Something isn't working label May 26, 2022
@davidsneighbour
Copy link
Author

I see the same issue in other files, so maybe I should add some in-depth details:

The following json:

{
  "$schema": "https://frontmatter.codes/frontmatter.schema.json",
  "frontMatter.taxonomy.fieldGroups": [
    {
      "id": "author",
      "labelField": "name",
      "fields": [
        {
          "title": "Author Name",
          "name": "name",
          "type": "string",
          "single": true
        },
        {
          "title": "Social link",
          "name": "social",
          "type": "string",
          "single": true
        }
      ]
    },
  ],
}

leads to the same issue with labelField.

I have structured my configuration into a subfolder that has a watch job on changes and recreates the frontmatter.json on change. The errors/warning come up in the single files, not the resulting frontmatter.json. But from how I understand the $schema property this should not impede these subfiles? Also, other properties (fields, id, etc) are not complained about.

If you want a sample, have a look at my website repo: https://github.com/davidsneighbour/kollitsch.dev

  • clone it
  • run npm install, cook a coffee, it takes a bit, sorry
  • check for the vscode issue reports in assets/config/frontmatter/
    • partials/dashboard-data.json
    • partials/fieldgroups.json
  • run the job to create frontmatter.json via npm run build:frontmatter

@estruyf
Copy link
Owner

estruyf commented May 26, 2022

Either the docs or the schema used to parse the config has an issue here.

This was an issue with the documentation. I have fixed it. The path property should have been file.

"frontMatter.data.files": [
  {
    "title": "All sponsors",
    "id": "all-sponsors",
    "file": "[[workspace]]/kollitsch/music.toml",
    "type": "sponsors"
  }
]

@estruyf
Copy link
Owner

estruyf commented May 26, 2022

Leads to the same issue with labelField.

Also, an issue that slipped into the documentation. The frontMatter.taxonomy.fieldGroups setting only needs the id and fields properties. By updating the documentation, I found a bug in the schema, which will be fixed in version 7.3.1.

@estruyf
Copy link
Owner

estruyf commented May 26, 2022

The 7.3.1 release is published which should fix the (unseen) issue.

Thanks, @davidsneighbour for mentioning the documentation issues. It is very much appreciated!

@estruyf estruyf closed this as completed May 26, 2022
@estruyf estruyf reopened this Jun 15, 2022
@estruyf
Copy link
Owner

estruyf commented Jun 15, 2022

Linking this to #356

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Project: v8.0.0
Projects
None yet
Development

No branches or pull requests

2 participants