Add printer_han (CJK) support and close SDK/docs gaps vs API v3 - #9
Merged
Conversation
Add the printer_han field (required for Chinese/Japanese/Korean text — omitting it silently replaces every such character with `?`) to CreatePrintJobRequest and CreateUsbPrintJobRequest, with a new docs/receipt-layout/asian-characters.md reference page and two runnable examples. Also close gaps found while diffing the repo against the official API docs: - request_timestamp is now optional (returned by the API but undocumented) - printer_status documented as an activation flag, not live connectivity - new docs/getting-started/errors.md and docs/concepts/delivery-and-idempotency.md - openapi.yaml (OpenAPI 3.1, all 16 operations) - test/client.test.mjs + ci.yml (Node 18/20/22) - AGENTS.md, llms.txt, CONTRIBUTING.md, SECURITY.md, CHANGELOG.md, issue/PR templates - docs/integrations.md indexing the ~140 no-code/e-commerce/delivery integrations Bumps 1.0.2 -> 1.1.0.
The user provided the site's sitemap, which confirms the canonical URL pattern is docs.expedy.io/en/<category>/<subcategory>/<slug> — the integrations index and the text-encoding-settings cross-reference were missing the locale segment.
node --test's own glob resolution for a quoted pattern is a newer Node feature — Node 18 doesn't have it and looks for a literal file named "test/*.test.mjs", failing CI on that matrix leg. Letting bash expand the glob before Node sees it works identically on Node 18/20/22.
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
The official API docs (v3 export) document a new request-body field,
printer_han,required to print Chinese, Japanese or Korean text on both print endpoints
(
printers.createPrintJobanddevices.usb.createPrintJob). Without it, the servercomposes the ticket in single-byte mode and silently replaces every CJK character with
?before the job reaches the printer — no error is raised.printer_han("cn" | "kr" | "jp" | "1") toCreatePrintJobRequestandCreateUsbPrintJobRequest, exported asPrinterHan/PrinterHanScript.docs/receipt-layout/asian-characters.mdand two runnable examples (
examples/receipt-asian-characters.ts,examples/device-rpi-usb-print-asian.ts).text-layout-tags.md,docs/README.mdand the rootREADME.mdupdatedto reference it.
While diffing the full doc export (340 articles) against the repo, I also found and fixed:
CreatePrintJobResponse.request_timestampis now optional. It's returned by the APIbut isn't part of the documented v3 response contract — this is the one type change that
could affect existing consumers who read it without an optional check.
printer_statusdocumented as an activation flag ("1"/"0"), not a liveconnectivity indicator — the repo previously just said "numeric status flag".
src/types/*.tsfor fields that had no explanation in code(
last_ping,notification_url,printer_graphic_mode, …).docs/getting-started/errors.md(status codes by endpoint,ExpedyErrorvsExpedyApiError) anddocs/concepts/delivery-and-idempotency.md(a200meansaccepted/queued, not printed; no de-duplication).
Additional groundwork requested alongside the CJK fix
openapi.yaml— OpenAPI 3.1 description of all 16 operations,printer_hanas anenum, matches
src/types/**. Linted clean with@redocly/cli.test/client.test.mjs(Node's built-in test runner, no dependency,mocks
fetchvia the config the client already accepts) and.github/workflows/ci.yml(Node 18/20/22: typecheck, build, typecheck examples, test).
publish.ymlis untouched.AGENTS.md,llms.txt.CONTRIBUTING.md,SECURITY.md,CHANGELOG.md(retro-filled fromgit history), issue templates, PR template.
docs/integrations.md— indexes the ~140 no-code/e-commerce/delivery platforms fromthe doc export (Zapier, Shopify, WooCommerce, Uber Eats, n8n, …), each linking to
docs.expedy.io, with a short "SDK vs. no-code" decision note.Bumps
1.0.2→1.1.0(package.json + package-lock.json).docs/integrations.mdlinks — verified against the site's sitemapThe links initially missed the
/en/locale segment. The user provided the actualdocs.expedy.iositemap, which confirms the canonical pattern isdocs.expedy.io/en/<category>/<subcategory>/<slug>(e.g.docs.expedy.io/en/expedy-print/api-print-v2/create-a-print-job). All 140 links indocs/integrations.md, plus the cross-reference inasian-characters.md, have beencorrected to include it.
Test plan
npm run typecheck && npm run build && npm run typecheck:examples— passnpm test(node --test) — 12/12 pass, including a CJK round-trip test and testsconfirming
printer_hanreaches the JSON body on both endpointsnpx @redocly/cli lint openapi.yaml— validplaceholder values consistent with the existing repo conventions
docs/integrations.mdlink pattern verified against the site's sitemapSuggested repo metadata (not something I can set via the tools available to me)
thermal-printer,receipt-printer,escpos,cloud-printing,pos-printer,raspberry-pi,label-printer,print-api,nodejs,typescript,sdk,google-cloud-print-alternative,cjkhttps://docs.expedy.iov1.1.0off this PR is what triggerspublish.yml(OIDC trusted publishing) and gives the version its own indexed page.
🤖 Generated with Claude Code