You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to store a single letter in a yaml frontmatter field using the string widget, but this issue would also apply to a string that happens to match a date format.
Issue #3893 fixed the yaml parser to keep values as strings if quoted, so a quoted "y" or "n" would load as the single character string "y" or "n".
However, the string widget, if you supply a value of "y" or "n", will save the value without quotes. This publishes fine, but then can't be (re)loaded, as is, in the CMS because the (unquoted) values are loaded as "true" or "false".
As for expected behaviour? I'm not entirely sure...
clearly, whatever value you type into the string widget should be (re)loadable as the same value (so typing a "y" shouldn't reload as "true")
but not sure if the string widget should be quoting everything instead; doesn't it (or the YAML parser) need to handle unquoted strings that might well be in existing files (source files that haven't yet been created or edited in the CMS)?
so does there need to be some additional type definition somewhere? e.g. Gatsby needs type definitions for fields that will parse with ambiguous type inference, but then works fine with unquoted values like y or n in string fields. Or is simply configuring the field as needing the string widget not sufficient to imply the desired type?
The text was updated successfully, but these errors were encountered:
I'm trying to store a single letter in a yaml frontmatter field using the string widget, but this issue would also apply to a string that happens to match a date format.
Issue #3893 fixed the yaml parser to keep values as strings if quoted, so a quoted "y" or "n" would load as the single character string "y" or "n".
However, the string widget, if you supply a value of "y" or "n", will save the value without quotes. This publishes fine, but then can't be (re)loaded, as is, in the CMS because the (unquoted) values are loaded as "true" or "false".
As for expected behaviour? I'm not entirely sure...
The text was updated successfully, but these errors were encountered: