ITADN

[ast] 2c: Split factory primitives from high-level domain builders

#3584Closedstijnvanhulle 创建于 2026-06-14
enhancement@kubb/core
S
stijnvanhullecommented
Part of #3573 (Epic 2: remove overlapping and mislabeled abstractions). ## Goal The `factory` namespace should mean "the `ts.factory` analogue": low-level node constructors from `nodes/*.ts` plus `createFile`/`update`. Two high-level, OpenAPI-aware builders are currently surfaced through `export * as factory` and do not belong there: - `createOperationParams` - `createDiscriminantNode` Expose these only via `@kubb/ast/utils` (`operationParams.ts` / `transformers.ts`), not via the `factory` namespace. ## Files - `packages/ast/src/factory.ts` — remove the re-exports of `createOperationParams` and `createDiscriminantNode`; leave only `nodes/*` constructors, `createFile`, `update`. - Add a short doc note (in the file header and/or the README/architecture doc) explaining the primitive-vs-builder split. - `kubb-labs/plugins` — update any call sites that use `factory.createOperationParams` / `factory.createDiscriminantNode` to import from `@kubb/ast/utils`. **This is the one change with cross-repo consumer impact** — grep the plugins repo first. ## Acceptance - `factory` exports only primitive constructors + `createFile`/`update`. - `createOperationParams`/`createDiscriminantNode` still reachable via `@kubb/ast/utils`. - Both repos green; plugin snapshots byte-identical. ## Dependencies Depends on #1e (operationParams module) and #2b (transformers home for `createDiscriminantNode`). Coordinate the plugins-repo call-site update in the same PR window.
关闭于 2026-06-15 0 条评论