Generate SchemaVersion constants from XSDs; validate XSDs against W3C meta-schema#6529
Closed
duncdrum wants to merge 9 commits into
Closed
Generate SchemaVersion constants from XSDs; validate XSDs against W3C meta-schema#6529duncdrum wants to merge 9 commits into
duncdrum wants to merge 9 commits into
Conversation
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.
24801bd to
ed6c307
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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)SchemaVersion.javaconstants atgenerate-sourcestime viaschema/generate-schema-version.xsl— bump an XSD'sxs:schema/@versionand the Java constant follows automatically; no hand-editing required.xsddocument storage: routes XSD-namespace documents through the JAXP 1.1SchemaFactoryvalidator so XSD 1.1-syntax schemas (xpathDefaultNamespace,xs:assert, etc.) can be stored with collection validation enabledWhat changed
exist-core/src/test/resources/.../XMLSchema.xsd,XMLSchema.dtd,datatypes.dtd,xml.xsd; same inexist-jetty-configschema/generate-schema-version.xsl,schema/GeneratedSchemaVersions.xml,exist-core/pom.xml(schema-version-codegenexecution)exist-core/.../collections/MutableCollection.java,IndexInfo.javaSchemaVersionFixtureAuditTest, updatedSchemaVersionTestDependency
Requires #6528 merged first.
SchemaVersion.javacodegen readsxs:schema/@versionfrom the XSDs shipped in #6528; the.xsdstorage routing fix depends on the upgraded meta-schema entity files also introduced here.Test plan
SchemaVersionFixtureAuditTest— generated constants match all XSD@versionattributesCollectionConfigurationValidationModeTest.insertModeAuto/True— XSD 1.1 schema documents store without errorNotes
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
developthis branch can be rebased to show only its own commits.🤖 Generated with Claude Code