P1.x: e-SLOG 2.0 XSD output validation#2
Merged
Conversation
validateEslogXml(xml) validates produced e-SLOG XML against the OFFICIAL
e-SLOG 2.0 XSD (eSLOG20_INVOIC_v200.xsd + its xmldsig-core-schema.xsd import),
vendored from the epos.si Aug-2020 package, via xmllint compiled to WASM
(xmllint-wasm — no native bindings, bun-friendly). XSDs loaded via bun text
imports so they ship in the package with no build step.
Also: generateEInvoice(..., { validateOutput: true }) validates on the way out;
new EslogValidationError (422) carries the XSD issues.
Closes the conformance loop: the P1 serializer's output is confirmed valid
against the official XSD (regression-locked vs both our output and the official
sample invoice). 29/29 tests pass; tsc clean.
No official schematron is published (business rules are spec prose) — that
remains deferred per ROADMAP.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
What this adds
The P1.x slice the coordinator flagged: validate the produced e-SLOG XML against the official e-SLOG 2.0 XSD, not just the EN16931 model structurally.
validateEslogXml(xml)— validates e-SLOG XML againsteSLOG20_INVOIC_v200.xsd(+ itsxmldsig-core-schema.xsdimport), via xmllint compiled to WebAssembly (xmllint-wasm) — no native bindings, bun-friendly.generateEInvoice(..., { validateOutput: true })— validate on the way out.EslogValidationError(422) carrying the XSD issues (line-located).Conformance result (the point of this slice)
The P1 serializer's output is confirmed valid against the official XSD — and it's regression-locked: tests validate both our output and the official sample invoice from the epos.si package.
Provenance
The XSDs are the official, unmodified schema from the e-SLOG 2.0 (Aug 2020) package published by ePOS/GZS (
epos.si/eslog→e-SLOG-2.0-08-2020-EN.zip), vendored undersrc/lib/eslog/schema/with aPROVENANCE.md. Loaded via bun text imports (with { type: "text" }, seesrc/types.d.ts) so they ship in the package with no build step.Schematron — why it's not here
The official e-SLOG 2.0 package ships no
.sch: the business rules (arithmetic, conditional presence) are prose in the spec PDFs. The XSD enforces structure/types only. Encoding those rules as checks is a future slice (noted inROADMAP.md); the EN16931 model-level structural validation from P1 already covers the UBL/CII path.Verification
bun test→ 29 pass / 0 fail (+4 over P1: our-output-conformant, official-sample-validates, schema-violation-fails-with-issues, validateOutput path).bunx tsc --noEmit→ clean.Notes
fb41c05(merged P1).xmllint-wasm(pure WASM).src/test/as a fixture; the 1.6↔2.0 mapping.xlsxfrom the package are not vendored.🤖 Generated with Claude Code