Repository navigation
feat(xsender): read the answers into types generated from the core's schema - #248
Merged
Merged
Conversation
…schema `make sync` now also copies the SUNAT answers generated from the schema of the core into io.github.project.openubl.xsender.models.answers (CDR, Fault, NoCDR, ConsultStatus, Status and the answer unions), so a field added to them in xhandler-rust arrives with the next core sync (xhandler-rust docs/adrs/BINDINGS.md). They ignore fields a newer core adds. SunatResponses reads the answers into them instead of field by field and maps them to the existing SunatResponse / Metadata / Sunat API, which doesn't change. SunatResponse.getCdr() also exposes the generated CDR, so later CDR fields reach users without a hand edit. The Quarkus extension registers the answers for reflection, as xbuilder does its models. Co-Authored-By: Claude Opus 5.5 <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.
Why
The SUNAT answers were typed by hand here. A field added in xhandler-rust (like the CDR's
document_description) needed a hand edit in every binding, and could be silently dropped. xhandler-rust 6.0.0-alpha.2 generates them from the core's schema (project-openubl/xhandler-rust#613,docs/adrs/BINDINGS.md). This is the last step of that design: from now on, a new answer field arrives with the release's sync PR, with no hand edit.What
make syncalso copies the generated answers intoio.github.project.openubl.xsender.models.answers(inSYNCED).SunatResponsesreads the core's answers into those types withJson.MAPPER, instead of reading each field by hand. A failure becomes anXhandlerException, as inXBuilder.enrich. It's split intosend,verifyandconsult.SunatResponse/Metadata/Sunat/StatusAPI doesn't change. New:SunatResponse.getCdr()returns the generatedCDR, so later CDR fields reach users without a hand edit.SunatResponsesTestsends an unknown field to check this.Verified
The xsender core tests (43) and the Quarkus xsender extension tests pass.
make verify-release TAG=v6.0.0-alpha.2passes. The native build runs in this PR's CI.Senior review
Two passes. Findings applied:
__all__completedJson.MAPPERandXhandlerException, and copies the notes listThe second pass found nothing left.
🤖 Generated with Claude Code