@fern-api/fern-api-dev 3.47.4 → 3.47.6

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 +49 -9
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1429260,7 +1429260,7 @@ var AccessTokenPosthogManager = class {
1429260
1429260
  properties: {
1429261
1429261
  ...event,
1429262
1429262
  ...event.properties,
1429263
- version: "3.47.4",
1429263
+ version: "3.47.6",
1429264
1429264
  usingAccessToken: true
1429265
1429265
  }
1429266
1429266
  });
@@ -1429359,7 +1429359,7 @@ var UserPosthogManager = class {
1429359
1429359
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
1429360
1429360
  event: "CLI",
1429361
1429361
  properties: {
1429362
- version: "3.47.4",
1429362
+ version: "3.47.6",
1429363
1429363
  ...event,
1429364
1429364
  ...event.properties,
1429365
1429365
  usingAccessToken: false,
@@ -1499014,7 +1499014,7 @@ var AbstractConverterContext = class _AbstractConverterContext {
1499014
1499014
  prefix: defaultExampleName ?? `${breadcrumbs.join("_")}_example`,
1499015
1499015
  existingNames: []
1499016
1499016
  });
1499017
- examples.push([exampleName, mediaTypeObject.example]);
1499017
+ examples.push([exampleName, { value: mediaTypeObject.example }]);
1499018
1499018
  }
1499019
1499019
  if (mediaTypeObject.examples != null) {
1499020
1499020
  examples.push(...Object.entries(mediaTypeObject.examples));
@@ -1499035,6 +1499035,38 @@ var AbstractConverterContext = class _AbstractConverterContext {
1499035
1499035
  }
1499036
1499036
  return schemaOrReference;
1499037
1499037
  }
1499038
+ /**
1499039
+ * Resolves an example reference recursively until we get a non-reference object.
1499040
+ * This handles cases where an example in components/examples itself references another example.
1499041
+ * @param example The example object or reference to resolve
1499042
+ * @param breadcrumbs Path for error reporting
1499043
+ * @param maxDepth Maximum recursion depth to prevent infinite loops (default: 10)
1499044
+ * @returns The resolved example object, or undefined if resolution fails
1499045
+ */
1499046
+ resolveExampleRecursively({ example, breadcrumbs, maxDepth = 10 }) {
1499047
+ let current3 = example;
1499048
+ let depth = 0;
1499049
+ while (this.isReferenceObject(current3)) {
1499050
+ if (depth >= maxDepth) {
1499051
+ this.errorCollector.collect({
1499052
+ message: `Maximum reference depth (${maxDepth}) exceeded while resolving example reference`,
1499053
+ path: breadcrumbs
1499054
+ });
1499055
+ return void 0;
1499056
+ }
1499057
+ const resolved = this.resolveReference({
1499058
+ reference: current3,
1499059
+ breadcrumbs,
1499060
+ skipErrorCollector: true
1499061
+ });
1499062
+ if (!resolved.resolved) {
1499063
+ return void 0;
1499064
+ }
1499065
+ current3 = resolved.value;
1499066
+ depth++;
1499067
+ }
1499068
+ return current3;
1499069
+ }
1499038
1499070
  resolveExample(example) {
1499039
1499071
  if (!this.isReferenceObject(example)) {
1499040
1499072
  return example;
@@ -1499204,7 +1499236,7 @@ var AbstractConverterContext = class _AbstractConverterContext {
1499204
1499236
  return this.isReferenceObject(value) && ("title" in value || "name" in value || "messageId" in value || "summary" in value);
1499205
1499237
  }
1499206
1499238
  isExampleWithSummary(example) {
1499207
- return typeof example === "object" && example != null && "summary" in example;
1499239
+ return typeof example === "object" && example != null && "summary" in example && typeof example.summary === "string" && example.summary.length > 0;
1499208
1499240
  }
1499209
1499241
  isExampleWithValue(example) {
1499210
1499242
  return typeof example === "object" && example != null && "value" in example;
@@ -1502702,7 +1502734,11 @@ var AbstractMediaTypeObjectConverter = class extends AbstractConverter {
1502702
1502734
  });
1502703
1502735
  for (const [key, example] of examples) {
1502704
1502736
  const resolvedExample = this.context.resolveExampleWithValue(example);
1502705
- const exampleName = this.context.isExampleWithSummary(example) ? example.summary : key;
1502737
+ const resolvedExampleObject = this.context.resolveExampleRecursively({
1502738
+ example,
1502739
+ breadcrumbs: this.breadcrumbs
1502740
+ });
1502741
+ const exampleName = this.context.isExampleWithSummary(resolvedExampleObject) ? resolvedExampleObject.summary : key;
1502706
1502742
  if (resolvedExample != null) {
1502707
1502743
  if (schema2 != null) {
1502708
1502744
  v2Examples.userSpecifiedExamples[exampleName] = this.generateOrValidateExample({
@@ -1508732,7 +1508768,7 @@ var CliContext = class {
1508732
1508768
  if (false) {
1508733
1508769
  this.logger.error("CLI_VERSION is not defined");
1508734
1508770
  }
1508735
- return "3.47.4";
1508771
+ return "3.47.6";
1508736
1508772
  }
1508737
1508773
  getCliName() {
1508738
1508774
  if (false) {
@@ -1532278,9 +1532314,11 @@ function parseAsyncAPIV2({ context: context2, breadcrumbs, source: source2, asyn
1532278
1532314
  for (const [name3, schema2] of Object.entries(channel.bindings.ws.headers.properties ?? {})) {
1532279
1532315
  if (isReferenceObject(schema2)) {
1532280
1532316
  const resolvedSchema = context2.resolveSchemaReference(schema2);
1532317
+ const isRequired3 = required6.includes(name3);
1532318
+ const [isOptional2, isNullable2] = context2.options.coerceOptionalSchemasToNullable ? [false, !isRequired3] : [!isRequired3, false];
1532281
1532319
  headers2.push({
1532282
1532320
  name: name3,
1532283
- schema: convertReferenceObject(schema2, false, false, context2, breadcrumbs, void 0, source2, context2.namespace),
1532321
+ schema: convertReferenceObject(schema2, isOptional2, isNullable2, context2, breadcrumbs, void 0, source2, context2.namespace),
1532284
1532322
  description: resolvedSchema.description,
1532285
1532323
  parameterNameOverride: void 0,
1532286
1532324
  env: void 0,
@@ -1532307,9 +1532345,11 @@ function parseAsyncAPIV2({ context: context2, breadcrumbs, source: source2, asyn
1532307
1532345
  for (const [name3, schema2] of Object.entries(channel.bindings.ws.query.properties ?? {})) {
1532308
1532346
  if (isReferenceObject(schema2)) {
1532309
1532347
  const resolvedSchema = context2.resolveSchemaReference(schema2);
1532348
+ const isRequired3 = required6.includes(name3);
1532349
+ const [isOptional2, isNullable2] = context2.options.coerceOptionalSchemasToNullable ? [false, !isRequired3] : [!isRequired3, false];
1532310
1532350
  queryParameters.push({
1532311
1532351
  name: name3,
1532312
- schema: convertReferenceObject(schema2, false, false, context2, breadcrumbs, void 0, source2, context2.namespace),
1532352
+ schema: convertReferenceObject(schema2, isOptional2, isNullable2, context2, breadcrumbs, void 0, source2, context2.namespace),
1532313
1532353
  description: resolvedSchema.description,
1532314
1532354
  parameterNameOverride: void 0,
1532315
1532355
  availability: convertAvailability3(resolvedSchema),
@@ -1609884,7 +1609924,7 @@ var import_path40 = __toESM(require("path"), 1);
1609884
1609924
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
1609885
1609925
  var LOGS_FOLDER_NAME = "logs";
1609886
1609926
  function getCliSource() {
1609887
- const version7 = "3.47.4";
1609927
+ const version7 = "3.47.6";
1609888
1609928
  return `cli@${version7}`;
1609889
1609929
  }
1609890
1609930
  var DebugLogger = class {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.47.4",
2
+ "version": "3.47.6",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",