This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
OpenAPI 3.0 specification for the Smartling REST API, published at https://api-reference.smartling.com/. The spec is split across multiple YAML files under spec/ and bundled at build time into a single swagger.json/swagger.yaml for rendering via ReDoc/Swagger UI.
npm install # install dependencies (Node 26 LTS, same as the Jenkins image node:26-trixie; see .nvmrc)
npm start # build, start local server + swagger-editor (live reload)
npm test # validate the OpenAPI spec (swagger-repo validate)
npm run build # bundle spec into web_deploy/ (swagger-repo, then redocly via scripts/bundle-refs.js)
npm run lint:spec # redocly lint of web_deploy/swagger.json (run after npm run build)
npm run process-yaml # re-generate TQC x-paths (required after editing TQC YAML files)The local server URL is printed to console on startup. The swagger-editor URL is also printed separately (port 5000+).
spec/openapi.yaml- root file: server, global tags (with long descriptions), and$refpaths to all sub-specsspec/api_common.yaml- shared reusable components: parameters (accountUid,projectId,projectUid,localeId,offset,limit), request bodies, reusable error responses (Error400ResponseDefinition,Error401ResponseDefinition,Error429ResponseDefinition,Error500ResponseDefinition), and common schemas (ID and UID types such asLocaleId,ProjectUid,UserUid,TranslationJobUid;Hashcode,FileUri,FileType,DateTime;SuccessResponse,EmptyResponseand theError*Responseenvelopes)- Each API domain lives in its own subdirectory:
spec/translation_quality/- TQC endpoints split across many files; usesx-pathsextension and requiresnpm run process-yamlafter editsspec/issues/- Issues, issue comments, watchers, dictionaries, sub-typesspec/job_batches_v1/andspec/job_batches_v2/- Job batch endpointsspec/glossary_v3/- Glossary, blocklist, import/export, labels, entriesspec/webhooks_api/- Webhook subscriptions, events, componentsspec/file_translation/- File MT upload, MT, language detectionspec/strings/- Strings API v2 (usesx-pathsextension)spec/connectors_import_v3/- Connectors Import APIspec/tmm/- Translation Memory (TMX import/download) endpoints; usesx-pathsextension
Global headers: The headers: top-level key (non-standard) is supported - references like $ref: "#/headers/Rate-Limit-Limit" are inlined and the headers block is removed during build so the output remains valid OpenAPI.
x-paths extension: spec/translation_quality/, spec/strings/, and spec/tmm/ use a custom x-paths key (not the standard paths) with $ref includes. Running npm run process-yaml resolves these refs and merges them into spec/openapi.yaml. Always run this after editing TQC or Strings YAML files (spec/tmm/ does not need this step - see spec/process-yaml.js, which only lists translation_quality/*.yaml).
Build output: npm run build produces web_deploy/ containing the bundled spec (swagger.json, swagger.yaml), the static web UI, and copies of all spec subdirectories.
Adding a new domain as a standalone spec file/folder: after swagger-repo bundle, scripts/bundle-refs.js runs redocly bundle on swagger.json and swagger.yaml and inlines every path-item $ref (the pattern every domain subdirectory uses, standard paths or the custom x-paths extension alike), so the published spec is self-contained. Redocly resolves the refs against the copied spec/ folders in the output directory, so every new domain subdirectory must be added to the hardcoded spec/ copy list in both:
scripts/build.js(used bynpm run build, the main site)scripts/deploy-branch.js(used by Jenkins for branch/PR previews,npm run deploy-branch)
A missing copy-list entry now fails the build (Can't resolve $ref) instead of silently rendering a tag with zero operations. Sub-files must reference shared components through ../api_common.yaml#/components/.... A root-relative #/components/... ref in a sub-file fails the bundle. npm run lint:spec lints the bundled web_deploy/swagger.json with Redocly (config in redocly.yaml).
- Reuse the
api_common.yamlschemas and parameters for IDs, UIDs, locales, hashcodes, file URIs, file types, dates and error envelopes instead of declaring inlinetype: stringcopies. - Match by property meaning, not only by shape:
sourceLocaleIdandtargetLocaleIduseLocaleId,projectIdusesProjectUid,*UserUidusesUserUid,*WorkflowStepUidusesWorkflowStepUid, date-time strings useDateTime. - Keep a property's
descriptionwhen it adds meaning beyond the shared schema (role, owning entity, relationship), usingallOfwith the$refplus a siblingdescription. Drop it only when it restates the type, for example "Locale id.". - Give array
itemsa$refor a fully typed schema. Never leaveitemsempty or use baretype: stringwhen a shared schema fits (for examplelocaleIdsitems areLocaleId). - Add
minItems,maxItemsanduniqueItemsonly when the API enforces the limit and the description or code says so. Do not invent limits. - Check
api_common.yamlbefore declaring a new inline schema. Keep an inline definition only when the shared constraint conflicts with real values, and nullable fields stay inline becauseallOfwith a$refcannot expressnullin OAS 3.0. - Sub-files reference shared components as
../api_common.yaml#/components/...(adjust the relative path to the file depth).spec/openapi.yamluses./spec/api_common.yaml#/...for schemas, but keeps shared parameters and responses inline becausenpm testcannot resolve an external$refin those positions.
- Jenkins builds on every branch; non-master branches deploy a preview - the URL depends on whether a PR is open:
- No PR open:
https://api-reference.smartling.com/preview/<branch-name-lowercase> - PR open:
https://api-reference.smartling.com/preview/pr-<number>(Jenkins uses the PR ref asBRANCH_NAME)
- No PR open:
masterdeploys to the main documentation site- Preview branches are not auto-cleaned; stale previews must be cleaned manually via the
gh-pagesbranch (see README.md)