@fern-api/fern-api-dev 3.94.0 → 3.95.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +235 -117
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -577366,7 +577366,7 @@ var AccessTokenPosthogManager = class {
577366
577366
  properties: {
577367
577367
  ...event,
577368
577368
  ...event.properties,
577369
- version: "3.94.0",
577369
+ version: "3.95.0",
577370
577370
  usingAccessToken: true
577371
577371
  }
577372
577372
  });
@@ -577475,7 +577475,7 @@ var UserPosthogManager = class {
577475
577475
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
577476
577476
  event: "CLI",
577477
577477
  properties: {
577478
- version: "3.94.0",
577478
+ version: "3.95.0",
577479
577479
  ...event,
577480
577480
  ...event.properties,
577481
577481
  usingAccessToken: false,
@@ -598045,7 +598045,7 @@ var AsyncApiSpecSchema = external_exports.object({
598045
598045
  /** URL origin for the AsyncAPI spec (for remote specs). */
598046
598046
  origin: external_exports.string().optional(),
598047
598047
  /** Path to overrides file for the AsyncAPI spec. */
598048
- overrides: external_exports.string().optional(),
598048
+ overrides: external_exports.union([external_exports.string(), external_exports.array(external_exports.string()).nonempty()]).optional(),
598049
598049
  /** Namespace for the API (used in multi-API configurations). */
598050
598050
  namespace: external_exports.string().optional(),
598051
598051
  /** AsyncAPI-specific settings. */
@@ -598169,7 +598169,7 @@ var OpenApiSpecSchema = external_exports.object({
598169
598169
  /** URL origin for the OpenAPI spec (for remote specs). */
598170
598170
  origin: external_exports.string().optional(),
598171
598171
  /** Path to overrides file for the OpenAPI spec. */
598172
- overrides: external_exports.string().optional(),
598172
+ overrides: external_exports.union([external_exports.string(), external_exports.array(external_exports.string()).nonempty()]).optional(),
598173
598173
  /** Path to overlays file for the OpenAPI spec. */
598174
598174
  overlays: external_exports.string().optional(),
598175
598175
  /** Namespace for the API (used in multi-API configurations). */
@@ -598184,7 +598184,7 @@ var OpenRpcSettingsSchema = external_exports.object({
598184
598184
  });
598185
598185
  var OpenRpcSpecSchema = external_exports.object({
598186
598186
  openrpc: external_exports.string(),
598187
- overrides: external_exports.string().optional(),
598187
+ overrides: external_exports.union([external_exports.string(), external_exports.array(external_exports.string()).nonempty()]).optional(),
598188
598188
  settings: OpenRpcSettingsSchema.optional()
598189
598189
  });
598190
598190
 
@@ -598195,7 +598195,7 @@ var ProtobufSettingsSchema = external_exports.object({
598195
598195
  var ProtobufDefinitionSchema = external_exports.object({
598196
598196
  root: external_exports.string(),
598197
598197
  target: external_exports.string().optional(),
598198
- overrides: external_exports.string().optional(),
598198
+ overrides: external_exports.union([external_exports.string(), external_exports.array(external_exports.string()).nonempty()]).optional(),
598199
598199
  localGeneration: external_exports.boolean().optional(),
598200
598200
  fromOpenapi: external_exports.boolean().optional(),
598201
598201
  dependencies: external_exports.array(external_exports.string()).optional()
@@ -604507,9 +604507,9 @@ var ApiDefinitionConverter = class {
604507
604507
  result.origin = spec.origin;
604508
604508
  }
604509
604509
  if (spec.overrides != null && !isNullish(sourced.overrides)) {
604510
- result.overrides = await this.resolvePath({
604510
+ result.overrides = await this.resolvePathOrPaths({
604511
604511
  absoluteFernYmlPath,
604512
- path: spec.overrides,
604512
+ paths: spec.overrides,
604513
604513
  sourced: sourced.overrides
604514
604514
  });
604515
604515
  }
@@ -604533,9 +604533,9 @@ var ApiDefinitionConverter = class {
604533
604533
  asyncapi: await this.resolvePath({ absoluteFernYmlPath, path: spec.asyncapi, sourced: sourced.asyncapi })
604534
604534
  };
604535
604535
  if (spec.overrides != null && !isNullish(sourced.overrides)) {
604536
- result.overrides = await this.resolvePath({
604536
+ result.overrides = await this.resolvePathOrPaths({
604537
604537
  absoluteFernYmlPath,
604538
- path: spec.overrides,
604538
+ paths: spec.overrides,
604539
604539
  sourced: sourced.overrides
604540
604540
  });
604541
604541
  }
@@ -604556,9 +604556,9 @@ var ApiDefinitionConverter = class {
604556
604556
  });
604557
604557
  }
604558
604558
  if (spec.proto.overrides != null && !isNullish(sourced.proto.overrides)) {
604559
- proto3.overrides = await this.resolvePath({
604559
+ proto3.overrides = await this.resolvePathOrPaths({
604560
604560
  absoluteFernYmlPath,
604561
- path: spec.proto.overrides,
604561
+ paths: spec.proto.overrides,
604562
604562
  sourced: sourced.proto.overrides
604563
604563
  });
604564
604564
  }
@@ -604608,9 +604608,9 @@ var ApiDefinitionConverter = class {
604608
604608
  openrpc: await this.resolvePath({ absoluteFernYmlPath, path: spec.openrpc, sourced: sourced.openrpc })
604609
604609
  };
604610
604610
  if (spec.overrides != null && !isNullish(sourced.overrides)) {
604611
- result.overrides = await this.resolvePath({
604611
+ result.overrides = await this.resolvePathOrPaths({
604612
604612
  absoluteFernYmlPath,
604613
- path: spec.overrides,
604613
+ paths: spec.overrides,
604614
604614
  sourced: sourced.overrides
604615
604615
  });
604616
604616
  }
@@ -604619,6 +604619,29 @@ var ApiDefinitionConverter = class {
604619
604619
  }
604620
604620
  return result;
604621
604621
  }
604622
+ /**
604623
+ * Resolves one or more override paths from fern.yml to absolute paths.
604624
+ * Handles both single string and array-of-strings inputs.
604625
+ */
604626
+ async resolvePathOrPaths({ absoluteFernYmlPath, paths, sourced }) {
604627
+ if (!Array.isArray(paths)) {
604628
+ return await this.resolvePath({
604629
+ absoluteFernYmlPath,
604630
+ path: paths,
604631
+ sourced
604632
+ });
604633
+ }
604634
+ const resolved = [];
604635
+ const sourcedArray = sourced;
604636
+ for (let i11 = 0; i11 < paths.length; i11++) {
604637
+ const path91 = paths[i11];
604638
+ const sourcedPath = sourcedArray[i11];
604639
+ if (path91 != null && !isNullish(sourcedPath)) {
604640
+ resolved.push(await this.resolvePath({ absoluteFernYmlPath, path: path91, sourced: sourcedPath }));
604641
+ }
604642
+ }
604643
+ return resolved;
604644
+ }
604622
604645
  /**
604623
604646
  * Resolves a relative path from fern.yml to an absolute path, and validates that the file exists.
604624
604647
  */
@@ -623676,7 +623699,7 @@ var FernWorkspace = class extends AbstractAPIWorkspace {
623676
623699
  async getDefinition() {
623677
623700
  return this.definition;
623678
623701
  }
623679
- async toFernWorkspace() {
623702
+ async toFernWorkspace({ context: context2 }, settings, specsOverride, generatorOverrides) {
623680
623703
  return this;
623681
623704
  }
623682
623705
  getSources() {
@@ -631269,6 +631292,7 @@ __export(serialization_exports5, {
631269
631292
  OpenRpcSpecSchema: () => OpenRpcSpecSchema2,
631270
631293
  OutputMetadataAuthor: () => OutputMetadataAuthor2,
631271
631294
  OutputMetadataSchema: () => OutputMetadataSchema,
631295
+ OverridesSchema: () => OverridesSchema,
631272
631296
  PathParameterOrder: () => PathParameterOrder2,
631273
631297
  PostmanOutputLocationSchema: () => PostmanOutputLocationSchema,
631274
631298
  ProtobufApiDefinitionSchema: () => ProtobufApiDefinitionSchema,
@@ -633221,6 +633245,7 @@ __export(generators_exports3, {
633221
633245
  OpenRpcSpecSchema: () => OpenRpcSpecSchema2,
633222
633246
  OutputMetadataAuthor: () => OutputMetadataAuthor2,
633223
633247
  OutputMetadataSchema: () => OutputMetadataSchema,
633248
+ OverridesSchema: () => OverridesSchema,
633224
633249
  PathParameterOrder: () => PathParameterOrder2,
633225
633250
  ProtobufApiDefinitionSchema: () => ProtobufApiDefinitionSchema,
633226
633251
  ProtobufDefinitionSchema: () => ProtobufDefinitionSchema2,
@@ -633270,11 +633295,17 @@ var ApiDefinitionSettingsSchema = schemas_exports10.object({
633270
633295
  "path-parameter-order": PathParameterOrder2.optional()
633271
633296
  });
633272
633297
 
633298
+ // ../configuration/lib/generators-yml/schemas/serialization/resources/generators/types/OverridesSchema.js
633299
+ var OverridesSchema = schemas_exports10.undiscriminatedUnion([
633300
+ schemas_exports10.string(),
633301
+ schemas_exports10.list(schemas_exports10.string())
633302
+ ]);
633303
+
633273
633304
  // ../configuration/lib/generators-yml/schemas/serialization/resources/generators/types/ApiDefinitionWithOverridesSchema.js
633274
633305
  var ApiDefinitionWithOverridesSchema = schemas_exports10.object({
633275
633306
  path: ApiDefinitionPathSchema,
633276
633307
  origin: schemas_exports10.string().optional(),
633277
- overrides: schemas_exports10.string().optional(),
633308
+ overrides: OverridesSchema.optional(),
633278
633309
  audiences: schemas_exports10.list(schemas_exports10.string()).optional(),
633279
633310
  settings: ApiDefinitionSettingsSchema.optional()
633280
633311
  });
@@ -633283,7 +633314,7 @@ var ApiDefinitionWithOverridesSchema = schemas_exports10.object({
633283
633314
  var ProtobufDefinitionSchema2 = schemas_exports10.object({
633284
633315
  target: schemas_exports10.string().optional(),
633285
633316
  root: schemas_exports10.string(),
633286
- overrides: schemas_exports10.string().optional(),
633317
+ overrides: OverridesSchema.optional(),
633287
633318
  "local-generation": schemas_exports10.boolean().optional(),
633288
633319
  "from-openapi": schemas_exports10.boolean().optional(),
633289
633320
  dependencies: schemas_exports10.list(schemas_exports10.string()).optional()
@@ -633395,7 +633426,7 @@ var ConjureSchema = schemas_exports10.object({
633395
633426
  var AsyncApiSpecSchema2 = schemas_exports10.object({
633396
633427
  asyncapi: schemas_exports10.string(),
633397
633428
  origin: schemas_exports10.string().optional(),
633398
- overrides: schemas_exports10.string().optional(),
633429
+ overrides: OverridesSchema.optional(),
633399
633430
  namespace: schemas_exports10.string().optional(),
633400
633431
  settings: AsyncApiSettingsSchema2.optional()
633401
633432
  });
@@ -633412,7 +633443,7 @@ var GraphQlSpecSchema = schemas_exports10.object({
633412
633443
  var OpenApiSpecSchema2 = schemas_exports10.object({
633413
633444
  openapi: schemas_exports10.string(),
633414
633445
  origin: schemas_exports10.string().optional(),
633415
- overrides: schemas_exports10.string().optional(),
633446
+ overrides: OverridesSchema.optional(),
633416
633447
  overlays: schemas_exports10.string().optional(),
633417
633448
  namespace: schemas_exports10.string().optional(),
633418
633449
  settings: OpenApiSettingsSchema2.optional()
@@ -633421,7 +633452,7 @@ var OpenApiSpecSchema2 = schemas_exports10.object({
633421
633452
  // ../configuration/lib/generators-yml/schemas/serialization/resources/generators/types/OpenRpcSpecSchema.js
633422
633453
  var OpenRpcSpecSchema2 = schemas_exports10.object({
633423
633454
  openrpc: schemas_exports10.string(),
633424
- overrides: schemas_exports10.string().optional(),
633455
+ overrides: OverridesSchema.optional(),
633425
633456
  namespace: schemas_exports10.string().optional()
633426
633457
  });
633427
633458
 
@@ -659174,12 +659205,18 @@ async function convertGenerator({ absolutePathToGeneratorsConfiguration, generat
659174
659205
  publishMetadata: getPublishMetadata({ generatorInvocation: generator }),
659175
659206
  readme,
659176
659207
  settings: generator.api?.settings ?? void 0,
659177
- apiOverride: generator.api?.specs != null || generator.api?.auth != null || generator.api?.["auth-schemes"] != null ? {
659208
+ apiOverride: getApiOverride({ generator })
659209
+ };
659210
+ }
659211
+ function getApiOverride({ generator }) {
659212
+ if (generator.api?.specs != null || generator.api?.auth != null || generator.api?.["auth-schemes"] != null) {
659213
+ return {
659178
659214
  specs: generator.api?.specs,
659179
659215
  auth: generator.api?.auth,
659180
659216
  "auth-schemes": generator.api?.["auth-schemes"]
659181
- } : void 0
659182
- };
659217
+ };
659218
+ }
659219
+ return void 0;
659183
659220
  }
659184
659221
  function getPublishMetadata({ generatorInvocation }) {
659185
659222
  const publishMetadata = generatorInvocation["publish-metadata"];
@@ -680164,7 +680201,7 @@ var ConjureWorkspace = class extends AbstractAPIWorkspace {
680164
680201
  super(superArgs);
680165
680202
  this.absolutePathToConjureFolder = join4(superArgs.absoluteFilePath, relativePathToConjureDirectory);
680166
680203
  }
680167
- async toFernWorkspace({ context: context2 }, settings) {
680204
+ async toFernWorkspace({ context: context2 }, settings, specsOverride, generatorOverrides) {
680168
680205
  const definition3 = await this.getDefinition({ context: context2 }, settings);
680169
680206
  return new FernWorkspace({
680170
680207
  absoluteFilePath: this.absoluteFilePath,
@@ -696251,9 +696288,10 @@ var LazyFernWorkspace = class extends AbstractAPIWorkspace {
696251
696288
  this.loadAPIWorkspace = loadAPIWorkspace2;
696252
696289
  }
696253
696290
  async getDefinition({ context: context2 }, settings) {
696254
- return (await this.toFernWorkspace({ context: context2 }, settings)).definition;
696291
+ const defaultedContext = context2 || this.context;
696292
+ return (await this.toFernWorkspace({ context: defaultedContext }, settings)).definition;
696255
696293
  }
696256
- async toFernWorkspace({ context: context2, skipValidation }, settings) {
696294
+ async toFernWorkspace({ context: context2, skipValidation }, settings, specsOverride, generatorOverrides) {
696257
696295
  const key2 = (0, import_object_hash.default)(settings ?? {});
696258
696296
  let workspace = this.fernWorkspaces[key2];
696259
696297
  if (workspace == null) {
@@ -696363,14 +696401,23 @@ async function mergeWithOverrides2({ absoluteFilePathToOverrides, data: data2, c
696363
696401
  async function loadAsyncAPI({ context: context2, absoluteFilePath, absoluteFilePathToOverrides }) {
696364
696402
  const contents = (await (0, import_promises35.readFile)(absoluteFilePath)).toString();
696365
696403
  const parsed = await jsYaml.load(contents);
696404
+ let overridesFilepaths = [];
696366
696405
  if (absoluteFilePathToOverrides != null) {
696367
- return await mergeWithOverrides2({
696368
- absoluteFilePathToOverrides,
696406
+ if (Array.isArray(absoluteFilePathToOverrides)) {
696407
+ overridesFilepaths = absoluteFilePathToOverrides;
696408
+ } else {
696409
+ overridesFilepaths = [absoluteFilePathToOverrides];
696410
+ }
696411
+ }
696412
+ let result = parsed;
696413
+ for (const overridesFilepath of overridesFilepaths) {
696414
+ result = await mergeWithOverrides2({
696415
+ absoluteFilePathToOverrides: overridesFilepath,
696369
696416
  context: context2,
696370
- data: parsed
696417
+ data: result
696371
696418
  });
696372
696419
  }
696373
- return parsed;
696420
+ return result;
696374
696421
  }
696375
696422
 
696376
696423
  // ../workspace/lazy-fern-workspace/lib/utils/loadOpenAPI.js
@@ -696536,25 +696583,36 @@ async function loadOpenAPI({ context: context2, absolutePathToOpenAPI, absoluteP
696536
696583
  const parsed = await parseOpenAPI({
696537
696584
  absolutePathToOpenAPI
696538
696585
  });
696539
- let overridesFilepath = void 0;
696586
+ let overridesFilepaths = [];
696540
696587
  if (absolutePathToOpenAPIOverrides != null) {
696541
- overridesFilepath = absolutePathToOpenAPIOverrides;
696588
+ if (Array.isArray(absolutePathToOpenAPIOverrides)) {
696589
+ overridesFilepaths = absolutePathToOpenAPIOverrides;
696590
+ } else {
696591
+ overridesFilepaths = [absolutePathToOpenAPIOverrides];
696592
+ }
696542
696593
  } else if (typeof parsed === "object" && // biome-ignore lint/suspicious/noExplicitAny: allow explicit any
696543
696594
  parsed[FernOpenAPIExtension.OPENAPI_OVERIDES_FILEPATH] != null) {
696544
- overridesFilepath = join4(
696545
- dirname4(absolutePathToOpenAPI),
696546
- // biome-ignore lint/suspicious/noExplicitAny: allow explicit any
696547
- RelativeFilePath2.of(parsed[FernOpenAPIExtension.OPENAPI_OVERIDES_FILEPATH])
696548
- );
696595
+ overridesFilepaths = [
696596
+ join4(
696597
+ dirname4(absolutePathToOpenAPI),
696598
+ // biome-ignore lint/suspicious/noExplicitAny: allow explicit any
696599
+ RelativeFilePath2.of(parsed[FernOpenAPIExtension.OPENAPI_OVERIDES_FILEPATH])
696600
+ )
696601
+ ];
696549
696602
  }
696550
696603
  let result = parsed;
696551
- if (overridesFilepath != null) {
696604
+ for (const overridesFilepath of overridesFilepaths) {
696552
696605
  result = await mergeWithOverrides2({
696553
696606
  absoluteFilePathToOverrides: overridesFilepath,
696554
696607
  context: context2,
696555
696608
  data: result,
696556
696609
  allowNullKeys: OPENAPI_EXAMPLES_KEYS
696557
696610
  });
696611
+ result = await parseOpenAPI({
696612
+ absolutePathToOpenAPI,
696613
+ absolutePathToOpenAPIOverrides: overridesFilepath,
696614
+ parsed: result
696615
+ });
696558
696616
  }
696559
696617
  if (absolutePathToOpenAPIOverlays != null) {
696560
696618
  result = await applyOverlays({
@@ -696601,11 +696659,12 @@ async function loadOpenAPI({ context: context2, absolutePathToOpenAPI, absoluteP
696601
696659
  } catch (error49) {
696602
696660
  }
696603
696661
  }
696604
- if (overridesFilepath != null || absolutePathToOpenAPIOverlays != null || result !== parsed) {
696662
+ const needsFinalResolution = result !== parsed && overridesFilepaths.length === 0 || absolutePathToOpenAPIOverlays != null;
696663
+ if (needsFinalResolution) {
696605
696664
  return await parseOpenAPI({
696606
696665
  absolutePathToOpenAPI,
696607
- absolutePathToOpenAPIOverrides: overridesFilepath,
696608
696666
  absolutePathToOpenAPIOverlays,
696667
+ // Include overlay path for ref resolver
696609
696668
  parsed: result
696610
696669
  });
696611
696670
  }
@@ -707041,14 +707100,23 @@ async function loadOpenRpc({ context: context2, absoluteFilePath, absoluteFilePa
707041
707100
  } catch (e6) {
707042
707101
  parsed = jsYaml.load(contents);
707043
707102
  }
707103
+ let overridesFilepaths = [];
707044
707104
  if (absoluteFilePathToOverrides != null) {
707045
- return await mergeWithOverrides2({
707046
- absoluteFilePathToOverrides,
707105
+ if (Array.isArray(absoluteFilePathToOverrides)) {
707106
+ overridesFilepaths = absoluteFilePathToOverrides;
707107
+ } else {
707108
+ overridesFilepaths = [absoluteFilePathToOverrides];
707109
+ }
707110
+ }
707111
+ let result = parsed;
707112
+ for (const overridesFilepath of overridesFilepaths) {
707113
+ result = await mergeWithOverrides2({
707114
+ absoluteFilePathToOverrides: overridesFilepath,
707047
707115
  context: context2,
707048
- data: parsed
707116
+ data: result
707049
707117
  });
707050
707118
  }
707051
- return parsed;
707119
+ return result;
707052
707120
  }
707053
707121
 
707054
707122
  // ../workspace/lazy-fern-workspace/lib/protobuf/ProtobufIRGenerator.js
@@ -707912,7 +707980,18 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
707912
707980
  for (const spec of specsOverride) {
707913
707981
  if (generators_yml_exports.isOpenApiSpecSchema(spec)) {
707914
707982
  const absoluteFilepath = join4(this.absoluteFilePath, RelativeFilePath2.of(spec.openapi));
707915
- const absoluteFilepathToOverrides = spec.overrides ? join4(this.absoluteFilePath, RelativeFilePath2.of(spec.overrides)) : void 0;
707983
+ let absoluteFilepathToOverrides;
707984
+ const specOverridePaths = [];
707985
+ if (spec.overrides != null) {
707986
+ if (Array.isArray(spec.overrides)) {
707987
+ specOverridePaths.push(...spec.overrides.map((override) => join4(this.absoluteFilePath, RelativeFilePath2.of(override))));
707988
+ } else {
707989
+ specOverridePaths.push(join4(this.absoluteFilePath, RelativeFilePath2.of(spec.overrides)));
707990
+ }
707991
+ }
707992
+ if (specOverridePaths.length > 0) {
707993
+ absoluteFilepathToOverrides = specOverridePaths.length === 1 ? specOverridePaths[0] : specOverridePaths;
707994
+ }
707916
707995
  const absoluteFilepathToOverlays = spec.overlays ? join4(this.absoluteFilePath, RelativeFilePath2.of(spec.overlays)) : void 0;
707917
707996
  const openApiSpec = {
707918
707997
  type: "openapi",
@@ -707937,10 +708016,11 @@ var OSSWorkspace = class _OSSWorkspace extends BaseOpenAPIWorkspace {
707937
708016
  getAbsoluteFilePaths() {
707938
708017
  return [
707939
708018
  this.absoluteFilePath,
707940
- ...this.allSpecs.flatMap((spec) => [
707941
- spec.type === "protobuf" ? spec.absoluteFilepathToProtobufTarget : spec.absoluteFilepath,
707942
- spec.absoluteFilepathToOverrides
707943
- ]).filter(isNonNullish2)
708019
+ ...this.allSpecs.flatMap((spec) => {
708020
+ const mainPath = spec.type === "protobuf" ? spec.absoluteFilepathToProtobufTarget : spec.absoluteFilepath;
708021
+ const overridePaths = Array.isArray(spec.absoluteFilepathToOverrides) ? spec.absoluteFilepathToOverrides : spec.absoluteFilepathToOverrides != null ? [spec.absoluteFilepathToOverrides] : [];
708022
+ return [mainPath, ...overridePaths];
708023
+ }).filter(isNonNullish2)
707944
708024
  ];
707945
708025
  }
707946
708026
  getSources() {
@@ -708957,7 +709037,7 @@ function adjustSpecPaths(specs, apiName) {
708957
709037
  return {
708958
709038
  ...spec,
708959
709039
  openapi: adjustPath(spec.openapi, apiName),
708960
- overrides: spec.overrides != null ? adjustPath(spec.overrides, apiName) : void 0,
709040
+ overrides: spec.overrides != null ? adjustPathOrPaths(spec.overrides, apiName) : void 0,
708961
709041
  overlays: spec.overlays != null ? adjustPath(spec.overlays, apiName) : void 0
708962
709042
  };
708963
709043
  }
@@ -708965,7 +709045,7 @@ function adjustSpecPaths(specs, apiName) {
708965
709045
  return {
708966
709046
  ...spec,
708967
709047
  asyncapi: adjustPath(spec.asyncapi, apiName),
708968
- overrides: spec.overrides != null ? adjustPath(spec.overrides, apiName) : void 0
709048
+ overrides: spec.overrides != null ? adjustPathOrPaths(spec.overrides, apiName) : void 0
708969
709049
  };
708970
709050
  }
708971
709051
  if ("fern" in spec) {
@@ -708984,7 +709064,7 @@ function adjustSpecPaths(specs, apiName) {
708984
709064
  return {
708985
709065
  ...spec,
708986
709066
  openrpc: adjustPath(spec.openrpc, apiName),
708987
- overrides: spec.overrides != null ? adjustPath(spec.overrides, apiName) : void 0
709067
+ overrides: spec.overrides != null ? adjustPathOrPaths(spec.overrides, apiName) : void 0
708988
709068
  };
708989
709069
  }
708990
709070
  if ("proto" in spec) {
@@ -708993,7 +709073,7 @@ function adjustSpecPaths(specs, apiName) {
708993
709073
  proto: {
708994
709074
  ...spec.proto,
708995
709075
  root: adjustPath(spec.proto.root, apiName),
708996
- overrides: spec.proto.overrides != null ? adjustPath(spec.proto.overrides, apiName) : void 0
709076
+ overrides: spec.proto.overrides != null ? adjustPathOrPaths(spec.proto.overrides, apiName) : void 0
708997
709077
  }
708998
709078
  };
708999
709079
  }
@@ -709009,6 +709089,12 @@ function adjustPath(path91, apiName) {
709009
709089
  }
709010
709090
  return `./${FERN_DIRECTORY}/${APIS_DIRECTORY}/${apiName}/${path91}`;
709011
709091
  }
709092
+ function adjustPathOrPaths(paths, apiName) {
709093
+ if (Array.isArray(paths)) {
709094
+ return paths.map((p9) => adjustPath(p9, apiName));
709095
+ }
709096
+ return adjustPath(paths, apiName);
709097
+ }
709012
709098
  function convertApiSpecs(apiConfig) {
709013
709099
  const warnings = [];
709014
709100
  if (apiConfig == null) {
@@ -750814,6 +750900,7 @@ async function performAIEnhancement(apiDefinition, config3, context2, token, org
750814
750900
  try {
750815
750901
  let specContent = await (0, import_promises56.readFile)(sourceSpec.absoluteFilePath, "utf-8");
750816
750902
  if (sourceSpec.absoluteFilePathToOverrides != null) {
750903
+ const overridesPaths = Array.isArray(sourceSpec.absoluteFilePathToOverrides) ? sourceSpec.absoluteFilePathToOverrides : [sourceSpec.absoluteFilePathToOverrides];
750817
750904
  try {
750818
750905
  let parsedSpec;
750819
750906
  try {
@@ -750821,15 +750908,17 @@ async function performAIEnhancement(apiDefinition, config3, context2, token, org
750821
750908
  } catch {
750822
750909
  parsedSpec = load(specContent, { json: true });
750823
750910
  }
750824
- const overridesContent = await (0, import_promises56.readFile)(sourceSpec.absoluteFilePathToOverrides, "utf-8");
750825
- let parsedOverrides;
750826
- try {
750827
- parsedOverrides = JSON.parse(overridesContent);
750828
- } catch {
750829
- parsedOverrides = load(overridesContent, { json: true });
750911
+ for (const overridesPath of overridesPaths) {
750912
+ const overridesContent = await (0, import_promises56.readFile)(overridesPath, "utf-8");
750913
+ let parsedOverrides;
750914
+ try {
750915
+ parsedOverrides = JSON.parse(overridesContent);
750916
+ } catch {
750917
+ parsedOverrides = load(overridesContent, { json: true });
750918
+ }
750919
+ parsedSpec = mergeWithOverrides({ data: parsedSpec, overrides: parsedOverrides });
750830
750920
  }
750831
- const merged = mergeWithOverrides({ data: parsedSpec, overrides: parsedOverrides });
750832
- specContent = dump(merged);
750921
+ specContent = dump(parsedSpec);
750833
750922
  context2.logger.debug("Applied overrides to OpenAPI spec for AI enhancement");
750834
750923
  } catch (error49) {
750835
750924
  context2.logger.debug(`Failed to apply overrides to spec: ${error49}. Using raw spec.`);
@@ -763255,7 +763344,7 @@ var import_path40 = __toESM(require("path"), 1);
763255
763344
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
763256
763345
  var LOGS_FOLDER_NAME = "logs";
763257
763346
  function getCliSource() {
763258
- const version7 = "3.94.0";
763347
+ const version7 = "3.95.0";
763259
763348
  return `cli@${version7}`;
763260
763349
  }
763261
763350
  var DebugLogger = class {
@@ -1086157,7 +1086246,14 @@ async function loadAPIChangelog({ absolutePathToWorkspace }) {
1086157
1086246
  async function loadSingleNamespaceAPIWorkspace({ absolutePathToWorkspace, namespace, definitions: definitions7 }) {
1086158
1086247
  const specs = [];
1086159
1086248
  for (const definition3 of definitions7) {
1086160
- const absoluteFilepathToOverrides = definition3.overrides != null ? join4(absolutePathToWorkspace, RelativeFilePath2.of(definition3.overrides)) : void 0;
1086249
+ let absoluteFilepathToOverrides;
1086250
+ if (definition3.overrides != null) {
1086251
+ if (Array.isArray(definition3.overrides)) {
1086252
+ absoluteFilepathToOverrides = definition3.overrides.map((override) => join4(absolutePathToWorkspace, RelativeFilePath2.of(override)));
1086253
+ } else {
1086254
+ absoluteFilepathToOverrides = join4(absolutePathToWorkspace, RelativeFilePath2.of(definition3.overrides));
1086255
+ }
1086256
+ }
1086161
1086257
  const absoluteFilepathToOverlays = definition3.overlays != null ? join4(absolutePathToWorkspace, RelativeFilePath2.of(definition3.overlays)) : void 0;
1086162
1086258
  if (definition3.schema.type === "protobuf") {
1086163
1086259
  const relativeFilepathToProtobufRoot = RelativeFilePath2.of(definition3.schema.root);
@@ -1086245,15 +1086341,23 @@ async function loadSingleNamespaceAPIWorkspace({ absolutePathToWorkspace, namesp
1086245
1086341
  }
1086246
1086342
  };
1086247
1086343
  }
1086248
- if (definition3.overrides != null && absoluteFilepathToOverrides != null && !await doesPathExist(absoluteFilepathToOverrides)) {
1086249
- return {
1086250
- didSucceed: false,
1086251
- failures: {
1086252
- [RelativeFilePath2.of(definition3.overrides)]: {
1086253
- type: WorkspaceLoaderFailureType.FILE_MISSING
1086254
- }
1086344
+ if (definition3.overrides != null && absoluteFilepathToOverrides != null) {
1086345
+ const overridePaths = Array.isArray(absoluteFilepathToOverrides) ? absoluteFilepathToOverrides : [absoluteFilepathToOverrides];
1086346
+ const overrideRelativePaths = Array.isArray(definition3.overrides) ? definition3.overrides : [definition3.overrides];
1086347
+ for (let i11 = 0; i11 < overridePaths.length; i11++) {
1086348
+ const overridePath = overridePaths[i11];
1086349
+ const relativeOverridePath = overrideRelativePaths[i11];
1086350
+ if (overridePath != null && relativeOverridePath != null && !await doesPathExist(overridePath)) {
1086351
+ return {
1086352
+ didSucceed: false,
1086353
+ failures: {
1086354
+ [RelativeFilePath2.of(relativeOverridePath)]: {
1086355
+ type: WorkspaceLoaderFailureType.FILE_MISSING
1086356
+ }
1086357
+ }
1086358
+ };
1086255
1086359
  }
1086256
- };
1086360
+ }
1086257
1086361
  }
1086258
1086362
  if (definition3.overlays != null && absoluteFilepathToOverlays != null && !await doesPathExist(absoluteFilepathToOverlays)) {
1086259
1086363
  return {
@@ -1126942,7 +1127046,7 @@ var CliContext = class {
1126942
1127046
  if (false) {
1126943
1127047
  this.logger.error("CLI_VERSION is not defined");
1126944
1127048
  }
1126945
- return "3.94.0";
1127049
+ return "3.95.0";
1126946
1127050
  }
1126947
1127051
  getCliName() {
1126948
1127052
  if (false) {
@@ -1147561,6 +1147665,41 @@ async function readExistingOverrides(overridesFilepath, context2) {
1147561
1147665
  }
1147562
1147666
  return parsedOverrides;
1147563
1147667
  }
1147668
+ function generateOverridesContent({
1147669
+ ir: ir14,
1147670
+ existingOverrides,
1147671
+ includeModels,
1147672
+ context: context2
1147673
+ }) {
1147674
+ const hasExisting = existingOverrides != null && typeof existingOverrides === "object";
1147675
+ const paths = hasExisting && "paths" in existingOverrides ? existingOverrides.paths : {};
1147676
+ for (const endpoint3 of ir14.endpoints) {
1147677
+ const endpointLocation = getEndpointLocation(endpoint3);
1147678
+ if (!(endpoint3.path in paths)) {
1147679
+ paths[endpoint3.path] = {};
1147680
+ }
1147681
+ const pathItem = paths[endpoint3.path];
1147682
+ if (pathItem != null && pathItem[endpoint3.method] == null && pathItem[endpoint3.method.toLowerCase()] == null) {
1147683
+ const groupName = endpointLocation.file.split("/").map((part) => part.replace(".yml", "")).filter((part) => part !== "__package__");
1147684
+ const sdkMethodNameExtensions = {};
1147685
+ if (groupName.length > 0) {
1147686
+ sdkMethodNameExtensions["x-fern-sdk-group-name"] = groupName;
1147687
+ }
1147688
+ sdkMethodNameExtensions["x-fern-sdk-method-name"] = endpointLocation.endpointId;
1147689
+ pathItem[endpoint3.method.toLowerCase()] = sdkMethodNameExtensions;
1147690
+ } else if (!hasExisting) {
1147691
+ context2.logger.warn(`Endpoint ${endpoint3.path} ${endpoint3.method} is defined multiple times`);
1147692
+ }
1147693
+ }
1147694
+ const schemas = hasExisting && "components" in existingOverrides && existingOverrides.components?.schemas != null ? existingOverrides.components.schemas : {};
1147695
+ if (includeModels) {
1147696
+ writeModels(schemas, ir14.groupedSchemas.rootSchemas);
1147697
+ for (const [_15, namespacedSchemas] of Object.entries(ir14.groupedSchemas.namespacedSchemas)) {
1147698
+ writeModels(schemas, namespacedSchemas);
1147699
+ }
1147700
+ }
1147701
+ return { paths, components: { schemas } };
1147702
+ }
1147564
1147703
  async function writeDefinitionForOpenAPIWorkspace({
1147565
1147704
  workspace,
1147566
1147705
  includeModels,
@@ -1147573,51 +1147712,30 @@ async function writeDefinitionForOpenAPIWorkspace({
1147573
1147712
  context: context2,
1147574
1147713
  documents: await loader2.loadDocuments({ context: context2, specs: [spec] })
1147575
1147714
  });
1147576
- let existingOverrides = {};
1147577
- if (spec.absoluteFilepathToOverrides !== void 0) {
1147578
- existingOverrides = await readExistingOverrides(spec.absoluteFilepathToOverrides, context2);
1147579
- }
1147580
- const paths = "path" in existingOverrides ? existingOverrides.path : {};
1147581
- for (const endpoint3 of ir14.endpoints) {
1147582
- const endpointLocation = getEndpointLocation(endpoint3);
1147583
- if (!(endpoint3.path in paths)) {
1147584
- paths[endpoint3.path] = {};
1147585
- }
1147586
- const pathItem = paths[endpoint3.path];
1147587
- if (pathItem != null && pathItem[endpoint3.method] == null) {
1147588
- const groupName = endpointLocation.file.split("/").map((part) => part.replace(".yml", "")).filter((part) => part !== "__package__");
1147589
- const sdkMethodNameExtensions = {};
1147590
- if (groupName.length > 0) {
1147591
- sdkMethodNameExtensions["x-fern-sdk-group-name"] = groupName;
1147592
- }
1147593
- sdkMethodNameExtensions["x-fern-sdk-method-name"] = endpointLocation.endpointId;
1147594
- pathItem[endpoint3.method.toLowerCase()] = sdkMethodNameExtensions;
1147595
- } else if (existingOverrides == null) {
1147596
- context2.logger.warn(`Endpoint ${endpoint3.path} ${endpoint3.method} is defined multiple times`);
1147597
- }
1147598
- }
1147599
- const schemas = "path" in existingOverrides ? existingOverrides.path : {};
1147600
- if (includeModels) {
1147601
- writeModels(schemas, ir14.groupedSchemas.rootSchemas);
1147602
- for (const [_15, namespacedSchemas] of Object.entries(ir14.groupedSchemas.namespacedSchemas)) {
1147603
- writeModels(schemas, namespacedSchemas);
1147604
- }
1147605
- }
1147606
- const components = { schemas };
1147607
- const specFilename = getFilename(spec.absoluteFilepath);
1147608
- let overridesFilename = "openapi-overrides.yml";
1147609
- if (specFilename != null) {
1147610
- const lastDotIndex = specFilename.lastIndexOf(".");
1147611
- if (lastDotIndex > 0) {
1147612
- const nameWithoutExt = specFilename.substring(0, lastDotIndex);
1147613
- const extension3 = specFilename.substring(lastDotIndex);
1147614
- overridesFilename = `${nameWithoutExt}-overrides${extension3}`;
1147615
- }
1147616
- }
1147617
- await (0, import_promises132.writeFile)(
1147618
- join4(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
1147619
- jsYaml.dump({ paths, components })
1147620
- );
1147715
+ const overridesPaths = Array.isArray(spec.absoluteFilepathToOverrides) ? spec.absoluteFilepathToOverrides : spec.absoluteFilepathToOverrides != null ? [spec.absoluteFilepathToOverrides] : [];
1147716
+ if (overridesPaths.length > 0) {
1147717
+ for (const overridesPath of overridesPaths) {
1147718
+ const existingOverrides = await readExistingOverrides(overridesPath, context2);
1147719
+ const content5 = generateOverridesContent({ ir: ir14, existingOverrides, includeModels, context: context2 });
1147720
+ await (0, import_promises132.writeFile)(overridesPath, jsYaml.dump(content5));
1147721
+ }
1147722
+ } else {
1147723
+ const content5 = generateOverridesContent({ ir: ir14, existingOverrides: {}, includeModels, context: context2 });
1147724
+ const specFilename = getFilename(spec.absoluteFilepath);
1147725
+ let overridesFilename = "openapi-overrides.yml";
1147726
+ if (specFilename != null) {
1147727
+ const lastDotIndex = specFilename.lastIndexOf(".");
1147728
+ if (lastDotIndex > 0) {
1147729
+ const nameWithoutExt = specFilename.substring(0, lastDotIndex);
1147730
+ const extension3 = specFilename.substring(lastDotIndex);
1147731
+ overridesFilename = `${nameWithoutExt}-overrides${extension3}`;
1147732
+ }
1147733
+ }
1147734
+ await (0, import_promises132.writeFile)(
1147735
+ join4(dirname4(spec.absoluteFilepath), RelativeFilePath2.of(overridesFilename)),
1147736
+ jsYaml.dump(content5)
1147737
+ );
1147738
+ }
1147621
1147739
  }
1147622
1147740
  }
1147623
1147741
  function writeModels(existingSchemas, schemas) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.94.0",
2
+ "version": "3.95.0",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",