Skip to content

v1.0.4

Choose a tag to compare

@reteps reteps released this 13 May 23:57
· 39 commits to master since this release
3353cda

customTagDeprecations lint rule

JSON Schema's deprecated: true is an annotation, not a validator — AJV silently ignores it. A new lint rule (default severity warning) walks each custom-tag element + its registered schema in parallel and surfaces deprecations at four levels, folding any sibling description into the diagnostic as the reason:

  • Tag<pl-legacy> is deprecated. Use <pl-question-panel> instead.
  • AttributeAttribute "old-name" on <pl-card> is deprecated. Renamed to "answers-name".
  • Attribute valueValue "legacy" for attribute "kind" on <pl-card> is deprecated. Use "new". (matched via oneOf/anyOf const branches; skipped for mustache-interpolated values)
  • Child tag in context<pl-answer-old> as a child of <pl-choice> is deprecated. (matched via properties.children.items branches keyed by properties.tag.const)

Structural deprecation (tag, attribute) walks only unconditional composition (root + allOf) — branches inside anyOf/oneOf/if describe alternate value validations and don't structurally deprecate the attribute they live on.

Disable per-element via the existing infrastructure: <!-- htmlmustache-disable customTagDeprecations -->.

Schema diagnostics: collapse composition-wrapper noise

With AJV's allErrors: true, a single bad attribute like correct="trsue" against an anyOf: [boolean, string-with-format-pl-boolean] schema used to produce three diagnostics — the boolean-branch type failure plus two raw AJV strings without attribute context. They now collapse to one:

Attribute "correct" on <pl-answer> child of <pl-multiple-choice> must be boolean or match format "pl-boolean".

Errors are grouped by instancePath and dispatched on the wrapper keyword: anyOf/oneOf join their translated branch phrases with "or"; if/allOf wrappers are dropped (pure bookkeeping over their branches); not translates generically; an ajv-errors errorMessage at any path overrides the merged result.

format, pattern, minLength, maxLength, exclusiveMinimum, and exclusiveMaximum are now translated with attribute context too.

LSP: schema-aware completion

Inside any custom-tag element the language server now offers, driven by the tag's registered schema:

  • Attribute names — every property the schema allows (across allOf/anyOf/oneOf and if/then branches), excluding attributes already present on the element. Required attributes are flagged.
  • Attribute values — concrete candidates from enum, const, examples, default, and type: "boolean" declarations across all branches. When no concrete values are available, surfaces the declared format name as a hint.

No new config surface — drives directly off the existing customTags[*].schema.