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: type of "default" value for fields is "string". #306

Closed
landure opened this issue Apr 3, 2022 · 1 comment
Closed

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

landure opened this issue Apr 3, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@landure
Copy link

landure commented Apr 3, 2022

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
@estruyf estruyf added the bug Something isn't working label Apr 4, 2022
estruyf added a commit that referenced this issue Apr 4, 2022
@estruyf
Copy link
Owner

estruyf commented Apr 4, 2022

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.

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

No branches or pull requests

2 participants