Skip to content

Fix duplicate schema definitions causing YAML validation issues#14136

Open
jdonaldson wants to merge 3 commits intoquarto-dev:mainfrom
jdonaldson:fix/duplicate-schema-definitions
Open

Fix duplicate schema definitions causing YAML validation issues#14136
jdonaldson wants to merge 3 commits intoquarto-dev:mainfrom
jdonaldson:fix/duplicate-schema-definitions

Conversation

@jdonaldson
Copy link

Summary

Fixes #14122.

When the same option name (e.g., logo, subject) is defined in multiple schema YAML files, objectRefSchemaFromGlob() silently overwrites — last writer wins. This causes YAML validation errors when users specify valid values that match a "losing" schema variant.

  • logo: Add enum: [false] to logo-light-dark-specifier-path-optional so logo: false validates for all formats (dashboard, revealjs, typst), matching the existing logo-light-dark-specifier behavior
  • subject: Consolidate into document-metadata.yml as anyOf: [string, object] covering both simple (pdf/office) and structured (epub) forms; remove duplicate entry from document-epub.yml
  • Regenerated all build artifacts (json-schemas.json, schema-types.ts, editor tooling)
  • Added unit tests for both cases

Test plan

  • schema-schema.test.ts — 3/3 pass (schema YAML files well-formed)
  • schema-files.test.ts — 4/4 pass (2 existing + 2 new test cases)
    • logo-false.yml — validates false accepted by logo-light-dark-specifier-path-optional
    • subject-structured.yml — validates structured object form passes schema validation
  • Manual verification: logo: false in dashboard format renders without validation error
  • Manual verification: structured subject in epub format renders without validation error

…to-dev#14122)

When the same option name is defined in multiple schema YAML files,
objectRefSchemaFromGlob() silently overwrites — last writer wins. This
caused validation errors for valid values matching a "losing" variant.

- Add `enum: [false]` to `logo-light-dark-specifier-path-optional` so
  `logo: false` validates for all formats (dashboard, revealjs, typst)
- Consolidate `subject` schema into document-metadata.yml as
  `anyOf: [string, object]` covering both simple and structured epub forms
- Remove duplicate `subject` entry from document-epub.yml
- Add unit tests for both cases
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Mar 1, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@jdonaldson
Copy link
Author

Just adding a small comment that there's a human behind this PR. I used Claude here to make some small changes, which were reviewed before submitting. Tests are also added.

@cderv cderv requested a review from cscheid March 2, 2026 08:19
@cderv cderv added the triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. label Mar 2, 2026
Now that logo-light-dark-specifier-path-optional accepts `false`,
return `undefined` explicitly for all falsy values rather than
leaking `false` through to resolveLogo.
@gordonwoodhull
Copy link
Contributor

This pointed out a minor (possibly harmless) bug in resolveLogo so I've added a fix.

Verifies that the consolidated subject schema in document-metadata.yml
correctly renders structured subject values (text/authority/term) into
EPUB3 OPF metadata.
Copy link
Contributor

@gordonwoodhull gordonwoodhull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed the logo part (my bug) - looks good, adding a tiny fix.

The subject resolution also makes sense to me.

Claude did not think the structured epub subject test was a rigorous enough test, so we've also added a smoke-all test. I'll let it comment on that.

Copy link
Contributor

@gordonwoodhull gordonwoodhull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

End-to-end epub test for structured subject — The subject-structured.yml schema test inlines a copy of the schema rather than referencing it (unlike the logo-false.yml test which uses ref:). This means it validates the shape of the anyOf but not the actual schema Quarto uses — if someone later changes document-metadata.yml, this test would still pass against its own detached copy. Added subject-structured-epub.qmd as a smoke-all test that renders an actual epub with structured subject metadata and verifies the OPF output contains the expected dc:subject, authority, and term elements. This exercises the full pipeline: schema validation → metadata resolution → Pandoc rendering.

@cscheid cscheid added this to the v1.10 milestone Mar 2, 2026
@cscheid
Copy link
Collaborator

cscheid commented Mar 2, 2026

Hello, and thanks for the PR! We will need you to fill out the original template for the PR, specifically because we need you to attest you've signed the CLA for this project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate schema definitions cause YAML validation issues

5 participants