Skip to content

Attachments in gobl convert and the API, with the multipart part named "data" - #69

Merged
samlown merged 5 commits into
mainfrom
convert-attachments-data
Oct 15, 2026
Merged

samlown merged 5 commits into
mainfrom
convert-attachments-data

Conversation

@samlown

@samlown samlown commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

#68 was merged into #67's branch, convert-export-options, after #67 had already been merged. Its changes never reached main. This PR brings them onto main, with one change.

Change

The multipart part that carries the GOBL JSON in POST /v0/export is named data instead of document, since it may hold either a document or an envelope:

curl -F data=@invoice.json -F attachment=@invoice.pdf "https://gobl.dev/v0/export?format=ubl+peppol+bis-v3"

The handler, the no data part error, the tests, the README and the OpenAPI schema use the new name, and the descriptions say the part holds GOBL JSON, a document or an envelope. document was never on main, so nothing deployed used it.

From #68

  • gobl convert --attach and --attachments DIR.
  • Multipart /v0/export with data and attachment parts.
  • /v0/import with the GOBL-Attachments header and ?attachments=true.
  • Request body limits in line with Peppol: 100 MB for import, 75 MB for export, and 413 when exceeded.

See #68 for the details. Tests and lint pass locally.

🤖 Generated with Claude Code

samlown and others added 5 commits October 15, 2026 16:41
gobl convert --attach embeds files on export, and --attachments saves
the files embedded in an imported document. /v0/export takes a multipart
body with the document and attachment parts, and /v0/import counts
embedded files in GOBL-Attachments, returning them with
?attachments=true.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
/v0/import accepts up to 100 MB, as Peppol access points must, and
/v0/export up to 75 MB including attachments, so the exported document
stays within 100 MB after base64 encoding. Larger requests get 413.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Embed and extract attachments with gobl convert and the API
The part holds GOBL JSON, either a document or an envelope.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.65248% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.83%. Comparing base (5ae52dd) to head (580eef0).

Files with missing lines Patch % Lines
api/convert.go 87.17% 5 Missing and 5 partials ⚠️
cmd/gobl/convert.go 87.23% 3 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #69      +/-   ##
==========================================
+ Coverage   64.68%   65.83%   +1.14%     
==========================================
  Files          53       53              
  Lines        2577     2710     +133     
==========================================
+ Hits         1667     1784     +117     
- Misses        812      820       +8     
- Partials       98      106       +8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@samlown
samlown merged commit 26e6b9d into main Oct 15, 2026
2 checks passed
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.

2 participants