Skip to content

Generate SchemaVersion constants from XSDs; validate XSDs against W3C meta-schema#6529

Closed
duncdrum wants to merge 9 commits into
eXist-db:developfrom
duncdrum:dp-schemaver-codegen
Closed

Generate SchemaVersion constants from XSDs; validate XSDs against W3C meta-schema#6529
duncdrum wants to merge 9 commits into
eXist-db:developfrom
duncdrum:dp-schemaver-codegen

Conversation

@duncdrum

@duncdrum duncdrum commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Validates all native XSDs in schema/ against the W3C XSD 1.1 meta-schema at build time (upgrades vendored entity copies from the stale 2004 XSD 1.0 revision to the 2009 XSD 1.1 revision)
  • Generates SchemaVersion.java constants at generate-sources time via schema/generate-schema-version.xsl — bump an XSD's xs:schema/@version and the Java constant follows automatically; no hand-editing required
  • Fixes .xsd document storage: routes XSD-namespace documents through the JAXP 1.1 SchemaFactory validator so XSD 1.1-syntax schemas (xpathDefaultNamespace, xs:assert, etc.) can be stored with collection validation enabled

What changed

Area Files
W3C meta-schema entities exist-core/src/test/resources/.../XMLSchema.xsd, XMLSchema.dtd, datatypes.dtd, xml.xsd; same in exist-jetty-config
SchemaVersion codegen schema/generate-schema-version.xsl, schema/GeneratedSchemaVersions.xml, exist-core/pom.xml (schema-version-codegen execution)
XSD 1.1 storage routing exist-core/.../collections/MutableCollection.java, IndexInfo.java
Tests SchemaVersionFixtureAuditTest, updated SchemaVersionTest

Dependency

Requires #6528 merged first. SchemaVersion.java codegen reads xs:schema/@version from the XSDs shipped in #6528; the .xsd storage routing fix depends on the upgraded meta-schema entity files also introduced here.

Test plan

  • SchemaVersionFixtureAuditTest — generated constants match all XSD @version attributes
  • CollectionConfigurationValidationModeTest.insertModeAuto/True — XSD 1.1 schema documents store without error
  • CI green (Test & documentation + XQTS)

Notes

This is PR-B of a 4-PR split from #6505. Merge order: #6528 → this PR → #6530#6531. Please merge #6528 first; once it lands on develop this branch can be rebased to show only its own commits.

🤖 Generated with Claude Code

duncdrum added 9 commits July 7, 2026 10:35
Wire xml-maven-plugin on the root aggregator to check conf.xml,
collection.xconf.init,
descriptor.xml, controller-config.xml, and mime-types.xml against
schema/*.xsd using
XSD 1.1 (Xerces + xpath2). Centralize version pins and plugin classpath
in exist-parent;
align three schemas with their canonical templates so validation passes.
Add path-filtered ci-schema-checks workflow:  XSL
governance that reads pairs from pom validationSets, compares base
@Version (xpath via GITHUB_ENV) to head, and fails with PR annotations
when a schema or canonical template changes without a version bump.
Lets eXist detect when a config template (conf.xml, collection.xconf,
descriptor.xml, mime-types.xml, controller-config.xml) was authored
against an older revision of its paired XSD. Each schema gains an
optional schemaVersion attribute mirroring xs:schema/@Version; runtime
parsers log a debug message for legacy documents that omit it and warn
when a declared value doesn't match what the running build expects.

see eXist-db#3062
mavenize and simplify the whole operation
fix instance schema-location paths
schema/ now ships at $EXIST_HOME/schema/. Fixed
conf.xml/descriptor.xml/controller-config.xml's schema-location hints,
which were source-tree-relative and never correct for the assembled
layout. Extended catalog.xml with entries for the remaining schemas;

see eXist-db#6189

catalog.xml is not WAI
see eXist-db#5541
see  eXist-db#350
abbrev was already the de-facto name everywhere else (eXist-db#6008).
Extend the existing template-vs-schema validation (pom.xml) to also
check every schema/**/*.xsd is itself a legal schema document, per
the W3C meta-schema. Idea borrowed from eXist-db#5541, where the same catalog
trick lets a user validate their own XSD's well-formedness.

Upgrades the bundled XMLSchema.xsd from the stale, unused 2001/2004
XSD 1.0 revision (no xs:assert/vc: support) to the 2009 XSD 1.1
revision our native schemas actually need, plus its XMLSchema.dtd/
datatypes.dtd dependents and a refreshed xml.xsd. Resolution stays
fully offline via catalogHandling=strict and the shipped catalog.xml.

Caught immediately: 5 schemas carried an xsi:type="dcterms:W3CDTF"
appinfo annotation with no backing schema, never caught before
because nothing validated this strictly. Removed (annotation-only,
no semantic effect) and bumped the affected xs:schema/@Version per
the governance policy, syncing SchemaVersion.java and
collection.xconf.init accordingly.

close eXist-db#5541
Removes manual sync between hand-copied version constants and the XSDs
they describe. Also adds a test reporting which test/sample config
fixtures still lack schemaVersion.
@duncdrum duncdrum force-pushed the dp-schemaver-codegen branch from 24801bd to ed6c307 Compare July 7, 2026 08:38
@duncdrum

duncdrum commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favour of PR #6530 (dp-xsd11-validation), which now includes the full dependency chain that makes CI pass: the XSD 1.1 meta-schema validation (dd51fe3) and the SchemaVersion constants codegen (ed6c307) must land together because ed6c307 was written against the SchemaVersion.java state after dd51fe3's @Version bumps. Both are squashed into the first commit of #6530.

@duncdrum duncdrum closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant