Issue: type of "default" value for fields is "string". #242

Closed
opened 2026-10-05 02:35:34 +02:00 by adam · 1 comment
Owner

To Reproduce

Create a custom default content type:

	"frontMatter.taxonomy.contentTypes": [
			{
			  "name": "default",
			  "pageBundle": false,
			  "fields": [
				{
				  "title": "Title",
				  "name": "title",
				  "type": "string",
				  "single": true,
				},
				{
				  "title": "Is in draft",
				  "name": "draft",
				  "type": "draft",
				  "default": true
				}
			  ]
			}
		  ],

In the problems section of visual studio code, this message appear:

Incorrect type. Expected "string".

The message concern the default value of field "draft", which is a boolean.

Furthermore, If the default value is set to "false", it is equivalent to true in Front Matter. An empty default ("") is equivalent to false.

Expected behavior

There should be no issue with a default value with a type other than string.

And if string type is the only possibility, A default set to "false" should set the field to false.

Desktop (please complete the following information):

  • OS: Ubuntu 21.10 Impish Indri
**To Reproduce** Create a custom default content type: ``` "frontMatter.taxonomy.contentTypes": [ { "name": "default", "pageBundle": false, "fields": [ { "title": "Title", "name": "title", "type": "string", "single": true, }, { "title": "Is in draft", "name": "draft", "type": "draft", "default": true } ] } ], ``` In the problems section of visual studio code, this message appear: > Incorrect type. Expected "string". The message concern the default value of field "draft", which is a boolean. Furthermore, If the default value is set to `"false"`, it is equivalent to `true` in Front Matter. An empty default (`""`) is equivalent to `false`. **Expected behavior** There should be no issue with a default value with a type other than string. And if string type is the only possibility, A default set to `"false"` should set the field to `false`. **Desktop (please complete the following information):** - OS: Ubuntu 21.10 Impish Indri <!-- github-sync-id:1190903196 -->
adam closed this issue 2026-10-05 02:35:34 +02:00
Author
Owner

Thanks @landure for opening this issue. The default field was indeed set to string in the schema. This just got fixed and another code fix as well. It will be available in version 7.1.0 and the latest beta.

Thanks @landure for opening this issue. The `default` field was indeed set to `string` in the schema. This just got fixed and another code fix as well. It will be available in version 7.1.0 and the latest beta. <!-- github-comment-id:1087171712 -->
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#242