fix: correct Factur-X XMP attribute and CII element ordering in merged profiles#112
Open
jankal wants to merge 2 commits intojslno:mainfrom
Open
fix: correct Factur-X XMP attribute and CII element ordering in merged profiles#112jankal wants to merge 2 commits intojslno:mainfrom
jankal wants to merge 2 commits intojslno:mainfrom
Conversation
Contributor
|
@jankal is attempting to deploy a commit to the better-auth-extended Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
defu's internal `Object.assign({}, defaults)` clones the last source
argument first, giving its key order priority. In `mergeSchemas`,
the extending profile's schema (e.g. EN16931) is the last argument
to `defu()`, so its incomplete key set determines the element order.
Keys that only exist in the base profiles (e.g. identifier, note,
tradeDelivery from BASIC) get appended at the end instead of appearing
in the correct CII XML element order.
Add a `reorderSchema` step after the merge that walks the schema tree
and reorders keys to match the base (extended) profiles' key order,
which defines the correct CII element sequence. Keys only present in
the extending profile are appended at the end.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e4f14cc to
cd29e24
Compare
chrizzellu
added a commit
to chrizzellu/node-zugferd
that referenced
this pull request
Feb 12, 2026
When profiles like EN16931 or EXTENDED extend BASIC, defu's internal Object.assign gives the extending profile's key order priority. This pushes base-only keys (identifier, note, tradeDelivery) to the end, producing invalid CII XML element sequences. Adds a reorderSchema post-processing step that walks the merged schema tree and reorders keys to match the base profiles' element sequence. Based on jslno#112. Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
xmlns:about=""→rdf:about=""in the Factur-Xrdf:DescriptionXMP metadata, which prevented validators (KoSIT, sevDesk) from discovering the embedded XML attachmentdefu, which produced invalid element sequences for profiles that extend BASIC (EN16931, EXTENDED)Details
1. Factur-X XMP
rdf:aboutattribute (formatter/pdf)The Factur-X
rdf:Descriptionblock usedxmlns:about=""which declares an invalid XML namespace prefix instead of the correctrdf:about=""RDF resource identifier. Validators parse XMP/RDF to locate the Factur-X XML attachment filename — this malformed attribute caused them to fail, even though the XML wascorrectly embedded via
/Names/EmbeddedFilesand/AF.Note: #111 fixed the other
rdf:Descriptionblocks but missed this Factur-X-specific one.2. Schema merge key ordering (
formatter/xml)mergeSchemasusesdefu({}, mergedExtensions, profile.schema)to combine base and extending profile schemas. Internally,defuclones the last argument first viaObject.assign({}, defaults), giving its key order priority. When the extending profile (e.g. EN16931) only defines a subset of keys(
tradeProduct,tradeAgreement,tradeSettlement), base-only keys (identifier,note,tradeDelivery) get appended at the end instead of their correct CII position.This adds a
reorderSchemapost-processing step that walks the merged schema tree and reorders keys to match the base profiles' element sequence.Test plan