Repository navigation
Conversation
Upgrade GOBL to v0.508.0 and offer conversions between GOBL and external formats through its new convert package. Only formats registered with the register are offered, replacing the hand-maintained format list of #22. Modules: gobl v0.507.0 -> v0.508.0 gobl.ar.arca new v0.0.3 (ar-arca-v4 moved out of core) gobl.co.dian new v0.0.3 (co-dian-v2 moved out of core) gobl.ubl new v0.86.0 (registers ubl+ formats) gobl.cii new v0.69.0 (registers cii+ formats) gobl.fi.finvoice v0.0.2 -> v0.0.6 gobl.it.sdi v0.81.0 -> v0.83.0 gobl.mx.cfdi v0.64.0 -> v0.68.0 gobl.pl.ksef v0.45.0 -> v0.47.0 GOBL 0.508.0 changes handled: - The ARCA and DIAN addons now live in their own modules; blank-import both in the bundle so the approved addon test passes. - data/addons was removed. Addon definitions are already served from the registry, so only the TestListDataDir subtest reading it is dropped. - Shortened schema descriptions and the new tax/filter schema: refresh the correction options snapshots and the bulk schema expectations. Conversions: - internal/ops: Formats, Import and Export wrap the convert register. Export envelops documents and calculates unsigned envelopes first, so drafts can be exported directly. - CLI: `gobl convert` exports with --to (keys in order of preference), imports with format detection otherwise (--from limits it), and lists the formats with --list. - API: GET /v0/formats, POST /v0/import and POST /v0/export?format=, taking raw bodies. The format used is returned in a GOBL-Format header, exposed through CORS. Unescaped "+" in keys is accepted. - Editor: an Export picker lists the registered export formats and shows the result in a read-only XML pane beside the editor, via /v0/export. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #63 +/- ##
==========================================
- Coverage 72.56% 64.48% -8.09%
==========================================
Files 48 53 +5
Lines 1994 2568 +574
==========================================
+ Hits 1447 1656 +209
- Misses 467 813 +346
- Partials 80 99 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Rework the editor around three modes: - Build: as before, the GOBL source is replaced with the built document. - Export: the source is left untouched; /v0/export builds it internally and the result is shown in a read-only viewer. The formats offered are those registered with the convert package whose export schemas include the document's schema and whose addons are all declared by it, after expanding addon requirements as GOBL does when building. - Import: a separate XML input is converted through /v0/import, and the resulting envelope is shown in the viewer. Add bare-minimum example documents for the US, UK, Spain (with and without VERI*FACTU), Germany (EN 16931 and XRechnung), France and the Netherlands (EN 16931), Italy (SDI), Portugal (SAF-T) and Mexico (CFDI). Their region and label are derived from the regime and addon registries, loaded lazily so externally implemented addons are registered first. In import mode an example is offered as the output of its first export format. Tests build every example and export it into every format the editor would offer it. ubl+peppol+bis-v3 is recorded as a known gap: it also exports bill/status, so the EN 16931 addon it needs for invoices is only checked in Accepts and is missing from the register's metadata. The mode, example and format are remembered in localStorage. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 15, 2026
Upgrade to GOBL v0.508.1 and add the converters that register regional formats with its convert package: gobl v0.508.0 -> v0.508.1 gobl.ubl v0.86.0 -> v0.87.0 gobl.cii v0.69.0 -> v0.70.0 gobl.de.xinvoice new v0.0.6 (XRechnung, ZUGFeRD) gobl.fr.ctc v0.0.8 -> v0.0.9 (CTC, Factur-X, Chorus Pro, CDAR) gobl.sa.zatca v0.0.4 -> v0.0.5 (ZATCA) gobl.it.sdi v0.83.0 -> v0.84.0 gobl.pt.saft v0.0.8 -> v0.0.9 gobl.pt.saft v0.0.9 requires Go 1.26.1, so the go directive moves up and the Docker builder image moves to golang:1.26-alpine (its GOTOOLCHAIN is local, so the build would otherwise fail). GOBL v0.508.1 removes Format.Addons, and converters now explain in Accepts why they refuse a document, as rules faults. Only a converter can tell whether it accepts a document, and the register only asks while exporting, so: - ops.CheckFormats reports, for each format that exports the document's schema, whether it accepts it, by exporting a copy of the envelope, and the refusal reasons. It takes about 9ms for all 21 export formats. - POST /v0/formats exposes the checks through the API and OpenAPI spec. - The editor's export picker lists the formats the server reports as accepting the source, rechecking and re-exporting as it is edited, replacing the client-side addon matching. The ubl+peppol+bis-v3 gap this had goes away. - Examples carry the formats that accept them, those specific to their country first, so loading one selects its most specific format and import samples use it. Add bare-minimum examples for ZUGFeRD, Factur-X, French CTC, Chorus Pro and ZATCA, so that every invoice export format is accepted by at least one example, which a test now checks. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Replace the build, export and import modes with two: - Build: the GOBL editor fills the page, with the example picker, envelop option and Build button directly above it. - Convert: the GOBL editor sits beside an editable document in another format. The GOBL pane's bar holds the example picker, the formats that accept the document and Export, which writes it into the other editor. The other pane's bar holds Import, which replaces the GOBL document, and samples made by exporting the examples into their most specific format. ⌘/Ctrl+Enter runs the action of the focused editor. The top bar keeps only the title, the mode switch and the dark mode toggle, and the read-only viewer goes, as results are written into the editors. Formats are still checked as the GOBL document is edited, but it is no longer re-exported, so a document pasted on the other side is not overwritten. Stored export and import modes map onto convert. /v0/import now returns the detected format in the GOBL-Format header, via ops.Import, so the other pane can be labelled and the format picker defaults to exporting back into the format a document was imported from. Co-Authored-By: Claude Opus 5.5 (1M context) <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.
Upgrades GOBL to v0.508.1 and adds conversions between GOBL and external formats, built on GOBL's
convertregister. This supersedes #22: rather than a hand-maintained list of formats, gobl.dev offers exactly the formats the bundled converters register.Converters
All are blank-imported in
bundle/bundle.go. Together they register 23 formats, 21 of which can export:ubl+en16931-v2017,ubl+peppol+bis-v3cii+en16931-v2017,cii+peppol+bis-v3ubl+/cii+de-xrechnung-v3,cii+de-zugferd-v2(+basic,+extended)ubl+/cii+fr-ctc-cius-v1,ubl+/cii+fr-ctc-extended-v1,cii+fr-ctc-facturx-v1,cii+fr-facturx-v1(+basic,+extended),cii+fr-choruspro-v1,cdar+fr-ctc-cdv-v1(+ppf)ubl+sa-zatca-v1Surfaces
internal/ops—Formats,Import,Export, andCheckFormats.Exportwraps documents in an envelope and calculates unsigned envelopes first, so drafts export directly.CheckFormatscovers every format that exports the document's schema and reports whether that format accepts the document, with the reasons for refusals.CLI —
gobl convert:API —
GET /v0/formats,POST /v0/formats(check a document),POST /v0/import, andPOST /v0/export?format=…./v0/exportreturns the key of the format used, and/v0/importthe key of the format detected, in theGOBL-Formatheader, which CORS exposes.+in keys can be left unescaped in query strings.not-supportedwith rules faults.Editor — two modes, with each action directly above the editor it reads from:
The top bar keeps only the title, the mode switch and dark mode. There are 17 bare-minimum region examples in
editor/examples/, labelled from the regime and addon registries. The mode, example, sample and format choices persist across reloads.Accepting documents
GOBL v0.508.1 removed
Format.Addons. Each converter'sAcceptsnow decides, and explains a refusal with faults. The register only consultsAcceptsduring an export, soCheckFormatschecks a format by exporting a copy of the envelope to it. Checking all 21 export formats takes about 9 ms. Ifconvertever exposesAcceptsdirectly,CheckFormatsbecomes a one-line change. This also fixes the earlierubl+peppol+bis-v3gap: it now refuses invoices without EN 16931.Other module updates
godirective ingo.mod, and the Docker builder moves togolang:1.26-alpine; the old image hasGOTOOLCHAIN=local, so its build would fail. CI readsgo.mod, so it needs no change.data/addonsis gone, and the shortened schema descriptions and newtax/filterschema need refreshed snapshots.Testing
go test -race ./...passes. Every example builds and exports into every format that accepts it, and every invoice export format is accepted by at least one example.Known upstream limitation
Importing a Factur-X or ZUGFeRD EN 16931 profile document can't recover its addon. That profile declares exactly the plain EN 16931 guideline ID (
urn:cen.eu:en16931:2017), so it's detected ascii+en16931-v2017. The BASIC and EXTENDED profiles, XRechnung, the French CTC formats, Chorus Pro and ZATCA all round-trip their addons.🤖 Generated with Claude Code