Is your feature request related to a problem? Please describe.
Hi Elio,
I searched through issues, but haven't found anything relevant. I'm testing your extension with Astro (Starlight). Does the Front Matter CMS allows to describe the union type?
I tried the AI assistant on Front Matter's website and it hallucinated a solution 😆
To create a Front Matter field that allows the tableOfContents to be either a boolean or an object with specific properties, you can use the union field type. This type allows you to define multiple types for a single field. Below is an example of how you can define such a field in your Front Matter configuration:
The type is set to union, which allows the field to accept multiple types.
The types array includes two types:
A boolean type.
An object type with the fields minHeadingLevel and maxHeadingLevel.
This setup ensures that the tableOfContents field can either be a boolean or an object with the specified properties.
## **Is your feature request related to a problem? Please describe.**
Hi Elio,
I searched through issues, but haven't found anything relevant. I'm testing your extension with Astro (Starlight). Does the Front Matter CMS allows to describe the `union` type?
In [Zod](https://zod.dev/?id=unions), it's described like this:
```
tableOfContents: z.union([
z.strictObject({
minHeadingLevel: z.number().int().min(1).max(6).optional().default(2),
maxHeadingLevel: z.number().int().min(1).max(6).optional().default(3),
}),
z.boolean().transform((enabled) => (enabled ? defaults : false)),
])
```
## **Describe the solution you'd like**
The ability to describe unions would be great.
## **Describe alternatives you've considered**
I tried to use the `fieldGroups`, but without success:
https://github.com/estruyf/vscode-front-matter/assets/33784221/c19ed5a1-3259-435b-b9d6-c3a7c68e2813
## **Additional context**
I tried the AI assistant on Front Matter's website and it hallucinated a solution 😆
> To create a Front Matter field that allows the `tableOfContents` to be either a `boolean` or an `object` with specific properties, you can use the `union` field type. This type allows you to define multiple types for a single field. Below is an example of how you can define such a field in your Front Matter configuration:
>
> ```
> {
> "name": "tableOfContents",
> "title": "Table of content settings",
> "type": "union",
> "types": [
> {
> "type": "boolean"
> },
> {
> "type": "object",
> "fields": [
> {
> "name": "minHeadingLevel",
> "title": "Minimum heading level",
> "type": "number",
> "numberOptions": {
> "min": 2,
> "max": 6
> }
> },
> {
> "name": "maxHeadingLevel",
> "title": "Maximum heading level",
> "type": "number",
> "numberOptions": {
> "min": 2,
> "max": 6
> }
> }
> ]
> }
> ]
> }
> ```
>
> In this configuration:
>
> The `type` is set to `union`, which allows the field to accept multiple types.
> The `types` array includes two types:
> - A `boolean` type.
> - An `object` type with the fields `minHeadingLevel` and `maxHeadingLevel`.
>
> This setup ensures that the `tableOfContents` field can either be a `boolean` or an `object` with the specified properties.
<!-- github-sync-id:2303057343 -->
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.
Is your feature request related to a problem? Please describe.
Hi Elio,
I searched through issues, but haven't found anything relevant. I'm testing your extension with Astro (Starlight). Does the Front Matter CMS allows to describe the
uniontype?In Zod, it's described like this:
Describe the solution you'd like
The ability to describe unions would be great.
Describe alternatives you've considered
I tried to use the
fieldGroups, but without success:https://github.com/estruyf/vscode-front-matter/assets/33784221/c19ed5a1-3259-435b-b9d6-c3a7c68e2813
Additional context
I tried the AI assistant on Front Matter's website and it hallucinated a solution 😆