With this frontmatter.json, the second cover format is invalid (which is okay by me) and throws an error because an expected string does not have a .startsWith method. The field needs to be typecast somehow before applying filters and transformations.
Is there a way to make Frontmatter understand two possible field formats, or have it ignore the field (not validate it)?
Even if not, it should not error loudly with a popup; instead, it should "simply" complain about incorrect frontmatter during the validation of the frontmatter when the file is opened/saved.
The error:

My frontmatter for the cover image is defined via Astro's content.config.ts schema:
```ts
cover: z
.union([
z.string(),
z.object({
src: z.string(),
title: z.string().optional(),
}),
])
.optional(),
```
which means both of the following are valid:
```yaml
cover: some-filename.jpg
cover:
src: some-filename.jpg
title: a title for the file
```
In my frontmatter.json, I see no way to configure an "either or" for the field type of the cover:
```
"frontMatter.taxonomy.contentTypes": [
{
"name": "default",
...
"fields": [
...
{
"title": "Content preview",
"name": "cover",
"type": "image",
"isPreviewImage": true
}
]
}
]
```
With this frontmatter.json, the second `cover` format is invalid (which is okay by me) and throws an error because an expected string does not have a `.startsWith` method. The field needs to be typecast somehow before applying filters and transformations.
Is there a way to make Frontmatter understand two possible field formats, or have it ignore the field (not validate it)?
Even if not, it should not error loudly with a popup; instead, it should "simply" complain about incorrect frontmatter during the validation of the frontmatter when the file is opened/saved.
<!-- github-sync-id:3154881949 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The error:
My frontmatter for the cover image is defined via Astro's content.config.ts schema:
which means both of the following are valid:
In my frontmatter.json, I see no way to configure an "either or" for the field type of the cover:
With this frontmatter.json, the second
coverformat is invalid (which is okay by me) and throws an error because an expected string does not have a.startsWithmethod. The field needs to be typecast somehow before applying filters and transformations.Is there a way to make Frontmatter understand two possible field formats, or have it ignore the field (not validate it)?
Even if not, it should not error loudly with a popup; instead, it should "simply" complain about incorrect frontmatter during the validation of the frontmatter when the file is opened/saved.
@davidsneighbour it will be testable in the latest beta version.