Repository navigation
feat(common): ESPI resources inside atom:content, and XSD validation of ESPI XML (#197) - #280
Merged
Merged
Conversation
…of ESPI XML (#197) Atom entries now carry their ESPI resource as the single child of <atom:content>, as REQ.21's examples and CMD-certified Data Custodian feeds do, for both usage (UsageAtomEntryDto) and customer (CustomerAtomEntryDto) entries. The constructors and getContent() keep taking and returning the resource; getResource() now returns it after unmarshalling (it read a base-class field that was never set, so it was always null). - EspiXmlSchemaValidator (openespi-common xml/) validates a feed or entry against atom.xsd + espi.xsd + customer.xsd (the GBA DMD validator's files) from the classpath, with a local xml.xsd, reporting every issue with its line and column. It never fetches external DTDs or schemas. - The validator found two DC export defects, now fixed: feeds wrote a feed-level atom:published (RFC 4287 has none; atom.xsd rejects it), and an empty feed's self link had no type (atom.xsd requires one; it is now taken from the feed href). - AtomFeedExportTest checks that UsagePoint, empty and Customer feeds from the DC export validate; AtomContentAndSchemaValidationTest covers the content wrapper, a certified-style feed, round trips, error reporting with lines, and that external DTDs are not followed. - Third Party: UsagePointRESTRepositoryImpl handles an empty feed and skips entries that are not UsagePoints. The two @disabled tests of UsagePointRESTRepositoryIntegrationTest are replaced by UsagePointRESTRepositoryImplTests (real WebClient, stubbed exchange). - docs/ESPI_ATOM_PROFILE.md records how ESPI deliberately differs from RFC 4287 (no atom:author for privacy, bare atom:content, link rel/type required) so they are not "fixed"; the DTOs, BaseExportService, the validator and CLAUDE.md point to it. ServiceCategory and other enums are still written as Java constant names (#278). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#197) - Third Party: each UsagePoint takes its id from the entry's atom:id (the mapper copies only espi.xsd fields), so findByHashedId no longer fails on a null id; entries that are not UsagePoints are counted in a warning (never logged as content). The test's mapper no longer sets the id. - EspiXmlSchemaValidator: validate(String) reads characters, so a declared encoding cannot garble the text; a SAXParseException thrown without the error handler is recorded as FATAL, never reported as valid. - AtomFeedDto: the unused, never-written feed published field is removed (RFC 4287 4.1.1, atom.xsd), with its setters and constructor arguments. - Tests: AssertJ assertions on one object chained (CLAUDE.md); new tests for the entry id, a declared ISO-8859-1 encoding, and a non-uuid id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 18, 2026
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.
Closes #197
Summary
ESPI resources are now carried inside
<atom:content>, as REQ.21, the GBAatom.xsd(the DMD validator's) and certified feeds require. Before, the DTOs wrote the resource as a direct child of<atom:entry>. This PR also adds a shared XSD validator for ESPI XML.Atom
<content>wrapper (openespi-common)UsageAtomEntryDtoandCustomerAtomEntryDtoeach map a nestedContentclass asatom:content. Its@XmlElementslist holds the usage.xsd or customer.xsd resource types, so each entry still declares only its own namespace.AtomEntryDtono longer holdscontent.getContent()/setContent()are abstract, andgetResource()returns the content.<atom:content>has notypeand there is noatom:author. Both are intentional; see the docs below.EspiXmlSchemaValidator(openespi-commonxml/)LSResourceResolverresolves the Atom andxml.xsdimports. A localESPI_4.1/xml.xsdis added, copied from the DMD validator.Export defects found by the validator
<published>element, which atom.xsd doesn't allow. It is now@XmlTransient(RFC 4287 4.1.1 doesn't define one either).type, which atom.xsd requires.BaseExportService.buildFeednow setsespi-feed/{resource}, using the last path segment of the href when no resource name is given.Third Party reader
UsagePointRESTRepositoryImplreads UsagePoints fromatom:contentthroughAtomEntryDto::getResource. A null or empty feed returns an empty list.UsagePointRESTRepositoryImplTestsuses a realWebClientwith a stubbed exchange function. It replaces the old disabled-style integration test.Documentation
docs/ESPI_ATOM_PROFILE.md, linked fromCLAUDE.md. It covers:rel/typerequired;Not in this PR
ELECTRICITY.Batch/Subscription.Test plan
New
AtomContentAndSchemaValidationTest(9 tests):AtomFeedExportTestvalidates the real usage, customer and empty feed output against the XSDs.Full suite on Docker (WSL), with Testcontainers for MySQL and PostgreSQL:
The About controller tests were excluded (AboutControllerTest fails on a JDK whose java.version is exactly "25" (matches Bootstrap w-25) #277).
🤖 Generated with Claude Code