feat(cli): add support for multiple override files in OpenAPI spec configuration #11486
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.
Description
Refs: User request from [email protected] (@jsklan)
Adds support for specifying multiple override files in OpenAPI spec configuration. The
overridesfield now accepts either a single path (for backwards compatibility) or an array of paths that are applied sequentially in order.Additionally, adds support for generator-level overrides, allowing each generator invocation to specify its own
overridesfield that applies additional override files after the top-level spec overrides.Link to Devin run: https://app.devin.ai/sessions/8d80e6afe9b840e6aee1406cfd78569c
Changes Made
Multiple Override Files (Top-Level)
OverridesSchemaunion type in the Fern definition that acceptsstring | list<string>APIDefinitionWithOverridesSchema,ProtobufDefinitionSchema,OpenAPISpecSchema,OpenRPCSpecSchema,AsyncAPISpecSchema) to use the new typeGeneratorsConfiguration.tsto store overrides asstring | string[] | undefinedSpec.ts(OpenAPISpec,OpenRPCSpec,ProtobufSpec) to support array of override pathsloadAPIWorkspace.tsto convert relative paths to absolute paths for both single and array formats, with file existence validation for all pathsloadOpenAPI.tsto iterate through multiple override files sequentially using the existingmergeWithOverridesfunctionloadAsyncAPI.tsto handle array overrides with sequential applicationparseOpenAPI.tsto accept array type (uses first override path for ref resolution)OSSWorkspace.tsto handle array overrides in path conversion and file path collectionGenerator-Level Overrides
overridesfield toGeneratorInvocationSchemaingroup.ymlGeneratorInvocationinterface inGeneratorsConfiguration.tsconvertGeneratorsConfiguration.tsto parse the new fieldmergeGeneratorOverridesWithSpecsfunction inrunLocalGenerationForWorkspace.tsto merge generator-level overrides with spec-level overridesBug Fixes
overrides: undefinedproperty togetGeneratorInvocation.tsin seed package to fix TypeScript compilation errorTesting
Human Review Checklist
loadOpenAPI.ts,loadAsyncAPI.ts, andloadOpenRpc.tscorrectly apply overrides in orderparseOpenAPI.ts, only the first override path is used for theOpenAPIRefResolver. Verify this is acceptable behavior if refs are defined in later override files.runLocalGenerationForWorkspace.ts, themergeGeneratorOverridesWithSpecsfunction returnsundefinedifspecsOverrideis null but generator overrides exist. Verify this is the intended behavior (generator overrides only work whenapiOverride.specsis also defined).isOpenApiSpecSchemacheck). Verify this is acceptable or if other spec types should also support generator overrides.CI Notes
Some CI checks (python-sdk, php-model) are failing due to a pre-existing
@fern-api/go-formattercompilation issue unrelated to these changes. All other seed tests pass.