fern-api 0.33.4 → 0.33.6-rc0

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/bundle.cjs +72 -29
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -24404,7 +24404,8 @@ var init_ExperimentalConfig = __esm({
24404
24404
  "pnp:/home/runner/work/fern/fern/packages/cli/configuration/lib/docs-yml/schemas/sdk/serialization/resources/docs/types/ExperimentalConfig.js"() {
24405
24405
  init_core();
24406
24406
  ExperimentalConfig = schemas_exports.object({
24407
- mdxComponents: schemas_exports.property("mdx-components", schemas_exports.list(schemas_exports.string()).optional())
24407
+ mdxComponents: schemas_exports.property("mdx-components", schemas_exports.list(schemas_exports.string()).optional()),
24408
+ disableStreamToggle: schemas_exports.property("disable-stream-toggle", schemas_exports.boolean().optional())
24408
24409
  });
24409
24410
  }
24410
24411
  });
@@ -1164535,7 +1164536,7 @@ var AccessTokenPosthogManager = class {
1164535
1164536
  properties: {
1164536
1164537
  ...event,
1164537
1164538
  ...event.properties,
1164538
- version: "0.33.4",
1164539
+ version: "0.33.6-rc0",
1164539
1164540
  usingAccessToken: true
1164540
1164541
  }
1164541
1164542
  });
@@ -1164597,7 +1164598,7 @@ var UserPosthogManager = class {
1164597
1164598
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1164598
1164599
  event: "CLI",
1164599
1164600
  properties: {
1164600
- version: "0.33.4",
1164601
+ version: "0.33.6-rc0",
1164601
1164602
  ...event,
1164602
1164603
  ...event.properties
1164603
1164604
  }
@@ -1178828,7 +1178829,7 @@ function buildBooleanTypeReference({ description, schema: schema2 }) {
1178828
1178829
  return result2;
1178829
1178830
  }
1178830
1178831
  function buildLongTypeReference({ description, schema: schema2 }) {
1178831
- const type2 = "int64";
1178832
+ const type2 = "long";
1178832
1178833
  if (description == null && schema2.default == null) {
1178833
1178834
  return type2;
1178834
1178835
  }
@@ -1181421,34 +1181422,54 @@ function getDefaultAsString(schema2) {
1181421
1181422
  }
1181422
1181423
 
1181423
1181424
  // pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/schema/examples/getExample.js
1181424
- function getExampleAsNumber(schema2) {
1181425
+ function getExampleAsNumber({ schema: schema2, logger, fallback: fallback2 }) {
1181425
1181426
  if (schema2.example != null && typeof schema2.example === "number") {
1181426
1181427
  return schema2.example;
1181427
1181428
  }
1181429
+ if (fallback2 && typeof fallback2 === "number") {
1181430
+ return fallback2;
1181431
+ } else if (fallback2) {
1181432
+ logger.warn(`Expected fallback to be a number, but got ${typeof fallback2}`);
1181433
+ }
1181428
1181434
  return void 0;
1181429
1181435
  }
1181430
- function getExampleAsBoolean(schema2) {
1181436
+ function getExampleAsBoolean({ schema: schema2, logger, fallback: fallback2 }) {
1181431
1181437
  if (schema2.example != null && typeof schema2.example === "boolean") {
1181432
1181438
  return schema2.example;
1181433
1181439
  }
1181440
+ if (fallback2 && typeof fallback2 === "boolean") {
1181441
+ return fallback2;
1181442
+ } else if (fallback2) {
1181443
+ logger.warn(`Expected fallback to be a boolean, but got ${typeof fallback2}`);
1181444
+ }
1181434
1181445
  return void 0;
1181435
1181446
  }
1181436
- function getExamplesString(schema2) {
1181447
+ function getExamplesString({ schema: schema2, logger, fallback: fallback2 }) {
1181437
1181448
  if (schema2.example != null && typeof schema2.example === "string") {
1181438
1181449
  return schema2.example;
1181439
1181450
  }
1181451
+ if (fallback2 && typeof fallback2 === "string") {
1181452
+ return fallback2;
1181453
+ } else if (fallback2) {
1181454
+ logger.warn(`Expected fallback to be a string, but got ${typeof fallback2}`);
1181455
+ }
1181440
1181456
  return void 0;
1181441
1181457
  }
1181442
- function getExampleAsArray(schema2) {
1181458
+ function getExampleAsArray({ schema: schema2, logger, fallback: fallback2 }) {
1181443
1181459
  if (schema2.example != null && Array.isArray(schema2.example)) {
1181444
1181460
  return schema2.example;
1181445
1181461
  }
1181462
+ if (fallback2 && Array.isArray(fallback2)) {
1181463
+ return fallback2;
1181464
+ } else if (fallback2) {
1181465
+ logger.warn(`Expected fallback to be a array, but got ${typeof fallback2}`);
1181466
+ }
1181446
1181467
  return void 0;
1181447
1181468
  }
1181448
1181469
 
1181449
1181470
  // pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/schema/convertSchemas.js
1181450
1181471
  var SCHEMA_REFERENCE_PREFIX = "#/components/schemas/";
1181451
- function convertSchema(schema2, wrapAsNullable, context, breadcrumbs, referencedAsRequest = false, propertiesToExclude = /* @__PURE__ */ new Set()) {
1181472
+ function convertSchema(schema2, wrapAsNullable, context, breadcrumbs, referencedAsRequest = false, propertiesToExclude = /* @__PURE__ */ new Set(), fallback2) {
1181452
1181473
  if (isReferenceObject(schema2)) {
1181453
1181474
  const schemaId = getSchemaIdFromReference(schema2);
1181454
1181475
  if (schemaId != null) {
@@ -1181459,9 +1181480,9 @@ function convertSchema(schema2, wrapAsNullable, context, breadcrumbs, referenced
1181459
1181480
  }
1181460
1181481
  return convertReferenceObject(schema2, wrapAsNullable, context, breadcrumbs);
1181461
1181482
  }
1181462
- return convertSchemaObject(context.resolveSchemaReference(schema2), wrapAsNullable, context, getBreadcrumbsFromReference(schema2.$ref), propertiesToExclude, referencedAsRequest);
1181483
+ return convertSchemaObject(context.resolveSchemaReference(schema2), wrapAsNullable, context, getBreadcrumbsFromReference(schema2.$ref), propertiesToExclude, referencedAsRequest, fallback2);
1181463
1181484
  } else {
1181464
- return convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest);
1181485
+ return convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2);
1181465
1181486
  }
1181466
1181487
  }
1181467
1181488
  function convertReferenceObject(schema2, wrapAsNullable, context, breadcrumbs) {
@@ -1181491,7 +1181512,7 @@ function getTitleAsName(title2) {
1181491
1181512
  }
1181492
1181513
  return title2;
1181493
1181514
  }
1181494
- function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude = /* @__PURE__ */ new Set(), referencedAsRequest = false) {
1181515
+ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude = /* @__PURE__ */ new Set(), referencedAsRequest = false, fallback2) {
1181495
1181516
  var _a5;
1181496
1181517
  const nameOverride = getExtension(schema2, FernOpenAPIExtension.TYPE_NAME) ?? (context.options.useTitlesAsName ? getTitleAsName(schema2.title) : void 0);
1181497
1181518
  const mixedGroupName = getExtension(schema2, FernOpenAPIExtension.SDK_GROUP_NAME) ?? ((_a5 = getExtension(schema2, OpenAPIExtension.TAGS)) == null ? void 0 : _a5[0]);
@@ -1181514,7 +1181535,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181514
1181535
  return fernSchema;
1181515
1181536
  }
1181516
1181537
  if (!wrapAsNullable && schema2.nullable === true) {
1181517
- return convertSchemaObject(schema2, true, context, breadcrumbs);
1181538
+ return convertSchemaObject(schema2, true, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2);
1181518
1181539
  }
1181519
1181540
  if (schema2.enum != null && (schema2.type === "string" || schema2.type == null)) {
1181520
1181541
  if (!isListOfStrings(schema2.enum)) {
@@ -1181527,7 +1181548,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181527
1181548
  maxLength: schema2.maxLength,
1181528
1181549
  pattern: schema2.pattern,
1181529
1181550
  format: schema2.format,
1181530
- example: getExamplesString(schema2)
1181551
+ example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
1181531
1181552
  }),
1181532
1181553
  groupName,
1181533
1181554
  wrapAsNullable,
@@ -1181570,7 +1181591,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181570
1181591
  value: convertSchemaObject({
1181571
1181592
  ...schema2,
1181572
1181593
  type: secondElement
1181573
- }, wrapAsNullable, context, breadcrumbs, propertiesToExclude),
1181594
+ }, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2),
1181574
1181595
  groupName,
1181575
1181596
  description: schema2.description,
1181576
1181597
  availability
@@ -1181582,7 +1181603,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181582
1181603
  value: convertSchemaObject({
1181583
1181604
  ...schema2,
1181584
1181605
  type: firstElement
1181585
- }, wrapAsNullable, context, breadcrumbs, propertiesToExclude),
1181606
+ }, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2),
1181586
1181607
  groupName,
1181587
1181608
  description: schema2.description,
1181588
1181609
  availability
@@ -1181627,7 +1181648,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181627
1181648
  generatedName,
1181628
1181649
  primitive: PrimitiveSchemaValueWithExample.boolean({
1181629
1181650
  default: schema2.default,
1181630
- example: getExampleAsBoolean(schema2)
1181651
+ example: getExampleAsBoolean({ schema: schema2, logger: context.logger, fallback: fallback2 })
1181631
1181652
  }),
1181632
1181653
  wrapAsNullable,
1181633
1181654
  description,
@@ -1181649,7 +1181670,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181649
1181670
  description,
1181650
1181671
  availability,
1181651
1181672
  wrapAsNullable,
1181652
- example: getExampleAsNumber(schema2),
1181673
+ example: getExampleAsNumber({ schema: schema2, logger: context.logger, fallback: fallback2 }),
1181653
1181674
  groupName
1181654
1181675
  });
1181655
1181676
  }
@@ -1181664,7 +1181685,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181664
1181685
  exclusiveMinimum: getValueIfBoolean(schema2.exclusiveMinimum),
1181665
1181686
  exclusiveMaximum: getValueIfBoolean(schema2.exclusiveMaximum),
1181666
1181687
  multipleOf: schema2.multipleOf,
1181667
- example: getExampleAsNumber(schema2)
1181688
+ example: getExampleAsNumber({ schema: schema2, logger: context.logger, fallback: fallback2 })
1181668
1181689
  }),
1181669
1181690
  wrapAsNullable,
1181670
1181691
  description,
@@ -1181686,7 +1181707,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181686
1181707
  description,
1181687
1181708
  availability,
1181688
1181709
  wrapAsNullable,
1181689
- example: getExampleAsNumber(schema2),
1181710
+ example: getExampleAsNumber({ schema: schema2, logger: context.logger, fallback: fallback2 }),
1181690
1181711
  groupName
1181691
1181712
  });
1181692
1181713
  }
@@ -1181696,7 +1181717,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181696
1181717
  nameOverride,
1181697
1181718
  generatedName,
1181698
1181719
  primitive: PrimitiveSchemaValueWithExample.datetime({
1181699
- example: getExamplesString(schema2)
1181720
+ example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
1181700
1181721
  }),
1181701
1181722
  wrapAsNullable,
1181702
1181723
  description,
@@ -1181734,7 +1181755,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181734
1181755
  format: schema2.format,
1181735
1181756
  minLength: schema2.minLength,
1181736
1181757
  maxLength: schema2.maxLength,
1181737
- example: getExamplesString(schema2)
1181758
+ example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
1181738
1181759
  }),
1181739
1181760
  groupName,
1181740
1181761
  wrapAsNullable,
@@ -1181753,7 +1181774,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1181753
1181774
  wrapAsNullable,
1181754
1181775
  context,
1181755
1181776
  groupName,
1181756
- example: getExampleAsArray(schema2)
1181777
+ example: getExampleAsArray({ schema: schema2, logger: context.logger, fallback: fallback2 })
1181757
1181778
  });
1181758
1181779
  }
1181759
1181780
  if (schema2.additionalProperties != null && schema2.additionalProperties !== false && hasNoProperties(schema2)) {
@@ -1182001,7 +1182022,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
1182001
1182022
  format: schema2.format,
1182002
1182023
  minLength: schema2.minLength,
1182003
1182024
  maxLength: schema2.maxLength,
1182004
- example: getExamplesString(schema2)
1182025
+ example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
1182005
1182026
  }),
1182006
1182027
  groupName
1182007
1182028
  },
@@ -1184686,6 +1184707,7 @@ function getVariableReference(parameter) {
1184686
1184707
 
1184687
1184708
  // pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/openapi/v3/converters/endpoint/convertParameters.js
1184688
1184709
  function convertParameters({ path: path44, httpMethod, parameters, context, requestBreadcrumbs }) {
1184710
+ var _a5;
1184689
1184711
  const convertedParameters = {
1184690
1184712
  pathParameters: [],
1184691
1184713
  queryParameters: [],
@@ -1184697,7 +1184719,13 @@ function convertParameters({ path: path44, httpMethod, parameters, context, requ
1184697
1184719
  const availability = convertAvailability3(resolvedParameter);
1184698
1184720
  const parameterBreadcrumbs = [...requestBreadcrumbs, resolvedParameter.name];
1184699
1184721
  const generatedName = getGeneratedTypeName(parameterBreadcrumbs);
1184700
- let schema2 = resolvedParameter.schema != null ? convertSchema(resolvedParameter.schema, !isRequired, context, parameterBreadcrumbs) : isRequired ? SchemaWithExample.primitive({
1184722
+ if ((_a5 = getExamplesString({ schema: resolvedParameter, logger: context.logger })) == null ? void 0 : _a5.includes(" ")) {
1184723
+ context.logger.warn("Parameter example contains a space, which is ambiguous. Consider using enums for multiple examples, or use an encoding if a space is part of the parameter.");
1184724
+ }
1184725
+ let schema2 = resolvedParameter.schema != null ? convertSchema(resolvedParameter.schema, !isRequired, context, parameterBreadcrumbs, false, /* @__PURE__ */ new Set(), getExamplesString({
1184726
+ schema: resolvedParameter,
1184727
+ logger: context.logger
1184728
+ })) : isRequired ? SchemaWithExample.primitive({
1184701
1184729
  nameOverride: void 0,
1184702
1184730
  generatedName,
1184703
1184731
  schema: PrimitiveSchemaValueWithExample.string({
@@ -1184706,7 +1184734,10 @@ function convertParameters({ path: path44, httpMethod, parameters, context, requ
1184706
1184734
  format: void 0,
1184707
1184735
  minLength: void 0,
1184708
1184736
  maxLength: void 0,
1184709
- example: getExamplesString(resolvedParameter.example)
1184737
+ example: getExamplesString({
1184738
+ schema: resolvedParameter,
1184739
+ logger: context.logger
1184740
+ })
1184710
1184741
  }),
1184711
1184742
  description: void 0,
1184712
1184743
  availability,
@@ -1184723,7 +1184754,10 @@ function convertParameters({ path: path44, httpMethod, parameters, context, requ
1184723
1184754
  format: void 0,
1184724
1184755
  minLength: void 0,
1184725
1184756
  maxLength: void 0,
1184726
- example: getExamplesString(resolvedParameter.example)
1184757
+ example: getExamplesString({
1184758
+ schema: resolvedParameter,
1184759
+ logger: context.logger
1184760
+ })
1184727
1184761
  }),
1184728
1184762
  description: void 0,
1184729
1184763
  availability: void 0,
@@ -1187320,6 +1187354,9 @@ function convertPrimitive2(primitiveExample) {
1187320
1187354
  }
1187321
1187355
  case "datetime":
1187322
1187356
  try {
1187357
+ if (!primitiveExample.value.endsWith("Z") && !primitiveExample.value.includes("+")) {
1187358
+ primitiveExample.value += "Z";
1187359
+ }
1187323
1187360
  return new Date(primitiveExample.value).toISOString().replace(/\.\d{3}Z$/, "Z");
1187324
1187361
  } catch (e) {
1187325
1187362
  return "2024-01-15T09:30:00Z";
@@ -1192599,10 +1192636,10 @@ var CliContext = class {
1192599
1192636
  return "fern-api";
1192600
1192637
  }
1192601
1192638
  getPackageVersion() {
1192602
- if ("0.33.4" == null) {
1192639
+ if ("0.33.6-rc0" == null) {
1192603
1192640
  this.logger.error("CLI_VERSION is not defined");
1192604
1192641
  }
1192605
- return "0.33.4";
1192642
+ return "0.33.6-rc0";
1192606
1192643
  }
1192607
1192644
  getCliName() {
1192608
1192645
  if ("fern" == null) {
@@ -1200719,11 +1200756,14 @@ var ApiReferenceNodeConverter = class {
1200719
1200756
  __privateAdd(this, _children, []);
1200720
1200757
  __privateAdd(this, _overviewPageId, void 0);
1200721
1200758
  __privateAdd(this, _slug, void 0);
1200759
+ __publicField(this, "disableEndpointPairs");
1200760
+ var _a5;
1200722
1200761
  this.apiSection = apiSection;
1200723
1200762
  this.workspace = workspace;
1200724
1200763
  this.docsWorkspace = docsWorkspace;
1200725
1200764
  this.taskContext = taskContext;
1200726
1200765
  this.markdownFilesToFullSlugs = markdownFilesToFullSlugs;
1200766
+ this.disableEndpointPairs = ((_a5 = docsWorkspace.config.experimental) == null ? void 0 : _a5.disableStreamToggle) ?? false;
1200727
1200767
  this.apiDefinitionId = navigation_exports2.ApiDefinitionId(api.id);
1200728
1200768
  __privateSet(this, _holder2, ApiDefinitionHolder2.create(api, taskContext));
1200729
1200769
  const idgen = NodeIdGenerator2.init(this.apiDefinitionId);
@@ -1200764,6 +1200804,9 @@ var ApiReferenceNodeConverter = class {
1200764
1200804
  };
1200765
1200805
  }
1200766
1200806
  mergeEndpointPairs(children2) {
1200807
+ if (this.disableEndpointPairs) {
1200808
+ return children2;
1200809
+ }
1200767
1200810
  const toRet = [];
1200768
1200811
  const methodAndPathToEndpointNode = /* @__PURE__ */ new Map();
1200769
1200812
  children2.forEach((child) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.33.4",
3
+ "version": "0.33.6-rc0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",