fern-api 0.19.0-rc1 → 0.19.0-rc2

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 +29 -14
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -799111,7 +799111,7 @@ var AccessTokenPosthogManager = class {
799111
799111
  properties: {
799112
799112
  ...event,
799113
799113
  ...event.properties,
799114
- version: "0.19.0-rc1",
799114
+ version: "0.19.0-rc2",
799115
799115
  usingAccessToken: true
799116
799116
  }
799117
799117
  });
@@ -799173,7 +799173,7 @@ var UserPosthogManager = class {
799173
799173
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
799174
799174
  event: "CLI",
799175
799175
  properties: {
799176
- version: "0.19.0-rc1",
799176
+ version: "0.19.0-rc2",
799177
799177
  ...event,
799178
799178
  ...event.properties
799179
799179
  }
@@ -814027,7 +814027,13 @@ var ExampleTypeFactory = class {
814027
814027
  this.schemas = schemas;
814028
814028
  }
814029
814029
  buildExample({ schema: schema2, example, options }) {
814030
- return this.buildExampleHelper({ schema: schema2, visitedSchemaIds: /* @__PURE__ */ new Set(), example, options, depth: 0 });
814030
+ return this.buildExampleHelper({
814031
+ schema: schema2,
814032
+ visitedSchemaIds: /* @__PURE__ */ new Set(),
814033
+ example,
814034
+ options: { ...options, maxCheckerDepth: options.maxCheckerDepth ?? 5 },
814035
+ depth: 0
814036
+ });
814031
814037
  }
814032
814038
  buildExampleHelper({ example, schema: schema2, depth, visitedSchemaIds, options }) {
814033
814039
  var _a2, _b2;
@@ -814040,7 +814046,7 @@ var ExampleTypeFactory = class {
814040
814046
  case "literal":
814041
814047
  return FullExample.literal(schema2.value);
814042
814048
  case "nullable": {
814043
- if (example == null && !this.hasExample(schema2.value) && (options.ignoreOptionals || this.exceedsMaxDepth(depth, options))) {
814049
+ if (example == null && !this.hasExample(schema2.value, 0, visitedSchemaIds, options) && (options.ignoreOptionals || this.exceedsMaxDepth(depth, options))) {
814044
814050
  return void 0;
814045
814051
  }
814046
814052
  const result2 = this.buildExampleHelper({
@@ -814062,7 +814068,7 @@ var ExampleTypeFactory = class {
814062
814068
  return result2;
814063
814069
  }
814064
814070
  case "optional": {
814065
- if (example == null && !this.hasExample(schema2.value) && (options.ignoreOptionals || this.exceedsMaxDepth(depth, options))) {
814071
+ if (example == null && !this.hasExample(schema2.value, 0, visitedSchemaIds, options) && (options.ignoreOptionals || this.exceedsMaxDepth(depth, options))) {
814066
814072
  return void 0;
814067
814073
  }
814068
814074
  const result2 = this.buildExampleHelper({
@@ -814317,23 +814323,26 @@ var ExampleTypeFactory = class {
814317
814323
  assertNever(schema2);
814318
814324
  }
814319
814325
  }
814320
- hasExample(schema2) {
814326
+ hasExample(schema2, depth, visitedSchemaIds = /* @__PURE__ */ new Set(), options) {
814327
+ if (this.exceedsMaxCheckerDepth(depth, options)) {
814328
+ return false;
814329
+ }
814321
814330
  switch (schema2.type) {
814322
814331
  case "array":
814323
- return this.hasExample(schema2.value);
814332
+ return this.hasExample(schema2.value, depth + 1, visitedSchemaIds, options);
814324
814333
  case "enum":
814325
814334
  return schema2.example != null;
814326
814335
  case "literal":
814327
814336
  return false;
814328
814337
  case "map":
814329
- return schema2.key.schema.example != null && this.hasExample(schema2.value);
814338
+ return schema2.key.schema.example != null && this.hasExample(schema2.value, depth + 1, visitedSchemaIds, options);
814330
814339
  case "object": {
814331
814340
  const objectExample = schema2.fullExamples != null && schema2.fullExamples.length > 0;
814332
814341
  if (objectExample) {
814333
814342
  return true;
814334
814343
  }
814335
814344
  for (const property5 of schema2.properties) {
814336
- if (this.hasExample(property5.schema)) {
814345
+ if (this.hasExample(property5.schema, depth + 1, visitedSchemaIds, options)) {
814337
814346
  return true;
814338
814347
  }
814339
814348
  }
@@ -814343,19 +814352,25 @@ var ExampleTypeFactory = class {
814343
814352
  return schema2.schema.example != null;
814344
814353
  case "reference": {
814345
814354
  const resolvedSchema = this.schemas[schema2.schema];
814346
- if (resolvedSchema != null) {
814347
- return this.hasExample(resolvedSchema);
814355
+ if (resolvedSchema != null && !visitedSchemaIds.has(schema2.schema)) {
814356
+ visitedSchemaIds.add(schema2.schema);
814357
+ const hasExample = this.hasExample(resolvedSchema, depth, visitedSchemaIds, options);
814358
+ visitedSchemaIds.delete(schema2.schema);
814359
+ return hasExample;
814348
814360
  }
814349
814361
  return false;
814350
814362
  }
814351
814363
  case "unknown":
814352
814364
  return schema2.example != null;
814353
814365
  case "oneOf":
814354
- return Object.values(schema2.value.schemas).some((schema3) => this.hasExample(schema3));
814366
+ return Object.values(schema2.value.schemas).some((schema3) => this.hasExample(schema3, depth, visitedSchemaIds, options));
814355
814367
  default:
814356
814368
  return false;
814357
814369
  }
814358
814370
  }
814371
+ exceedsMaxCheckerDepth(depth, options) {
814372
+ return depth > (options.maxCheckerDepth ?? 0);
814373
+ }
814359
814374
  exceedsMaxDepth(depth, options) {
814360
814375
  return depth > (options.maxDepth ?? 0);
814361
814376
  }
@@ -825852,10 +825867,10 @@ var CliContext = class {
825852
825867
  return "fern-api";
825853
825868
  }
825854
825869
  getPackageVersion() {
825855
- if ("0.19.0-rc1" == null) {
825870
+ if ("0.19.0-rc2" == null) {
825856
825871
  this.logger.error("CLI_VERSION is not defined");
825857
825872
  }
825858
- return "0.19.0-rc1";
825873
+ return "0.19.0-rc2";
825859
825874
  }
825860
825875
  getCliName() {
825861
825876
  if ("fern" == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.19.0-rc1",
3
+ "version": "0.19.0-rc2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",