Skip to content

feat(config): multi-spec projects array drives N generations from one file (#238)#288

Merged
benjamineckstein merged 1 commit into
mainfrom
feature/238-multi-spec-config
Jun 10, 2026
Merged

feat(config): multi-spec projects array drives N generations from one file (#238)#288
benjamineckstein merged 1 commit into
mainfrom
feature/238-multi-spec-config

Conversation

@benjamineckstein

Copy link
Copy Markdown
Contributor

Summary

New projects: [...] array in config files lets one config drive N spec generations (orval-style). Introduces normalized loadConfigs() API and defineProjects() helper, exported from all four packages. Shared runProjects iteration kernel in openapi-zod-ts/config-core handles sequential execution with [i/N] logging and fail-fast behavior, replacing per-package loops.

Key changes

  • New projects: [...] array config option for multi-spec generation
  • New loadConfigs() (plural) normalized API and defineProjects() helper exported from all packages
  • Shared runProjects iteration kernel in openapi-zod-ts/config-core for sequential execution
  • loadConfig (singular) remains fully backward compatible, no breaking changes
  • Tests added in all four packages plus direct runProjects unit tests
  • pnpm fallow:audit gate passes with complexity 0 and reduced duplication

Deferred items

  • defineProjects equivalents in satellite packages
  • Integration fixture with committed multi-spec output

Relates to #238

… file (#238)

Add a 'projects: [...]' array to config files so one config can drive
generation for multiple OpenAPI specs (orval-style multi-spec support).

- config-core.ts: add loadConfigsFile<T> (normalized array API),
  parseProjectsArray/parseProjectEntry helpers, and runProjects<T>
  shared iteration kernel (sequential, [i/N] logging, fail-fast).
  Split loadRawConfig into loadJsConfig + loadJsonConfig to reduce
  complexity. Extract prepareRaw to deduplicate loadConfigFile /
  loadConfigsFile preamble.
- openapi-zod-ts config.ts: add loadConfigs() and defineProjects()
  exported from the package root. generator.ts migrates to runProjects
  and extracts generateZodIntegration to reduce complexity.
- openapi-react-query, openapi-server, openapi-msw: each adds
  loadConfigs() wrapping loadConfigsFile, migrates generator.ts to
  import runProjects from openapi-zod-ts/config-core and call it,
  and extracts helpers (buildOverrides in react-query,
  buildRouterFile + generateSchemaEnhancedRouter in server).
- Tests: loadConfigs projects-array describe block added to all four
  packages covering: one-element passthrough, N-element array,
  mutual-exclusion error, empty array error, per-entry error with index.
- fallow:audit gate: complexity 0, duplication 3 warn-level groups
  (cross-package formatTs and minor generator patterns), exit 0.

Relates to #238. A second PR will add .ts config documentation.
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Fallow audit report

Found 6 findings.

Dependencies (2)
Severity Rule Location Description
minor fallow/unused-dev-dependency examples/package.json:15 Package '@tanstack/react-query' is in devDependencies but never imported; imported in other workspaces: packages/integration
minor fallow/unused-dev-dependency examples/package.json:17 Package 'react' is in devDependencies but never imported; imported in other workspaces: packages/integration
Duplication (4)
Severity Rule Location Description
minor fallow/code-duplication packages/openapi-msw/src/generator.ts:14 Code clone group 1 (13 lines, 2 instances)
minor fallow/code-duplication packages/openapi-react-query/src/generator.ts:35 Code clone group 1 (13 lines, 2 instances)
minor fallow/code-duplication packages/openapi-server/src/generator.ts:42 Code clone group 3 (16 lines, 2 instances)
minor fallow/code-duplication packages/openapi-zod-ts/src/generator.ts:86 Code clone group 3 (16 lines, 2 instances)

Generated by fallow.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fallow audit report

4 inline findings selected for GitHub review.

Comment thread packages/openapi-msw/src/generator.ts
Comment thread packages/openapi-react-query/src/generator.ts
Comment thread packages/openapi-server/src/generator.ts
Comment thread packages/openapi-zod-ts/src/generator.ts
@benjamineckstein benjamineckstein merged commit aab136b into main Jun 10, 2026
7 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 10, 2026
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.

1 participant