fern-api 0.16.34 → 0.16.35

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 +93 -7
  2. package/package.json +1 -1
package/bundle.cjs CHANGED
@@ -737050,7 +737050,7 @@ var AccessTokenPosthogManager = class {
737050
737050
  properties: {
737051
737051
  ...event,
737052
737052
  ...event.properties,
737053
- version: "0.16.34",
737053
+ version: "0.16.35",
737054
737054
  usingAccessToken: true
737055
737055
  }
737056
737056
  });
@@ -737112,7 +737112,7 @@ var UserPosthogManager = class {
737112
737112
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
737113
737113
  event: "CLI",
737114
737114
  properties: {
737115
- version: "0.16.34",
737115
+ version: "0.16.35",
737116
737116
  ...event,
737117
737117
  ...event.properties
737118
737118
  }
@@ -752896,6 +752896,11 @@ function getApplicationJsonSchemaMediaObject(media) {
752896
752896
  return { name: name2, value };
752897
752897
  }));
752898
752898
  }
752899
+ if (mediaObject.examples != null && Object.keys(mediaObject.examples).length > 0) {
752900
+ fullExamples.push(...Object.entries(mediaObject.examples).map(([name2, value]) => {
752901
+ return { name: name2, value };
752902
+ }));
752903
+ }
752899
752904
  if (schema2 != null) {
752900
752905
  return {
752901
752906
  schema: schema2,
@@ -754097,6 +754102,12 @@ function getFullExampleAsObject(value) {
754097
754102
  }
754098
754103
  return void 0;
754099
754104
  }
754105
+ function getFullExampleAsArray(value) {
754106
+ if (value != null && Array.isArray(value)) {
754107
+ return value;
754108
+ }
754109
+ return void 0;
754110
+ }
754100
754111
 
754101
754112
  // pnp:/home/circleci/project/packages/cli/openapi-parser/lib/v3/converters/example/ExampleTypeFactory.js
754102
754113
  var ExampleTypeFactory = class {
@@ -754113,7 +754124,7 @@ var ExampleTypeFactory = class {
754113
754124
  return this.buildExampleHelper({ schema: schema2, isOptional, visitedSchemaIds: /* @__PURE__ */ new Set(), example, parameter });
754114
754125
  }
754115
754126
  buildExampleHelper({ example, schema: schema2, isOptional, visitedSchemaIds, parameter = false }) {
754116
- var _a2, _b2;
754127
+ var _a2, _b2, _c2;
754117
754128
  switch (schema2.type) {
754118
754129
  case "enum":
754119
754130
  if (typeof example === "string" && enumContainsValue({ schema: schema2, value: example })) {
@@ -754159,6 +754170,81 @@ var ExampleTypeFactory = class {
754159
754170
  return void 0;
754160
754171
  }
754161
754172
  case "oneOf":
754173
+ switch (schema2.oneOf.type) {
754174
+ case "discriminated": {
754175
+ const result2 = {};
754176
+ let allProperties = {};
754177
+ let requiredProperties = {};
754178
+ const fullExample = getFullExampleAsObject(example);
754179
+ const exampleDiscriminant = fullExample == null ? void 0 : fullExample[schema2.oneOf.discriminantProperty];
754180
+ const exampleUnionVariantSchema = schema2.oneOf.schemas[exampleDiscriminant];
754181
+ const firstUnionVariant = Object.entries(schema2.oneOf.schemas)[0];
754182
+ if (exampleDiscriminant != null && exampleUnionVariantSchema != null && exampleUnionVariantSchema.type === "object") {
754183
+ allProperties = this.getAllProperties(exampleUnionVariantSchema);
754184
+ requiredProperties = this.getAllRequiredProperties(exampleUnionVariantSchema);
754185
+ result2[schema2.oneOf.discriminantProperty] = import_example2.FullExample.primitive(import_example2.PrimitiveExample.string(exampleDiscriminant));
754186
+ } else if (firstUnionVariant != null && firstUnionVariant[1].type === "object") {
754187
+ allProperties = this.getAllProperties(firstUnionVariant[1]);
754188
+ requiredProperties = this.getAllRequiredProperties(firstUnionVariant[1]);
754189
+ result2[schema2.oneOf.discriminantProperty] = import_example2.FullExample.primitive(import_example2.PrimitiveExample.string(firstUnionVariant[0]));
754190
+ } else {
754191
+ return void 0;
754192
+ }
754193
+ for (const commonProperty of schema2.oneOf.commonProperties) {
754194
+ allProperties[commonProperty.key] = commonProperty.schema;
754195
+ const resolvedSchema = this.getResolvedSchema(commonProperty.schema);
754196
+ if (resolvedSchema.type !== "optional" && resolvedSchema.type !== "nullable") {
754197
+ requiredProperties[commonProperty.key] = commonProperty.schema;
754198
+ }
754199
+ }
754200
+ for (const [property2, schema3] of Object.entries(allProperties)) {
754201
+ const required = property2 in requiredProperties;
754202
+ if (required && (fullExample == null ? void 0 : fullExample[property2]) != null) {
754203
+ const propertyExample = this.buildExampleHelper({
754204
+ schema: schema3,
754205
+ example: fullExample[property2],
754206
+ isOptional: !required,
754207
+ visitedSchemaIds,
754208
+ parameter
754209
+ });
754210
+ if (propertyExample != null) {
754211
+ result2[property2] = propertyExample;
754212
+ } else {
754213
+ return void 0;
754214
+ }
754215
+ } else {
754216
+ const propertyExample = this.buildExampleHelper({
754217
+ schema: schema3,
754218
+ example: fullExample == null ? void 0 : fullExample[property2],
754219
+ isOptional: !required,
754220
+ visitedSchemaIds,
754221
+ parameter
754222
+ });
754223
+ if (propertyExample != null) {
754224
+ result2[property2] = propertyExample;
754225
+ } else if (required) {
754226
+ return void 0;
754227
+ }
754228
+ }
754229
+ }
754230
+ return import_example2.FullExample.oneOf({
754231
+ type: "discriminated",
754232
+ discriminated: result2
754233
+ });
754234
+ }
754235
+ case "undisciminated": {
754236
+ if (schema2.oneOf.schemas[0] != null) {
754237
+ return this.buildExampleHelper({
754238
+ example,
754239
+ schema: schema2.oneOf.schemas[0],
754240
+ isOptional,
754241
+ visitedSchemaIds,
754242
+ parameter
754243
+ });
754244
+ }
754245
+ break;
754246
+ }
754247
+ }
754162
754248
  return void 0;
754163
754249
  case "unknown":
754164
754250
  if (example != null) {
@@ -754175,7 +754261,7 @@ var ExampleTypeFactory = class {
754175
754261
  return import_example2.FullExample.map([]);
754176
754262
  case "array": {
754177
754263
  const itemExample = this.buildExampleHelper({
754178
- example,
754264
+ example: (_b2 = getFullExampleAsArray(example)) == null ? void 0 : _b2[0],
754179
754265
  schema: schema2.value,
754180
754266
  isOptional: true,
754181
754267
  visitedSchemaIds,
@@ -754236,7 +754322,7 @@ var ExampleTypeFactory = class {
754236
754322
  }
754237
754323
  case "object": {
754238
754324
  const result2 = {};
754239
- const fullExample = getFullExampleAsObject(example) ?? (((_b2 = schema2.fullExamples) == null ? void 0 : _b2[0]) != null ? getFullExampleAsObject(schema2.fullExamples[0]) : {}) ?? {};
754325
+ const fullExample = getFullExampleAsObject(example) ?? (((_c2 = schema2.fullExamples) == null ? void 0 : _c2[0]) != null ? getFullExampleAsObject(schema2.fullExamples[0]) : {}) ?? {};
754240
754326
  const allProperties = this.getAllProperties(schema2);
754241
754327
  const requiredProperties = this.getAllRequiredProperties(schema2);
754242
754328
  for (const [property2, schema3] of Object.entries(allProperties)) {
@@ -762298,10 +762384,10 @@ var CliContext = class {
762298
762384
  return "fern-api";
762299
762385
  }
762300
762386
  getPackageVersion() {
762301
- if ("0.16.34" == null) {
762387
+ if ("0.16.35" == null) {
762302
762388
  this.logger.error("CLI_VERSION is not defined");
762303
762389
  }
762304
- return "0.16.34";
762390
+ return "0.16.35";
762305
762391
  }
762306
762392
  getCliName() {
762307
762393
  if ("fern" == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.16.34",
3
+ "version": "0.16.35",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",