feat(config): multi-spec projects array drives N generations from one file (#238)#288
Merged
Merged
Conversation
… 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.
Contributor
Fallow audit reportFound 6 findings. Dependencies (2)
Duplication (4)
Generated by fallow. |
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
New
projects: [...]array in config files lets one config drive N spec generations (orval-style). Introduces normalizedloadConfigs()API anddefineProjects()helper, exported from all four packages. SharedrunProjectsiteration kernel inopenapi-zod-ts/config-corehandles sequential execution with [i/N] logging and fail-fast behavior, replacing per-package loops.Key changes
projects: [...]array config option for multi-spec generationloadConfigs()(plural) normalized API anddefineProjects()helper exported from all packagesrunProjectsiteration kernel inopenapi-zod-ts/config-corefor sequential executionloadConfig(singular) remains fully backward compatible, no breaking changesrunProjectsunit testspnpm fallow:auditgate passes with complexity 0 and reduced duplicationDeferred items
defineProjectsequivalents in satellite packagesRelates to #238