@fern-api/fern-api-dev 4.106.2 → 4.106.3-6-ga791f2f555d

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 +658 -589
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -344254,7 +344254,7 @@ var require_fernignore = __commonJS({
344254
344254
  "../../generator-cli/lib/replay/fernignore.js"(exports2) {
344255
344255
  "use strict";
344256
344256
  Object.defineProperty(exports2, "__esModule", { value: true });
344257
- exports2.REPLAY_FERNIGNORE_ENTRIES = void 0;
344257
+ exports2.GITATTRIBUTES_ENTRIES = exports2.REPLAY_FERNIGNORE_ENTRIES = void 0;
344258
344258
  exports2.ensureReplayFernignoreEntries = ensureReplayFernignoreEntries;
344259
344259
  exports2.ensureGitattributesEntries = ensureGitattributesEntries;
344260
344260
  exports2.ensureReplayFernignoreEntriesSync = ensureReplayFernignoreEntriesSync;
@@ -344263,7 +344263,7 @@ var require_fernignore = __commonJS({
344263
344263
  var promises_1 = require("fs/promises");
344264
344264
  var path_1 = require("path");
344265
344265
  exports2.REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock", ".fern/replay.yml", ".gitattributes"];
344266
- var GITATTRIBUTES_ENTRIES = [".fern/replay.lock linguist-generated=true"];
344266
+ exports2.GITATTRIBUTES_ENTRIES = [".fern/replay.lock linguist-generated=true"];
344267
344267
  async function ensureReplayFernignoreEntries(outputDir) {
344268
344268
  const fernignorePath = (0, path_1.join)(outputDir, ".fernignore");
344269
344269
  let content5 = "";
@@ -344288,7 +344288,7 @@ var require_fernignore = __commonJS({
344288
344288
  } catch {
344289
344289
  }
344290
344290
  const lines = content5.split("\n");
344291
- const toAdd = GITATTRIBUTES_ENTRIES.filter((entry) => !lines.some((line) => line.trim() === entry));
344291
+ const toAdd = exports2.GITATTRIBUTES_ENTRIES.filter((entry) => !lines.some((line) => line.trim() === entry));
344292
344292
  if (toAdd.length > 0) {
344293
344293
  const suffix = content5.length > 0 && !content5.endsWith("\n") ? "\n" : "";
344294
344294
  await (0, promises_1.writeFile)(gitattributesPath, content5 + suffix + toAdd.join("\n") + "\n", "utf-8");
@@ -344314,7 +344314,7 @@ var require_fernignore = __commonJS({
344314
344314
  content5 = (0, fs_1.readFileSync)(gitattributesPath, "utf-8");
344315
344315
  }
344316
344316
  const lines = content5.split("\n");
344317
- const toAdd = GITATTRIBUTES_ENTRIES.filter((entry) => !lines.some((line) => line.trim() === entry));
344317
+ const toAdd = exports2.GITATTRIBUTES_ENTRIES.filter((entry) => !lines.some((line) => line.trim() === entry));
344318
344318
  if (toAdd.length > 0) {
344319
344319
  const suffix = content5.length > 0 && !content5.endsWith("\n") ? "\n" : "";
344320
344320
  (0, fs_1.writeFileSync)(gitattributesPath, content5 + suffix + toAdd.join("\n") + "\n", "utf-8");
@@ -344356,22 +344356,18 @@ var require_replay_init = __commonJS({
344356
344356
  importHistory: params2.importHistory
344357
344357
  });
344358
344358
  if (!bootstrapResult.generationCommit) {
344359
- return { bootstrap: bootstrapResult, fernignoreEntries: [] };
344359
+ return { bootstrap: bootstrapResult, fernignoreEntries: [], gitattributesEntries: [] };
344360
344360
  }
344361
344361
  if (dryRun) {
344362
- return { bootstrap: bootstrapResult, fernignoreEntries: [] };
344362
+ return { bootstrap: bootstrapResult, fernignoreEntries: [], gitattributesEntries: [] };
344363
344363
  }
344364
- (0, fernignore_1.ensureReplayFernignoreEntriesSync)(repoPath);
344365
- (0, fernignore_1.ensureGitattributesEntriesSync)(repoPath);
344366
344364
  const lockfilePath = (0, path_1.join)(repoPath, ".fern", "replay.lock");
344367
344365
  const lockfileContent = (0, fs_1.existsSync)(lockfilePath) ? (0, fs_1.readFileSync)(lockfilePath, "utf-8") : void 0;
344368
- const replayYmlPath = (0, path_1.join)(repoPath, ".fern", "replay.yml");
344369
- const replayYmlContent = (0, fs_1.existsSync)(replayYmlPath) ? (0, fs_1.readFileSync)(replayYmlPath, "utf-8") : void 0;
344370
344366
  return {
344371
344367
  bootstrap: bootstrapResult,
344372
344368
  lockfileContent,
344373
- replayYmlContent,
344374
344369
  fernignoreEntries: fernignore_1.REPLAY_FERNIGNORE_ENTRIES,
344370
+ gitattributesEntries: fernignore_1.GITATTRIBUTES_ENTRIES,
344375
344371
  prBody: buildPrBody(bootstrapResult)
344376
344372
  };
344377
344373
  }
@@ -344713,6 +344709,7 @@ var require_replay_submit_init = __commonJS({
344713
344709
  repo,
344714
344710
  lockfileContents: initResult.lockfileContent,
344715
344711
  fernignoreEntries: initResult.fernignoreEntries,
344712
+ gitattributesEntries: initResult.gitattributesEntries,
344716
344713
  prBody: initResult.prBody
344717
344714
  })
344718
344715
  });
@@ -516849,7 +516846,8 @@ var OpenApiSettingsSchema = schemas_exports8.object({
516849
516846
  "inline-all-of-schemas": schemas_exports8.boolean().optional(),
516850
516847
  "resolve-aliases": ResolveAliases.optional(),
516851
516848
  "group-multi-api-environments": schemas_exports8.boolean().optional(),
516852
- "default-integer-format": DefaultIntegerFormat2.optional()
516849
+ "default-integer-format": DefaultIntegerFormat2.optional(),
516850
+ "infer-discriminated-union-base-properties": schemas_exports8.boolean().optional()
516853
516851
  }).extend(BaseApiSettingsSchema);
516854
516852
 
516855
516853
  // ../configuration/lib/generators-yml/schemas/serialization/resources/generators/types/ApiConfigurationV2SettingsSchema.js
@@ -529831,7 +529829,8 @@ var DEFAULT_PARSE_OPENAPI_SETTINGS = {
529831
529829
  resolveSchemaCollisions: false,
529832
529830
  inferForwardCompatible: false,
529833
529831
  coerceConstsTo: "enums-coerceable-to-literals",
529834
- respectByteFormat: false
529832
+ respectByteFormat: false,
529833
+ shouldInferDiscriminatedUnionBaseProperties: false
529835
529834
  };
529836
529835
  function mergeOptions2(params2) {
529837
529836
  const { defaults: defaults3, options: options2, overrides, overrideOnly = /* @__PURE__ */ new Set(), undefinedIfAbsent = /* @__PURE__ */ new Set() } = params2;
@@ -530574,572 +530573,6 @@ function convertAvailability2(propertySchema) {
530574
530573
  return void 0;
530575
530574
  }
530576
530575
 
530577
- // ../api-importers/openapi/openapi-ir-parser/lib/schema/inferDiscriminatorContext.js
530578
- var SSE_SPEC_FIELDS = /* @__PURE__ */ new Set(["event", "data", "id", "retry"]);
530579
- function collectAllProperties(schema2, context3) {
530580
- let allProperties = {
530581
- ...schema2.properties ?? {}
530582
- };
530583
- for (const allOfElement of schema2.allOf ?? []) {
530584
- if (isReferenceObject(allOfElement)) {
530585
- const resolved = context3.resolveSchemaReference(allOfElement);
530586
- const inheritedProperties = collectAllProperties(resolved, context3);
530587
- allProperties = { ...inheritedProperties, ...allProperties };
530588
- } else {
530589
- const inheritedProperties = collectAllProperties(allOfElement, context3);
530590
- allProperties = { ...inheritedProperties, ...allProperties };
530591
- }
530592
- }
530593
- return allProperties;
530594
- }
530595
- function resolvePropertySchema(schema2, context3) {
530596
- if (isReferenceObject(schema2)) {
530597
- return context3.resolveSchemaReference(schema2);
530598
- }
530599
- return schema2;
530600
- }
530601
- function variantMatchesSseSpec(schema2, context3) {
530602
- const allProperties = collectAllProperties(schema2, context3);
530603
- const propertyEntries = Object.entries(allProperties);
530604
- if (propertyEntries.length === 0) {
530605
- return false;
530606
- }
530607
- let hasEvent = false;
530608
- for (const [propName, propSchema] of propertyEntries) {
530609
- if (!SSE_SPEC_FIELDS.has(propName)) {
530610
- return false;
530611
- }
530612
- const resolved = resolvePropertySchema(propSchema, context3);
530613
- switch (propName) {
530614
- case "event":
530615
- hasEvent = true;
530616
- if (resolved.type !== "string") {
530617
- return false;
530618
- }
530619
- break;
530620
- case "id":
530621
- if (resolved.type !== "string") {
530622
- return false;
530623
- }
530624
- break;
530625
- case "retry":
530626
- if (resolved.type !== "integer") {
530627
- return false;
530628
- }
530629
- break;
530630
- case "data":
530631
- break;
530632
- }
530633
- }
530634
- return hasEvent;
530635
- }
530636
- function resolveDiscriminatorContext({ discriminator, context: context3 }) {
530637
- return getExtension(discriminator, FernOpenAPIExtension.DISCRIMINATOR_CONTEXT) ?? inferDiscriminatorContext({ discriminator, context: context3 });
530638
- }
530639
- function inferDiscriminatorContext({ discriminator, context: context3 }) {
530640
- const mapping = discriminator.mapping;
530641
- if (mapping == null || Object.keys(mapping).length === 0) {
530642
- return "data";
530643
- }
530644
- for (const schema2 of Object.values(mapping)) {
530645
- try {
530646
- const resolved = context3.resolveSchemaReference({ $ref: schema2 });
530647
- if (!variantMatchesSseSpec(resolved, context3)) {
530648
- return "data";
530649
- }
530650
- } catch {
530651
- return "data";
530652
- }
530653
- }
530654
- return "protocol";
530655
- }
530656
- function inferDiscriminatorContextFromVariants({ variants, context: context3 }) {
530657
- const variantEntries = Object.values(variants);
530658
- if (variantEntries.length === 0) {
530659
- return "data";
530660
- }
530661
- for (const variantSchema of variantEntries) {
530662
- try {
530663
- const resolved = isReferenceObject(variantSchema) ? context3.resolveSchemaReference(variantSchema) : variantSchema;
530664
- if (!variantMatchesSseSpec(resolved, context3)) {
530665
- return "data";
530666
- }
530667
- } catch {
530668
- return "data";
530669
- }
530670
- }
530671
- return "protocol";
530672
- }
530673
-
530674
- // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertDiscriminatedOneOf.js
530675
- function convertDiscriminatedOneOf({ nameOverride, generatedName, title: title2, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminator, context: context3, namespace, groupName, encoding, source: source2 }) {
530676
- const discriminant21 = discriminator.propertyName;
530677
- const discriminantNameOverride = getExtension(discriminator, FernOpenAPIExtension.FERN_PROPERTY_NAME);
530678
- const discriminatorContext = resolveDiscriminatorContext({ discriminator, context: context3 });
530679
- const unionSubTypes = Object.fromEntries(Object.entries(discriminator.mapping ?? {}).map(([discriminantValue, schema2]) => {
530680
- const subtypeReference = convertReferenceObject({
530681
- $ref: schema2
530682
- }, false, false, context3, [schema2], encoding, source2, namespace);
530683
- context3.markReferencedByDiscriminatedUnion({
530684
- $ref: schema2
530685
- }, discriminant21, 1);
530686
- return [discriminantValue, subtypeReference];
530687
- }));
530688
- const convertedProperties = Object.entries(properties7).filter(([propertyName]) => {
530689
- return propertyName !== discriminant21;
530690
- }).map(([propertyName, propertySchema]) => {
530691
- const isRequired = required6 != null && required6.includes(propertyName);
530692
- const [isOptional, isNullable] = context3.options.coerceOptionalSchemasToNullable ? [false, !isRequired] : [!isRequired, false];
530693
- const schema2 = convertSchema2(propertySchema, isOptional, isNullable, context3, [...breadcrumbs, propertyName], source2, namespace);
530694
- return {
530695
- key: propertyName,
530696
- schema: schema2
530697
- };
530698
- });
530699
- return wrapDiscriminatedOneOf({
530700
- nameOverride,
530701
- generatedName,
530702
- title: title2,
530703
- wrapAsOptional,
530704
- wrapAsNullable,
530705
- properties: convertedProperties,
530706
- description,
530707
- availability,
530708
- discriminant: discriminant21,
530709
- discriminantNameOverride,
530710
- discriminatorContext,
530711
- subtypes: unionSubTypes,
530712
- defaultDiscriminantValue: void 0,
530713
- namespace,
530714
- groupName,
530715
- source: source2
530716
- });
530717
- }
530718
- function convertDiscriminatedOneOfWithVariants({ nameOverride, generatedName, title: title2, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminant: discriminant21, variants, defaultDiscriminantValue, context: context3, namespace, groupName, encoding, source: source2 }) {
530719
- const unionSubTypes = Object.fromEntries(Object.entries(variants).map(([discriminantValue, schema2]) => {
530720
- if (isReferenceObject(schema2)) {
530721
- const subtypeReference = convertReferenceObject(schema2, false, false, context3, [schema2.$ref], encoding, source2, namespace);
530722
- context3.markReferencedByDiscriminatedUnion(schema2, discriminant21, 1);
530723
- return [discriminantValue, subtypeReference];
530724
- } else {
530725
- const variantSchema = convertSchemaObject(schema2, false, false, context3, [...breadcrumbs, discriminantValue], encoding, source2, namespace, /* @__PURE__ */ new Set([discriminant21]));
530726
- return [discriminantValue, variantSchema];
530727
- }
530728
- }));
530729
- const convertedProperties = Object.entries(properties7).filter(([propertyName]) => {
530730
- return propertyName !== discriminant21;
530731
- }).map(([propertyName, propertySchema]) => {
530732
- const isRequired = required6 != null && required6.includes(propertyName);
530733
- const [isOptional, isNullable] = context3.options.coerceOptionalSchemasToNullable ? [false, !isRequired] : [!isRequired, false];
530734
- const schema2 = convertSchema2(propertySchema, isOptional, isNullable, context3, [...breadcrumbs, propertyName], source2, namespace);
530735
- return {
530736
- key: propertyName,
530737
- schema: schema2
530738
- };
530739
- });
530740
- return wrapDiscriminatedOneOf({
530741
- nameOverride,
530742
- generatedName,
530743
- title: title2,
530744
- wrapAsOptional,
530745
- wrapAsNullable,
530746
- properties: convertedProperties,
530747
- description,
530748
- availability,
530749
- discriminant: discriminant21,
530750
- discriminantNameOverride: void 0,
530751
- discriminatorContext: inferDiscriminatorContextFromVariants({ variants, context: context3 }),
530752
- subtypes: unionSubTypes,
530753
- defaultDiscriminantValue,
530754
- namespace,
530755
- groupName,
530756
- source: source2
530757
- });
530758
- }
530759
- function wrapDiscriminatedOneOf({ nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, properties: properties7, description, availability, discriminant: discriminant21, discriminantNameOverride, discriminatorContext, subtypes, defaultDiscriminantValue, namespace, groupName, source: source2 }) {
530760
- let result = SchemaWithExample.oneOf(OneOfSchemaWithExample.discriminated({
530761
- description,
530762
- availability,
530763
- discriminantProperty: discriminant21,
530764
- discriminantPropertyNameOverride: discriminantNameOverride,
530765
- discriminatorContext,
530766
- defaultDiscriminantValue,
530767
- nameOverride,
530768
- generatedName,
530769
- title: title2,
530770
- schemas: subtypes,
530771
- commonProperties: properties7,
530772
- namespace,
530773
- groupName,
530774
- encoding: void 0,
530775
- source: source2,
530776
- inline: void 0
530777
- }));
530778
- if (wrapAsNullable) {
530779
- result = SchemaWithExample.nullable({
530780
- nameOverride,
530781
- generatedName,
530782
- title: title2,
530783
- value: result,
530784
- namespace,
530785
- groupName,
530786
- description,
530787
- availability,
530788
- inline: void 0
530789
- });
530790
- }
530791
- if (wrapAsOptional) {
530792
- result = SchemaWithExample.optional({
530793
- nameOverride,
530794
- generatedName,
530795
- title: title2,
530796
- value: result,
530797
- namespace,
530798
- groupName,
530799
- description,
530800
- availability,
530801
- inline: void 0
530802
- });
530803
- }
530804
- return result;
530805
- }
530806
-
530807
- // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertEncoding.js
530808
- function convertEncoding(encodingSchema) {
530809
- if (encodingSchema.proto != null) {
530810
- return Encoding2.protobuf({
530811
- typeName: encodingSchema.proto.type
530812
- });
530813
- }
530814
- return void 0;
530815
- }
530816
-
530817
- // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertEnum.js
530818
- function convertEnum({ nameOverride, generatedName, title: title2, fernEnum, enumVarNames, enumValues, _default: _default4, description, availability, wrapAsOptional, wrapAsNullable, namespace, groupName, context: context3, source: source2, inline }) {
530819
- const strippedEnumVarNames = stripCommonPrefix(enumVarNames ?? []);
530820
- const uniqueValues = new Set(enumValues);
530821
- const values2 = Array.from(uniqueValues).map((value2, index3) => {
530822
- const fernEnumValue = fernEnum?.[value2];
530823
- const enumVarName = strippedEnumVarNames[index3];
530824
- const valueIsValidName = VALID_ENUM_NAME_REGEX.test(value2);
530825
- let nameOverride2 = fernEnumValue?.name ?? enumVarName;
530826
- const generatedName2 = valueIsValidName ? value2 : generateEnumNameFromValue(value2);
530827
- if (nameOverride2 != null && !VALID_ENUM_NAME_REGEX.test(nameOverride2)) {
530828
- context3?.logger.warn(`Enum name override ${nameOverride2} is not a valid name. Falling back on ${generatedName2}.`);
530829
- nameOverride2 = void 0;
530830
- }
530831
- return {
530832
- nameOverride: nameOverride2,
530833
- generatedName: generatedName2,
530834
- value: value2,
530835
- description: fernEnumValue?.description,
530836
- availability,
530837
- casing: {
530838
- snake: fernEnumValue?.casing?.snake ?? void 0,
530839
- pascal: fernEnumValue?.casing?.pascal ?? void 0,
530840
- screamingSnake: fernEnumValue?.casing?.screamingSnake ?? void 0,
530841
- camel: fernEnumValue?.casing?.camel ?? void 0
530842
- }
530843
- };
530844
- });
530845
- const _defaultEnumValue = _default4 != null ? values2.find((value2) => value2.value === _default4) : void 0;
530846
- return wrapEnum({
530847
- wrapAsOptional,
530848
- wrapAsNullable,
530849
- nameOverride,
530850
- generatedName,
530851
- title: title2,
530852
- values: values2,
530853
- _default: _defaultEnumValue,
530854
- description,
530855
- availability,
530856
- namespace,
530857
- groupName,
530858
- source: source2,
530859
- inline
530860
- });
530861
- }
530862
- function wrapEnum({ wrapAsOptional, wrapAsNullable, nameOverride, generatedName, title: title2, values: values2, _default: _default4, description, availability, namespace, groupName, source: source2, inline }) {
530863
- let result = SchemaWithExample.enum({
530864
- nameOverride,
530865
- generatedName,
530866
- title: title2,
530867
- values: values2,
530868
- description,
530869
- availability,
530870
- default: _default4,
530871
- example: void 0,
530872
- namespace,
530873
- groupName,
530874
- source: source2,
530875
- inline
530876
- });
530877
- if (wrapAsNullable) {
530878
- result = SchemaWithExample.nullable({
530879
- nameOverride,
530880
- generatedName,
530881
- title: title2,
530882
- value: result,
530883
- description,
530884
- availability,
530885
- namespace,
530886
- groupName,
530887
- inline
530888
- });
530889
- }
530890
- if (wrapAsOptional) {
530891
- result = SchemaWithExample.optional({
530892
- nameOverride,
530893
- generatedName,
530894
- title: title2,
530895
- value: result,
530896
- description,
530897
- availability,
530898
- namespace,
530899
- groupName,
530900
- inline
530901
- });
530902
- }
530903
- return result;
530904
- }
530905
- function stripCommonPrefix(names2) {
530906
- if (names2.length <= 1 || names2[0] == null) {
530907
- return names2;
530908
- }
530909
- const nameZero = names2[0];
530910
- let i9 = 0;
530911
- while (nameZero[i9] != null && names2.every((name2) => name2[i9] === nameZero[i9])) {
530912
- i9++;
530913
- }
530914
- return names2.map((name2) => name2.substring(i9));
530915
- }
530916
-
530917
- // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertInteger.js
530918
- function convertInteger({ nameOverride, generatedName, title: title2, format: format3, _default: _default4, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, description, availability, wrapAsOptional, wrapAsNullable, example, namespace, groupName, defaultIntegerFormat = generators_yml_exports.DefaultIntegerFormat.Int32 }) {
530919
- const effectiveFormat = format3 ?? defaultIntegerFormat;
530920
- const primitive = (() => {
530921
- switch (effectiveFormat) {
530922
- case generators_yml_exports.DefaultIntegerFormat.Int64:
530923
- return PrimitiveSchemaValueWithExample.int64({ default: _default4, example });
530924
- case generators_yml_exports.DefaultIntegerFormat.Uint32:
530925
- return PrimitiveSchemaValueWithExample.uint({ default: _default4, example });
530926
- case generators_yml_exports.DefaultIntegerFormat.Uint64:
530927
- return PrimitiveSchemaValueWithExample.uint64({ default: _default4, example });
530928
- default:
530929
- return PrimitiveSchemaValueWithExample.int({
530930
- default: _default4,
530931
- minimum,
530932
- maximum,
530933
- exclusiveMinimum,
530934
- exclusiveMaximum,
530935
- multipleOf,
530936
- example
530937
- });
530938
- }
530939
- })();
530940
- return wrapPrimitive({
530941
- nameOverride,
530942
- generatedName,
530943
- title: title2,
530944
- primitive,
530945
- wrapAsOptional,
530946
- wrapAsNullable,
530947
- description,
530948
- availability,
530949
- namespace,
530950
- groupName
530951
- });
530952
- }
530953
-
530954
- // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertLiteral.js
530955
- function createLiteralSchemaValue(value2) {
530956
- if (typeof value2 === "string") {
530957
- return LiteralSchemaValue.string(value2);
530958
- } else if (typeof value2 === "boolean") {
530959
- return LiteralSchemaValue.boolean(value2);
530960
- } else {
530961
- return LiteralSchemaValue.string(`${value2}`);
530962
- }
530963
- }
530964
- function convertLiteral({ nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, value: value2, description, availability, namespace, groupName }) {
530965
- let result = SchemaWithExample.literal({
530966
- nameOverride,
530967
- generatedName,
530968
- title: title2,
530969
- value: createLiteralSchemaValue(value2),
530970
- description,
530971
- availability,
530972
- namespace,
530973
- groupName
530974
- });
530975
- if (wrapAsNullable) {
530976
- result = SchemaWithExample.nullable({
530977
- nameOverride,
530978
- generatedName,
530979
- title: title2,
530980
- value: result,
530981
- description,
530982
- availability,
530983
- namespace,
530984
- groupName,
530985
- inline: void 0
530986
- });
530987
- }
530988
- if (wrapAsOptional) {
530989
- result = SchemaWithExample.optional({
530990
- nameOverride,
530991
- generatedName,
530992
- title: title2,
530993
- value: result,
530994
- description,
530995
- availability,
530996
- namespace,
530997
- groupName,
530998
- inline: void 0
530999
- });
531000
- }
531001
- return result;
531002
- }
531003
-
531004
- // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertNumber.js
531005
- function convertNumber({ nameOverride, generatedName, title: title2, format: format3, _default: _default4, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, description, availability, wrapAsOptional, wrapAsNullable, example, namespace, groupName }) {
531006
- if (format3 == null || format3 === "double") {
531007
- return wrapPrimitive({
531008
- nameOverride,
531009
- generatedName,
531010
- title: title2,
531011
- primitive: PrimitiveSchemaValueWithExample.double({
531012
- default: _default4,
531013
- minimum,
531014
- maximum,
531015
- exclusiveMinimum,
531016
- exclusiveMaximum,
531017
- multipleOf,
531018
- example
531019
- }),
531020
- wrapAsOptional,
531021
- wrapAsNullable,
531022
- description,
531023
- availability,
531024
- namespace,
531025
- groupName
531026
- });
531027
- } else if (format3 === "float") {
531028
- return wrapPrimitive({
531029
- nameOverride,
531030
- generatedName,
531031
- title: title2,
531032
- primitive: PrimitiveSchemaValueWithExample.float({
531033
- example
531034
- }),
531035
- wrapAsOptional,
531036
- wrapAsNullable,
531037
- description,
531038
- availability,
531039
- namespace,
531040
- groupName
531041
- });
531042
- } else if (format3 === "int32") {
531043
- return wrapPrimitive({
531044
- nameOverride,
531045
- generatedName,
531046
- title: title2,
531047
- primitive: PrimitiveSchemaValueWithExample.int({
531048
- default: _default4,
531049
- minimum,
531050
- maximum,
531051
- exclusiveMinimum,
531052
- exclusiveMaximum,
531053
- multipleOf,
531054
- example
531055
- }),
531056
- wrapAsOptional,
531057
- wrapAsNullable,
531058
- description,
531059
- availability,
531060
- namespace,
531061
- groupName
531062
- });
531063
- } else if (format3 === "int64") {
531064
- return wrapPrimitive({
531065
- nameOverride,
531066
- generatedName,
531067
- title: title2,
531068
- primitive: PrimitiveSchemaValueWithExample.int64({
531069
- default: _default4,
531070
- example
531071
- }),
531072
- wrapAsOptional,
531073
- wrapAsNullable,
531074
- description,
531075
- availability,
531076
- namespace,
531077
- groupName
531078
- });
531079
- } else if (format3 === "uint32") {
531080
- return wrapPrimitive({
531081
- nameOverride,
531082
- generatedName,
531083
- title: title2,
531084
- primitive: PrimitiveSchemaValueWithExample.uint({
531085
- default: _default4,
531086
- example
531087
- }),
531088
- wrapAsOptional,
531089
- wrapAsNullable,
531090
- description,
531091
- availability,
531092
- namespace,
531093
- groupName
531094
- });
531095
- } else if (format3 === "uint64") {
531096
- return wrapPrimitive({
531097
- nameOverride,
531098
- generatedName,
531099
- title: title2,
531100
- primitive: PrimitiveSchemaValueWithExample.uint64({
531101
- default: _default4,
531102
- example
531103
- }),
531104
- wrapAsOptional,
531105
- wrapAsNullable,
531106
- description,
531107
- availability,
531108
- namespace,
531109
- groupName
531110
- });
531111
- } else if (format3 === "time-delta") {
531112
- return wrapPrimitive({
531113
- nameOverride,
531114
- generatedName,
531115
- title: title2,
531116
- primitive: PrimitiveSchemaValueWithExample.float({
531117
- example
531118
- }),
531119
- wrapAsOptional,
531120
- wrapAsNullable,
531121
- description,
531122
- availability,
531123
- namespace,
531124
- groupName
531125
- });
531126
- }
531127
- return wrapPrimitive({
531128
- nameOverride,
531129
- generatedName,
531130
- title: title2,
531131
- primitive: PrimitiveSchemaValueWithExample.float({
531132
- example
531133
- }),
531134
- wrapAsOptional,
531135
- wrapAsNullable,
531136
- description,
531137
- availability,
531138
- namespace,
531139
- groupName
531140
- });
531141
- }
531142
-
531143
530576
  // ../api-importers/openapi/openapi-ir-parser/lib/schema/utils/getBreadcrumbsFromReference.js
531144
530577
  var STARTS_WITH_COMPONENTS_SCHEMAS = {
531145
530578
  // if the first three breadcrumbs are "#", "components", "schemas"
@@ -531869,6 +531302,629 @@ function getAllProperties({ schema: schema2, context: context3, breadcrumbs, sou
531869
531302
  return properties7;
531870
531303
  }
531871
531304
 
531305
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/inferDiscriminatorContext.js
531306
+ var SSE_SPEC_FIELDS = /* @__PURE__ */ new Set(["event", "data", "id", "retry"]);
531307
+ function collectAllProperties(schema2, context3) {
531308
+ let allProperties = {
531309
+ ...schema2.properties ?? {}
531310
+ };
531311
+ for (const allOfElement of schema2.allOf ?? []) {
531312
+ if (isReferenceObject(allOfElement)) {
531313
+ const resolved = context3.resolveSchemaReference(allOfElement);
531314
+ const inheritedProperties = collectAllProperties(resolved, context3);
531315
+ allProperties = { ...inheritedProperties, ...allProperties };
531316
+ } else {
531317
+ const inheritedProperties = collectAllProperties(allOfElement, context3);
531318
+ allProperties = { ...inheritedProperties, ...allProperties };
531319
+ }
531320
+ }
531321
+ return allProperties;
531322
+ }
531323
+ function resolvePropertySchema(schema2, context3) {
531324
+ if (isReferenceObject(schema2)) {
531325
+ return context3.resolveSchemaReference(schema2);
531326
+ }
531327
+ return schema2;
531328
+ }
531329
+ function variantMatchesSseSpec(schema2, context3) {
531330
+ const allProperties = collectAllProperties(schema2, context3);
531331
+ const propertyEntries = Object.entries(allProperties);
531332
+ if (propertyEntries.length === 0) {
531333
+ return false;
531334
+ }
531335
+ let hasEvent = false;
531336
+ for (const [propName, propSchema] of propertyEntries) {
531337
+ if (!SSE_SPEC_FIELDS.has(propName)) {
531338
+ return false;
531339
+ }
531340
+ const resolved = resolvePropertySchema(propSchema, context3);
531341
+ switch (propName) {
531342
+ case "event":
531343
+ hasEvent = true;
531344
+ if (resolved.type !== "string") {
531345
+ return false;
531346
+ }
531347
+ break;
531348
+ case "id":
531349
+ if (resolved.type !== "string") {
531350
+ return false;
531351
+ }
531352
+ break;
531353
+ case "retry":
531354
+ if (resolved.type !== "integer") {
531355
+ return false;
531356
+ }
531357
+ break;
531358
+ case "data":
531359
+ break;
531360
+ }
531361
+ }
531362
+ return hasEvent;
531363
+ }
531364
+ function resolveDiscriminatorContext({ discriminator, context: context3 }) {
531365
+ return getExtension(discriminator, FernOpenAPIExtension.DISCRIMINATOR_CONTEXT) ?? inferDiscriminatorContext({ discriminator, context: context3 });
531366
+ }
531367
+ function inferDiscriminatorContext({ discriminator, context: context3 }) {
531368
+ const mapping = discriminator.mapping;
531369
+ if (mapping == null || Object.keys(mapping).length === 0) {
531370
+ return "data";
531371
+ }
531372
+ for (const schema2 of Object.values(mapping)) {
531373
+ try {
531374
+ const resolved = context3.resolveSchemaReference({ $ref: schema2 });
531375
+ if (!variantMatchesSseSpec(resolved, context3)) {
531376
+ return "data";
531377
+ }
531378
+ } catch {
531379
+ return "data";
531380
+ }
531381
+ }
531382
+ return "protocol";
531383
+ }
531384
+ function inferDiscriminatorContextFromVariants({ variants, context: context3 }) {
531385
+ const variantEntries = Object.values(variants);
531386
+ if (variantEntries.length === 0) {
531387
+ return "data";
531388
+ }
531389
+ for (const variantSchema of variantEntries) {
531390
+ try {
531391
+ const resolved = isReferenceObject(variantSchema) ? context3.resolveSchemaReference(variantSchema) : variantSchema;
531392
+ if (!variantMatchesSseSpec(resolved, context3)) {
531393
+ return "data";
531394
+ }
531395
+ } catch {
531396
+ return "data";
531397
+ }
531398
+ }
531399
+ return "protocol";
531400
+ }
531401
+
531402
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertDiscriminatedOneOf.js
531403
+ function convertDiscriminatedOneOf({ nameOverride, generatedName, title: title2, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminator, context: context3, namespace, groupName, encoding, source: source2 }) {
531404
+ const discriminant21 = discriminator.propertyName;
531405
+ const discriminantNameOverride = getExtension(discriminator, FernOpenAPIExtension.FERN_PROPERTY_NAME);
531406
+ const discriminatorContext = resolveDiscriminatorContext({ discriminator, context: context3 });
531407
+ const unionSubTypes = Object.fromEntries(Object.entries(discriminator.mapping ?? {}).map(([discriminantValue, schema2]) => {
531408
+ const subtypeReference = convertReferenceObject({
531409
+ $ref: schema2
531410
+ }, false, false, context3, [schema2], encoding, source2, namespace);
531411
+ context3.markReferencedByDiscriminatedUnion({
531412
+ $ref: schema2
531413
+ }, discriminant21, 1);
531414
+ return [discriminantValue, subtypeReference];
531415
+ }));
531416
+ const convertedProperties = Object.entries(properties7).filter(([propertyName]) => {
531417
+ return propertyName !== discriminant21;
531418
+ }).map(([propertyName, propertySchema]) => {
531419
+ const isRequired = required6 != null && required6.includes(propertyName);
531420
+ const [isOptional, isNullable] = context3.options.coerceOptionalSchemasToNullable ? [false, !isRequired] : [!isRequired, false];
531421
+ const schema2 = convertSchema2(propertySchema, isOptional, isNullable, context3, [...breadcrumbs, propertyName], source2, namespace);
531422
+ return {
531423
+ key: propertyName,
531424
+ schema: schema2
531425
+ };
531426
+ });
531427
+ if (context3.options.shouldInferDiscriminatedUnionBaseProperties) {
531428
+ const variantSchemas = Object.values(discriminator.mapping ?? {}).map(($ref) => ({ $ref }));
531429
+ const inferredCommonProperties = inferCommonPropertiesFromVariants({
531430
+ variants: variantSchemas,
531431
+ discriminant: discriminant21,
531432
+ existingPropertyNames: new Set(convertedProperties.map((p14) => p14.key)),
531433
+ context: context3,
531434
+ breadcrumbs,
531435
+ source: source2,
531436
+ namespace
531437
+ });
531438
+ convertedProperties.push(...inferredCommonProperties);
531439
+ }
531440
+ return wrapDiscriminatedOneOf({
531441
+ nameOverride,
531442
+ generatedName,
531443
+ title: title2,
531444
+ wrapAsOptional,
531445
+ wrapAsNullable,
531446
+ properties: convertedProperties,
531447
+ description,
531448
+ availability,
531449
+ discriminant: discriminant21,
531450
+ discriminantNameOverride,
531451
+ discriminatorContext,
531452
+ subtypes: unionSubTypes,
531453
+ defaultDiscriminantValue: void 0,
531454
+ namespace,
531455
+ groupName,
531456
+ source: source2
531457
+ });
531458
+ }
531459
+ function convertDiscriminatedOneOfWithVariants({ nameOverride, generatedName, title: title2, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminant: discriminant21, variants, defaultDiscriminantValue, context: context3, namespace, groupName, encoding, source: source2 }) {
531460
+ const unionSubTypes = Object.fromEntries(Object.entries(variants).map(([discriminantValue, schema2]) => {
531461
+ if (isReferenceObject(schema2)) {
531462
+ const subtypeReference = convertReferenceObject(schema2, false, false, context3, [schema2.$ref], encoding, source2, namespace);
531463
+ context3.markReferencedByDiscriminatedUnion(schema2, discriminant21, 1);
531464
+ return [discriminantValue, subtypeReference];
531465
+ } else {
531466
+ const variantSchema = convertSchemaObject(schema2, false, false, context3, [...breadcrumbs, discriminantValue], encoding, source2, namespace, /* @__PURE__ */ new Set([discriminant21]));
531467
+ return [discriminantValue, variantSchema];
531468
+ }
531469
+ }));
531470
+ const convertedProperties = Object.entries(properties7).filter(([propertyName]) => {
531471
+ return propertyName !== discriminant21;
531472
+ }).map(([propertyName, propertySchema]) => {
531473
+ const isRequired = required6 != null && required6.includes(propertyName);
531474
+ const [isOptional, isNullable] = context3.options.coerceOptionalSchemasToNullable ? [false, !isRequired] : [!isRequired, false];
531475
+ const schema2 = convertSchema2(propertySchema, isOptional, isNullable, context3, [...breadcrumbs, propertyName], source2, namespace);
531476
+ return {
531477
+ key: propertyName,
531478
+ schema: schema2
531479
+ };
531480
+ });
531481
+ if (context3.options.shouldInferDiscriminatedUnionBaseProperties) {
531482
+ const inferredCommonProperties = inferCommonPropertiesFromVariants({
531483
+ variants: Object.values(variants),
531484
+ discriminant: discriminant21,
531485
+ existingPropertyNames: new Set(convertedProperties.map((p14) => p14.key)),
531486
+ context: context3,
531487
+ breadcrumbs,
531488
+ source: source2,
531489
+ namespace
531490
+ });
531491
+ convertedProperties.push(...inferredCommonProperties);
531492
+ }
531493
+ return wrapDiscriminatedOneOf({
531494
+ nameOverride,
531495
+ generatedName,
531496
+ title: title2,
531497
+ wrapAsOptional,
531498
+ wrapAsNullable,
531499
+ properties: convertedProperties,
531500
+ description,
531501
+ availability,
531502
+ discriminant: discriminant21,
531503
+ discriminantNameOverride: void 0,
531504
+ discriminatorContext: inferDiscriminatorContextFromVariants({ variants, context: context3 }),
531505
+ subtypes: unionSubTypes,
531506
+ defaultDiscriminantValue,
531507
+ namespace,
531508
+ groupName,
531509
+ source: source2
531510
+ });
531511
+ }
531512
+ function wrapDiscriminatedOneOf({ nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, properties: properties7, description, availability, discriminant: discriminant21, discriminantNameOverride, discriminatorContext, subtypes, defaultDiscriminantValue, namespace, groupName, source: source2 }) {
531513
+ let result = SchemaWithExample.oneOf(OneOfSchemaWithExample.discriminated({
531514
+ description,
531515
+ availability,
531516
+ discriminantProperty: discriminant21,
531517
+ discriminantPropertyNameOverride: discriminantNameOverride,
531518
+ discriminatorContext,
531519
+ defaultDiscriminantValue,
531520
+ nameOverride,
531521
+ generatedName,
531522
+ title: title2,
531523
+ schemas: subtypes,
531524
+ commonProperties: properties7,
531525
+ namespace,
531526
+ groupName,
531527
+ encoding: void 0,
531528
+ source: source2,
531529
+ inline: void 0
531530
+ }));
531531
+ if (wrapAsNullable) {
531532
+ result = SchemaWithExample.nullable({
531533
+ nameOverride,
531534
+ generatedName,
531535
+ title: title2,
531536
+ value: result,
531537
+ namespace,
531538
+ groupName,
531539
+ description,
531540
+ availability,
531541
+ inline: void 0
531542
+ });
531543
+ }
531544
+ if (wrapAsOptional) {
531545
+ result = SchemaWithExample.optional({
531546
+ nameOverride,
531547
+ generatedName,
531548
+ title: title2,
531549
+ value: result,
531550
+ namespace,
531551
+ groupName,
531552
+ description,
531553
+ availability,
531554
+ inline: void 0
531555
+ });
531556
+ }
531557
+ return result;
531558
+ }
531559
+ function inferCommonPropertiesFromVariants({ variants, discriminant: discriminant21, existingPropertyNames, context: context3, breadcrumbs, source: source2, namespace }) {
531560
+ if (variants.length === 0) {
531561
+ return [];
531562
+ }
531563
+ const variantPropertyMaps = variants.map((variant) => getAllProperties({ schema: variant, context: context3, breadcrumbs, source: source2, namespace }));
531564
+ const firstVariantProps = variantPropertyMaps[0];
531565
+ if (firstVariantProps == null) {
531566
+ return [];
531567
+ }
531568
+ const result = [];
531569
+ for (const [propertyName, firstSchema] of Object.entries(firstVariantProps)) {
531570
+ if (propertyName === discriminant21) {
531571
+ continue;
531572
+ }
531573
+ if (existingPropertyNames.has(propertyName)) {
531574
+ continue;
531575
+ }
531576
+ let presentInAll = true;
531577
+ for (let i9 = 1; i9 < variantPropertyMaps.length; i9++) {
531578
+ const map16 = variantPropertyMaps[i9];
531579
+ const otherSchema = map16?.[propertyName];
531580
+ if (otherSchema == null || !isSchemaWithExampleEqual(firstSchema, otherSchema)) {
531581
+ presentInAll = false;
531582
+ break;
531583
+ }
531584
+ }
531585
+ if (presentInAll) {
531586
+ result.push({ key: propertyName, schema: firstSchema });
531587
+ }
531588
+ }
531589
+ return result;
531590
+ }
531591
+
531592
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertEncoding.js
531593
+ function convertEncoding(encodingSchema) {
531594
+ if (encodingSchema.proto != null) {
531595
+ return Encoding2.protobuf({
531596
+ typeName: encodingSchema.proto.type
531597
+ });
531598
+ }
531599
+ return void 0;
531600
+ }
531601
+
531602
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertEnum.js
531603
+ function convertEnum({ nameOverride, generatedName, title: title2, fernEnum, enumVarNames, enumValues, _default: _default4, description, availability, wrapAsOptional, wrapAsNullable, namespace, groupName, context: context3, source: source2, inline }) {
531604
+ const strippedEnumVarNames = stripCommonPrefix(enumVarNames ?? []);
531605
+ const uniqueValues = new Set(enumValues);
531606
+ const values2 = Array.from(uniqueValues).map((value2, index3) => {
531607
+ const fernEnumValue = fernEnum?.[value2];
531608
+ const enumVarName = strippedEnumVarNames[index3];
531609
+ const valueIsValidName = VALID_ENUM_NAME_REGEX.test(value2);
531610
+ let nameOverride2 = fernEnumValue?.name ?? enumVarName;
531611
+ const generatedName2 = valueIsValidName ? value2 : generateEnumNameFromValue(value2);
531612
+ if (nameOverride2 != null && !VALID_ENUM_NAME_REGEX.test(nameOverride2)) {
531613
+ context3?.logger.warn(`Enum name override ${nameOverride2} is not a valid name. Falling back on ${generatedName2}.`);
531614
+ nameOverride2 = void 0;
531615
+ }
531616
+ return {
531617
+ nameOverride: nameOverride2,
531618
+ generatedName: generatedName2,
531619
+ value: value2,
531620
+ description: fernEnumValue?.description,
531621
+ availability,
531622
+ casing: {
531623
+ snake: fernEnumValue?.casing?.snake ?? void 0,
531624
+ pascal: fernEnumValue?.casing?.pascal ?? void 0,
531625
+ screamingSnake: fernEnumValue?.casing?.screamingSnake ?? void 0,
531626
+ camel: fernEnumValue?.casing?.camel ?? void 0
531627
+ }
531628
+ };
531629
+ });
531630
+ const _defaultEnumValue = _default4 != null ? values2.find((value2) => value2.value === _default4) : void 0;
531631
+ return wrapEnum({
531632
+ wrapAsOptional,
531633
+ wrapAsNullable,
531634
+ nameOverride,
531635
+ generatedName,
531636
+ title: title2,
531637
+ values: values2,
531638
+ _default: _defaultEnumValue,
531639
+ description,
531640
+ availability,
531641
+ namespace,
531642
+ groupName,
531643
+ source: source2,
531644
+ inline
531645
+ });
531646
+ }
531647
+ function wrapEnum({ wrapAsOptional, wrapAsNullable, nameOverride, generatedName, title: title2, values: values2, _default: _default4, description, availability, namespace, groupName, source: source2, inline }) {
531648
+ let result = SchemaWithExample.enum({
531649
+ nameOverride,
531650
+ generatedName,
531651
+ title: title2,
531652
+ values: values2,
531653
+ description,
531654
+ availability,
531655
+ default: _default4,
531656
+ example: void 0,
531657
+ namespace,
531658
+ groupName,
531659
+ source: source2,
531660
+ inline
531661
+ });
531662
+ if (wrapAsNullable) {
531663
+ result = SchemaWithExample.nullable({
531664
+ nameOverride,
531665
+ generatedName,
531666
+ title: title2,
531667
+ value: result,
531668
+ description,
531669
+ availability,
531670
+ namespace,
531671
+ groupName,
531672
+ inline
531673
+ });
531674
+ }
531675
+ if (wrapAsOptional) {
531676
+ result = SchemaWithExample.optional({
531677
+ nameOverride,
531678
+ generatedName,
531679
+ title: title2,
531680
+ value: result,
531681
+ description,
531682
+ availability,
531683
+ namespace,
531684
+ groupName,
531685
+ inline
531686
+ });
531687
+ }
531688
+ return result;
531689
+ }
531690
+ function stripCommonPrefix(names2) {
531691
+ if (names2.length <= 1 || names2[0] == null) {
531692
+ return names2;
531693
+ }
531694
+ const nameZero = names2[0];
531695
+ let i9 = 0;
531696
+ while (nameZero[i9] != null && names2.every((name2) => name2[i9] === nameZero[i9])) {
531697
+ i9++;
531698
+ }
531699
+ return names2.map((name2) => name2.substring(i9));
531700
+ }
531701
+
531702
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertInteger.js
531703
+ function convertInteger({ nameOverride, generatedName, title: title2, format: format3, _default: _default4, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, description, availability, wrapAsOptional, wrapAsNullable, example, namespace, groupName, defaultIntegerFormat = generators_yml_exports.DefaultIntegerFormat.Int32 }) {
531704
+ const effectiveFormat = format3 ?? defaultIntegerFormat;
531705
+ const primitive = (() => {
531706
+ switch (effectiveFormat) {
531707
+ case generators_yml_exports.DefaultIntegerFormat.Int64:
531708
+ return PrimitiveSchemaValueWithExample.int64({ default: _default4, example });
531709
+ case generators_yml_exports.DefaultIntegerFormat.Uint32:
531710
+ return PrimitiveSchemaValueWithExample.uint({ default: _default4, example });
531711
+ case generators_yml_exports.DefaultIntegerFormat.Uint64:
531712
+ return PrimitiveSchemaValueWithExample.uint64({ default: _default4, example });
531713
+ default:
531714
+ return PrimitiveSchemaValueWithExample.int({
531715
+ default: _default4,
531716
+ minimum,
531717
+ maximum,
531718
+ exclusiveMinimum,
531719
+ exclusiveMaximum,
531720
+ multipleOf,
531721
+ example
531722
+ });
531723
+ }
531724
+ })();
531725
+ return wrapPrimitive({
531726
+ nameOverride,
531727
+ generatedName,
531728
+ title: title2,
531729
+ primitive,
531730
+ wrapAsOptional,
531731
+ wrapAsNullable,
531732
+ description,
531733
+ availability,
531734
+ namespace,
531735
+ groupName
531736
+ });
531737
+ }
531738
+
531739
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertLiteral.js
531740
+ function createLiteralSchemaValue(value2) {
531741
+ if (typeof value2 === "string") {
531742
+ return LiteralSchemaValue.string(value2);
531743
+ } else if (typeof value2 === "boolean") {
531744
+ return LiteralSchemaValue.boolean(value2);
531745
+ } else {
531746
+ return LiteralSchemaValue.string(`${value2}`);
531747
+ }
531748
+ }
531749
+ function convertLiteral({ nameOverride, generatedName, title: title2, wrapAsOptional, wrapAsNullable, value: value2, description, availability, namespace, groupName }) {
531750
+ let result = SchemaWithExample.literal({
531751
+ nameOverride,
531752
+ generatedName,
531753
+ title: title2,
531754
+ value: createLiteralSchemaValue(value2),
531755
+ description,
531756
+ availability,
531757
+ namespace,
531758
+ groupName
531759
+ });
531760
+ if (wrapAsNullable) {
531761
+ result = SchemaWithExample.nullable({
531762
+ nameOverride,
531763
+ generatedName,
531764
+ title: title2,
531765
+ value: result,
531766
+ description,
531767
+ availability,
531768
+ namespace,
531769
+ groupName,
531770
+ inline: void 0
531771
+ });
531772
+ }
531773
+ if (wrapAsOptional) {
531774
+ result = SchemaWithExample.optional({
531775
+ nameOverride,
531776
+ generatedName,
531777
+ title: title2,
531778
+ value: result,
531779
+ description,
531780
+ availability,
531781
+ namespace,
531782
+ groupName,
531783
+ inline: void 0
531784
+ });
531785
+ }
531786
+ return result;
531787
+ }
531788
+
531789
+ // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertNumber.js
531790
+ function convertNumber({ nameOverride, generatedName, title: title2, format: format3, _default: _default4, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, description, availability, wrapAsOptional, wrapAsNullable, example, namespace, groupName }) {
531791
+ if (format3 == null || format3 === "double") {
531792
+ return wrapPrimitive({
531793
+ nameOverride,
531794
+ generatedName,
531795
+ title: title2,
531796
+ primitive: PrimitiveSchemaValueWithExample.double({
531797
+ default: _default4,
531798
+ minimum,
531799
+ maximum,
531800
+ exclusiveMinimum,
531801
+ exclusiveMaximum,
531802
+ multipleOf,
531803
+ example
531804
+ }),
531805
+ wrapAsOptional,
531806
+ wrapAsNullable,
531807
+ description,
531808
+ availability,
531809
+ namespace,
531810
+ groupName
531811
+ });
531812
+ } else if (format3 === "float") {
531813
+ return wrapPrimitive({
531814
+ nameOverride,
531815
+ generatedName,
531816
+ title: title2,
531817
+ primitive: PrimitiveSchemaValueWithExample.float({
531818
+ example
531819
+ }),
531820
+ wrapAsOptional,
531821
+ wrapAsNullable,
531822
+ description,
531823
+ availability,
531824
+ namespace,
531825
+ groupName
531826
+ });
531827
+ } else if (format3 === "int32") {
531828
+ return wrapPrimitive({
531829
+ nameOverride,
531830
+ generatedName,
531831
+ title: title2,
531832
+ primitive: PrimitiveSchemaValueWithExample.int({
531833
+ default: _default4,
531834
+ minimum,
531835
+ maximum,
531836
+ exclusiveMinimum,
531837
+ exclusiveMaximum,
531838
+ multipleOf,
531839
+ example
531840
+ }),
531841
+ wrapAsOptional,
531842
+ wrapAsNullable,
531843
+ description,
531844
+ availability,
531845
+ namespace,
531846
+ groupName
531847
+ });
531848
+ } else if (format3 === "int64") {
531849
+ return wrapPrimitive({
531850
+ nameOverride,
531851
+ generatedName,
531852
+ title: title2,
531853
+ primitive: PrimitiveSchemaValueWithExample.int64({
531854
+ default: _default4,
531855
+ example
531856
+ }),
531857
+ wrapAsOptional,
531858
+ wrapAsNullable,
531859
+ description,
531860
+ availability,
531861
+ namespace,
531862
+ groupName
531863
+ });
531864
+ } else if (format3 === "uint32") {
531865
+ return wrapPrimitive({
531866
+ nameOverride,
531867
+ generatedName,
531868
+ title: title2,
531869
+ primitive: PrimitiveSchemaValueWithExample.uint({
531870
+ default: _default4,
531871
+ example
531872
+ }),
531873
+ wrapAsOptional,
531874
+ wrapAsNullable,
531875
+ description,
531876
+ availability,
531877
+ namespace,
531878
+ groupName
531879
+ });
531880
+ } else if (format3 === "uint64") {
531881
+ return wrapPrimitive({
531882
+ nameOverride,
531883
+ generatedName,
531884
+ title: title2,
531885
+ primitive: PrimitiveSchemaValueWithExample.uint64({
531886
+ default: _default4,
531887
+ example
531888
+ }),
531889
+ wrapAsOptional,
531890
+ wrapAsNullable,
531891
+ description,
531892
+ availability,
531893
+ namespace,
531894
+ groupName
531895
+ });
531896
+ } else if (format3 === "time-delta") {
531897
+ return wrapPrimitive({
531898
+ nameOverride,
531899
+ generatedName,
531900
+ title: title2,
531901
+ primitive: PrimitiveSchemaValueWithExample.float({
531902
+ example
531903
+ }),
531904
+ wrapAsOptional,
531905
+ wrapAsNullable,
531906
+ description,
531907
+ availability,
531908
+ namespace,
531909
+ groupName
531910
+ });
531911
+ }
531912
+ return wrapPrimitive({
531913
+ nameOverride,
531914
+ generatedName,
531915
+ title: title2,
531916
+ primitive: PrimitiveSchemaValueWithExample.float({
531917
+ example
531918
+ }),
531919
+ wrapAsOptional,
531920
+ wrapAsNullable,
531921
+ description,
531922
+ availability,
531923
+ namespace,
531924
+ groupName
531925
+ });
531926
+ }
531927
+
531872
531928
  // ../api-importers/openapi/openapi-ir-parser/lib/schema/convertUndiscriminatedOneOf.js
531873
531929
  init_lodash();
531874
531930
  function convertUndiscriminatedOneOf({ nameOverride, generatedName, title: title2, breadcrumbs, description, availability, wrapAsOptional, wrapAsNullable, context: context3, subtypes, namespace, groupName, encoding, source: source2, subtypeSuffixOverrides, properties: properties7, required: required6 }) {
@@ -541306,7 +541362,8 @@ var FIELD_MAPPINGS = {
541306
541362
  pathParameterOrder: "pathParameterOrder",
541307
541363
  resolveSchemaCollisions: "resolveSchemaCollisions",
541308
541364
  inferForwardCompatible: "inferForwardCompatible",
541309
- coerceConstsTo: "coerceConstsTo"
541365
+ coerceConstsTo: "coerceConstsTo",
541366
+ shouldInferDiscriminatedUnionBaseProperties: "shouldInferDiscriminatedUnionBaseProperties"
541310
541367
  };
541311
541368
  function setIfDefined2(target, key2, value2) {
541312
541369
  if (value2 !== void 0) {
@@ -550405,7 +550462,8 @@ var UNDEFINED_API_DEFINITION_SETTINGS = {
550405
550462
  defaultIntegerFormat: void 0,
550406
550463
  resolveSchemaCollisions: void 0,
550407
550464
  inferForwardCompatible: void 0,
550408
- coerceConstsTo: void 0
550465
+ coerceConstsTo: void 0,
550466
+ shouldInferDiscriminatedUnionBaseProperties: void 0
550409
550467
  };
550410
550468
  async function convertGeneratorsConfiguration({ absolutePathToGeneratorsConfiguration, rawGeneratorsConfiguration, context: context3 }) {
550411
550469
  const maybeTopLevelMetadata = getOutputMetadata(rawGeneratorsConfiguration.metadata);
@@ -550474,7 +550532,8 @@ function parseOpenApiDefinitionSettingsSchema(settings) {
550474
550532
  groupEnvironmentsByHost: settings?.["group-environments-by-host"],
550475
550533
  multiServerStrategy: settings?.["multi-server-strategy"],
550476
550534
  defaultIntegerFormat: settings?.["default-integer-format"],
550477
- pathParameterOrder: settings?.["path-parameter-order"]
550535
+ pathParameterOrder: settings?.["path-parameter-order"],
550536
+ shouldInferDiscriminatedUnionBaseProperties: settings?.["infer-discriminated-union-base-properties"]
550478
550537
  };
550479
550538
  }
550480
550539
  function parseAsyncApiDefinitionSettingsSchema(settings) {
@@ -614314,7 +614373,14 @@ var OpenApiSettingsSchema2 = BaseApiSettingsSchema2.extend({
614314
614373
  * The default format to use for integer types when no format is specified in the OpenAPI schema.
614315
614374
  * Defaults to int32.
614316
614375
  */
614317
- defaultIntegerFormat: DefaultIntegerFormatSchema.optional()
614376
+ defaultIntegerFormat: DefaultIntegerFormatSchema.optional(),
614377
+ /**
614378
+ * If true, properties shared by every variant of a discriminated `oneOf`
614379
+ * (including via `allOf`/`$ref`) are lifted into the union's base properties
614380
+ * so SDKs can expose them directly on the union type without casting.
614381
+ * Defaults to false.
614382
+ */
614383
+ inferDiscriminatedUnionBaseProperties: external_exports.boolean().optional()
614318
614384
  });
614319
614385
 
614320
614386
  // ../config/lib/schemas/specs/OpenApiSpecSchema.js
@@ -621199,7 +621265,7 @@ var AccessTokenPosthogManager = class {
621199
621265
  properties: {
621200
621266
  ...event,
621201
621267
  ...event.properties,
621202
- version: "4.106.2",
621268
+ version: "4.106.3-6-ga791f2f555d",
621203
621269
  usingAccessToken: true
621204
621270
  }
621205
621271
  });
@@ -621253,7 +621319,7 @@ var UserPosthogManager = class {
621253
621319
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
621254
621320
  event: "CLI",
621255
621321
  properties: {
621256
- version: "4.106.2",
621322
+ version: "4.106.3-6-ga791f2f555d",
621257
621323
  ...event,
621258
621324
  ...event.properties,
621259
621325
  usingAccessToken: false,
@@ -626588,7 +626654,8 @@ var LegacyApiSpecAdapter = class {
626588
626654
  resolveAliases: settings.resolveAliases,
626589
626655
  groupMultiApiEnvironments: settings.groupMultiApiEnvironments,
626590
626656
  defaultIntegerFormat: this.adaptDefaultIntegerFormat(settings.defaultIntegerFormat),
626591
- coerceConstsTo: settings.coerceConstsTo
626657
+ coerceConstsTo: settings.coerceConstsTo,
626658
+ shouldInferDiscriminatedUnionBaseProperties: settings.inferDiscriminatedUnionBaseProperties
626592
626659
  };
626593
626660
  const hasSettings = Object.values(result).some((v9) => v9 != null);
626594
626661
  return hasSettings ? result : void 0;
@@ -829481,6 +829548,7 @@ var SETTINGS_KEY_MAP = {
829481
829548
  "resolve-aliases": "resolveAliases",
829482
829549
  "group-multi-api-environments": "groupMultiApiEnvironments",
829483
829550
  "default-integer-format": "defaultIntegerFormat",
829551
+ "infer-discriminated-union-base-properties": "inferDiscriminatedUnionBaseProperties",
829484
829552
  // AsyncAPI-specific settings
829485
829553
  "message-naming": "messageNaming"
829486
829554
  };
@@ -832894,7 +832962,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
832894
832962
  var LOGS_FOLDER_NAME = "logs";
832895
832963
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
832896
832964
  function getCliSource() {
832897
- const version7 = "4.106.2";
832965
+ const version7 = "4.106.3-6-ga791f2f555d";
832898
832966
  return `cli@${version7}`;
832899
832967
  }
832900
832968
  var DebugLogger = class {
@@ -845303,7 +845371,7 @@ var LegacyDocsPublisher = class {
845303
845371
  previewId,
845304
845372
  disableTemplates: void 0,
845305
845373
  skipUpload,
845306
- cliVersion: "4.106.2",
845374
+ cliVersion: "4.106.3-6-ga791f2f555d",
845307
845375
  loginCommand: "fern auth login"
845308
845376
  });
845309
845377
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -919404,7 +919472,7 @@ var CliContext = class _CliContext {
919404
919472
  if (false) {
919405
919473
  this.logger.error("CLI_VERSION is not defined");
919406
919474
  }
919407
- return "4.106.2";
919475
+ return "4.106.3-6-ga791f2f555d";
919408
919476
  }
919409
919477
  getCliName() {
919410
919478
  if (false) {
@@ -941793,6 +941861,7 @@ function addReplayInitCommand(cli, cliContext) {
941793
941861
  repo,
941794
941862
  lockfileContents: result.lockfileContent,
941795
941863
  fernignoreEntries: result.fernignoreEntries,
941864
+ gitattributesEntries: result.gitattributesEntries,
941796
941865
  prBody: result.prBody
941797
941866
  })
941798
941867
  });
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.106.2",
2
+ "version": "4.106.3-6-ga791f2f555d",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",