Skip to content

Generate GOBL→UBL converter mapping docs - #57

Open
alvarolivie wants to merge 1 commit into
mainfrom
gbl-68-converter-mapping
Open

Generate GOBL→UBL converter mapping docs#57
alvarolivie wants to merge 1 commit into
mainfrom
gbl-68-converter-mapping

Conversation

@alvarolivie

Copy link
Copy Markdown
Contributor

Linear: GBL-68

Adds a Converters section to the docs, starting with GOBL → UBL. See the Converters → GOBL to UBL page in the preview deploy.

How the mapping is built

The table is generated deterministically, not hand-written, by joining two data legs on the shared EN16931 Business Term:

Leg Source Owner
GOBL → BT terms/en16931.yaml this repo (semantic leg)
BT → UBL imported from gobl.ubl/terms the converter module

Crucially, neither leg is derived from the converter's Go code — both are curated, BT-keyed YAML, so GOBL → UBL is their composition (GOBL field → BT-xx → UBL XPath) rather than a third table that could drift. Because BT is the join key, future EN16931-family converters (CII, FacturX) reuse the same GOBL→BT leg and only add their own BT→target leg.

Changes

  • cmd/generate/converters.go — load both legs, join on BT id, render the table (139 rows where both legs map a path).
  • New generator phase in main.go; Converters nav group in docs.json.
  • converters/overview.mdx (hand-written) + generated converters/ubl.mdx.
  • gobl.ubl adds a terms package that embeds its mapping YAML and exposes a typed parser (gobl.ubl@cb8797c, pinned here).

Scope / follow-ups

Base case only. Deliberately not in this PR:

  • Per-context overlays — Peppol/XRechnung/France CIUS add BTs and re-path existing ones (override semantics); the flat table shows base EN16931 only.
  • Sentinel verification test in gobl.ubl — set a GOBL field to a unique value, run Convert(), assert it lands at the declared XPath — to keep the YAML honest against the code.
  • The GOBL→BT leg currently covers ~34 terms; expanding it widens the table.

Independent of the external-addons PR (#56) and based on main, so it carries no #847 dependency.

🤖 Generated with Claude Code

Adds a Converters section to the docs, starting with GOBL→UBL. The mapping
table is generated deterministically by joining two data legs on the shared
EN16931 Business Term:

- GOBL→BT: this repo's terms/en16931.yaml (the semantic leg)
- BT→UBL: imported from github.com/invopop/gobl.ubl's new terms package

Neither leg is derived from converter code: both are curated, BT-keyed data,
so GOBL→UBL is their composition rather than a hand-maintained third table.

- cmd/generate/converters.go: load both legs, join on BT id, render the table
- new phase in main.go; Converters nav group in docs.json
- converters/overview.mdx + generated converters/ubl.mdx (139 rows)

Base case only: per-context overlays (Peppol/XRechnung/France re-pathing) and
the sentinel test that verifies the YAML against actual Convert() output are
follow-ups.

Refs GBL-68.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mintlify

mintlify Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
gobl 🟢 Ready View Preview Jun 4, 2026, 11:14 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant