Repository navigation
fix: emit the buyer legal registration identifier (BT-47) - #122
Open
davidkessas-m-oi wants to merge 1 commit into
Open
davidkessas-m-oi wants to merge 1 commit into
davidkessas-m-oi wants to merge 1 commit into
Conversation
The buyer's `organization` node and its `registrationIdentifier` carried no `key`, while their seller counterparts carry `BT-30-00` and `BT-30`. Every profile mask references `BT-47-00` / `BT-47`, and `applyMask` resolves nodes by key, so the lookup returned `undefined` and the whole node was dropped from the effective schema: BT-47 was validated on input, then silently lost. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
commit: |
This branch was previously deployed
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.
Problem
BT-47 (Buyer legal registration identifier,
ram:BuyerTradeParty/ram:SpecifiedLegalOrganization/ram:ID) is accepted as input, validated, and then silently dropped — it never reaches the generated XML, in any profile.The cause is a mask ↔ schema mismatch:
profiles/minimum/schema.tsdeclares the buyer'sorganizationnode and itsregistrationIdentifierwithout akey, while the seller counterparts carrykey: "BT-30-00"andkey: "BT-30".minimum,basic-wl,basic,en16931,extended) do reference"BT-47-00"and"BT-47".applyMaskresolves schema nodes by key (findFieldByKey). A key referenced by the mask but never declared in the schema resolves toundefined, so the whole node is left out of the effective schema.The repo's own MINIMUM fixture (
src/test-utils/data/minimum.ts) already setsregistrationIdentifieron both parties, which makes the asymmetry visible in the current output:SellerTradePartygets its<ram:SpecifiedLegalOrganization>,BuyerTradePartygets only<ram:Name>.This matters in practice for French Factur-X: for public entities (ChorusPro) the buyer identifier is a SIRET and is mandatory — the schema's own description says so. Downstream we currently patch the profile object at runtime to get BT-47 emitted at all.
Fix
Two
keyentries inprofiles/minimum/schema.ts, mirroring the seller side. Every other profile extends MINIMUM, so this one change covers them all. Nothing else is touched — no XML shape change beyond the previously missing element, which is optional in the XSD.Test
formatter.test.tsgets a test that builds the MINIMUM fixture and asserts both parties emit their<ram:SpecifiedLegalOrganization>ID.main: fails withexpected '\n <ram:Name>Kunden AG Frankre…' to contain '<ram:ID schemeID="0002">registrationI…'Full suite is green (12 → 13 tests),
tsc --noEmitclean,biome checkclean on both files.