Skip to content

Conversation

@jsklan
Copy link
Contributor

@jsklan jsklan commented Jan 9, 2026

Description

Refs: User request from [email protected] (@jsklan)

Adds support for specifying multiple override files in OpenAPI spec configuration. The overrides field 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 overrides field 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)

  • Added new OverridesSchema union type in the Fern definition that accepts string | list<string>
  • Updated 6 schema definitions (APIDefinitionWithOverridesSchema, ProtobufDefinitionSchema, OpenAPISpecSchema, OpenRPCSpecSchema, AsyncAPISpecSchema) to use the new type
  • Regenerated TypeScript types from the schema
  • Updated GeneratorsConfiguration.ts to store overrides as string | string[] | undefined
  • Updated all spec types in Spec.ts (OpenAPISpec, OpenRPCSpec, ProtobufSpec) to support array of override paths
  • Modified loadAPIWorkspace.ts to convert relative paths to absolute paths for both single and array formats, with file existence validation for all paths
  • Modified loadOpenAPI.ts to iterate through multiple override files sequentially using the existing mergeWithOverrides function
  • Modified loadAsyncAPI.ts to handle array overrides with sequential application
  • Modified parseOpenAPI.ts to accept array type (uses first override path for ref resolution)
  • Modified OSSWorkspace.ts to handle array overrides in path conversion and file path collection

Generator-Level Overrides

  • Added overrides field to GeneratorInvocationSchema in group.yml
  • Updated GeneratorInvocation interface in GeneratorsConfiguration.ts
  • Updated convertGeneratorsConfiguration.ts to parse the new field
  • Added mergeGeneratorOverridesWithSpecs function in runLocalGenerationForWorkspace.ts to merge generator-level overrides with spec-level overrides
  • Added changelog entry for version 3.38.0 with both features

Bug Fixes

  • Added missing overrides: undefined property to getGeneratorInvocation.ts in seed package to fix TypeScript compilation error

Testing

  • Unit tests added/updated
  • Manual lint check completed
  • TypeScript compilation passes

Human Review Checklist

  • Sequential override logic: Verify the for-loops in loadOpenAPI.ts, loadAsyncAPI.ts, and loadOpenRpc.ts correctly apply overrides in order
  • Ref resolution limitation: In parseOpenAPI.ts, only the first override path is used for the OpenAPIRefResolver. Verify this is acceptable behavior if refs are defined in later override files.
  • Generator override merging: In runLocalGenerationForWorkspace.ts, the mergeGeneratorOverridesWithSpecs function returns undefined if specsOverride is null but generator overrides exist. Verify this is the intended behavior (generator overrides only work when apiOverride.specs is also defined).
  • Spec type limitation: Generator-level overrides are only applied to OpenAPI specs (via isOpenApiSpecSchema check). Verify this is acceptable or if other spec types should also support generator overrides.
  • Consider adding tests: No seed test fixture was created for these features

CI Notes

Some CI checks (python-sdk, php-model) are failing due to a pre-existing @fern-api/go-formatter compilation issue unrelated to these changes. All other seed tests pass.

@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants