feat(docs): document embedded-API entity types as an APIModels reference#2305
Merged
Conversation
Re-export the @gusto/embedded-api component entity types referenced across src
through src/models/external.ts, surfaced as the APIModels namespace, so TypeDoc
documents their shapes in the reference instead of rendering bare unlinked text.
- build/deriveExternalModels.ts generates the barrel (version-agnostic; auto
value/type detection; backfills TSDoc summaries for entities the upstream
package leaves undocumented, which excludeNotDocumented would otherwise drop).
Wired in via models:derive / models:verify.
- rewrite {@link Entity} prose refs to {@link APIModels.Entity}.
- typedoc-custom router: link each entity's "Defined in" to gusto-typescript-client
at the installed package's version tag, and place APIModels last in the sidebar
as "API Models" (its own group, not under Namespaces).
Generated reference output (docs/reference, .reports) intentionally left for CI.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add a derive-models job that generates src/models/external.ts once and uploads it as the derived-models artifact. build (→ dist → API report) and derive-check-src (→ TypeDoc docs) both download that single artifact, so every derived output in a run reflects the same barrel. derive-commit pushes external.ts, docs, and the API report together as one self-consistent commit; a stale barrel hard-fails on main/merge_group/dependabot. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
deriveExternalModels emitted raw output, so CI's derive-commit pushed an unformatted src/models/external.ts that failed format:check. Run the rendered barrel through the repo's Prettier config before writing so models:derive output matches format:check and the auto-derived commit stays green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Introduces a new @gusto/embedded-api component entity (Department) into src so CI's derive-models picks it up. Intentionally commits only the source import — external.ts, the reference docs, and the API report are left for CI's derive-commit to regenerate, to verify they all update in a single commit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
deriveExternalModels now follows each referenced entity's type references — same-file siblings and ./<module> imports within models/components — so sub-types (e.g. a department's employees/contractors, an employee's jobs/garnishments) are documented and linked in the APIModels reference instead of rendering bare. Also reverts the temporary Department reference added to exercise the auto-derive pipeline. external.ts, the reference docs, and the API report are left for CI's derive-commit to regenerate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
serikjensen
approved these changes
Jun 30, 2026
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
Documents the
@gusto/embedded-apientity types in the SDK reference. Previously every hook/component that returned a raw embedded-API type (Form,Employee,Compensation, …) rendered it as bare, unlinked text in the generated tables, because those types live outside TypeDoc's entry point.models/components/*entity types through a generated barrel (src/models/external.ts), surfaced as theAPIModelsnamespace fromsrc/index.ts, so TypeDoc documents their full shapes and every reference becomes a link.build/deriveExternalModels.ts, wired in viamodels:derive/models:verify):package.json)excludeNotDocumentedsilently drops them)./<module>imports) so sub-types likeDepartmentEmployees,Job,MinimumWagesare documented and linked instead of rendering bareformat:check{@link Entity}prose refs to{@link APIModels.Entity}.gusto-typescript-clientat the installed version tag (e.g.…/blob/gusto_embedded_v_2025_11_15/v0.0.2/…#L11), with the correct source line.APIModelsis pinned to the end as "API Models" (its own group, not under "Namespaces").derive-modelsjob single-sources the barrel;build(→ API report) andderive-check-src(→ docs) both consume that one artifact, soexternal.ts+ docs + report regenerate consistently in onederive-commit.Distributed size impact
No runtime impact. The namespace is exported type-only (
export type * as APIModels), so it is fully erased from the JS bundle.dist/**/*.js)dist/**/*.d.ts)Why there's no runtime cost or tree-shaking hazard:
external.jschunk is emitted, andAPIModelsappears in zerodistJS files — the type-only namespace re-export is stripped by the TS transform before bundling.dist/models/external.d.tsis 29.7 KB of re-export lines only — zero inlined type bodies. The actual model definitions stay in@gusto/embedded-api(already a dependency); they are not copied into ourdist.APIModels.Employeepulls only the type into their type-check — nothing into their bundle. The value-enums the barrel re-exports (GarnishmentType, etc.) are reached at runtime only via their existing direct imports in components, never via this barrel.So the entire footprint of this feature on the published artifact is ~30 KB of additional
.d.tsre-export lines, and 0 bytes of runtime JS.Generated output
docs/reference/**and.reports/*.mdare intentionally not committed here — CI'sderivestep regenerates and commits them (it already has on this branch).src/models/external.tsis committed because it is part of the compile graph.🤖 Generated with Claude Code