Skip to content

feat: support union types in FieldDescriptor.type#269

Merged
mcanouil merged 1 commit intomainfrom
feat/union-type-support
Feb 17, 2026
Merged

feat: support union types in FieldDescriptor.type#269
mcanouil merged 1 commit intomainfrom
feat/union-type-support

Conversation

@mcanouil
Copy link
Copy Markdown
Owner

Summary

  • Widen FieldDescriptor.type from string to string | string[] to support union types (e.g. type: [number, boolean]).
  • Add typeIncludes and formatType utility functions exported from @quarto-wizard/core.
  • Update all providers (completion, diagnostics, hover, tree items) to use the new utilities instead of direct === "boolean" / === "object" comparisons.
  • Fix inline attribute diagnostics: only skip validation when the union has no inline-representable members, not when it contains any non-inline type.

Test plan

  • Verify core tests pass (430 tests).
  • Verify extension tests pass (342 passing, 10 pre-existing failures in activate.test.ts).
  • Open a Quarto document with a _schema.yml that uses type: [number, boolean] and verify completions, hover, and diagnostics work correctly.
  • Verify inline attribute diagnostics correctly validate union types (e.g. {val=42} accepted for [number, array], {val=hello} rejected).

Widen FieldDescriptor.type from string to string | string[] so schemas
can declare union types such as type: [number, boolean].

Add typeIncludes and formatType utilities to replace direct === checks
across all providers (completion, diagnostics, hover, tree items).

Fix inline attribute diagnostics to only skip validation when the union
has no inline-representable members, rather than when it contains any
non-inline type.
@mcanouil mcanouil added the Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses label Feb 17, 2026
@mcanouil mcanouil self-assigned this Feb 17, 2026
@mcanouil mcanouil enabled auto-merge (squash) February 17, 2026 13:40
@mcanouil mcanouil disabled auto-merge February 17, 2026 13:40
@mcanouil mcanouil merged commit a870e04 into main Feb 17, 2026
7 checks passed
@mcanouil mcanouil deleted the feat/union-type-support branch February 17, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement 💡 Issues related to enhancements, improvements, new features, or new analyses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant