fern-api 0.33.4 → 0.33.5
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.
- package/bundle.cjs +64 -28
- package/package.json +1 -1
package/bundle.cjs
CHANGED
|
@@ -1164535,7 +1164535,7 @@ var AccessTokenPosthogManager = class {
|
|
|
1164535
1164535
|
properties: {
|
|
1164536
1164536
|
...event,
|
|
1164537
1164537
|
...event.properties,
|
|
1164538
|
-
version: "0.33.
|
|
1164538
|
+
version: "0.33.5",
|
|
1164539
1164539
|
usingAccessToken: true
|
|
1164540
1164540
|
}
|
|
1164541
1164541
|
});
|
|
@@ -1164597,7 +1164597,7 @@ var UserPosthogManager = class {
|
|
|
1164597
1164597
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
1164598
1164598
|
event: "CLI",
|
|
1164599
1164599
|
properties: {
|
|
1164600
|
-
version: "0.33.
|
|
1164600
|
+
version: "0.33.5",
|
|
1164601
1164601
|
...event,
|
|
1164602
1164602
|
...event.properties
|
|
1164603
1164603
|
}
|
|
@@ -1178828,7 +1178828,7 @@ function buildBooleanTypeReference({ description, schema: schema2 }) {
|
|
|
1178828
1178828
|
return result2;
|
|
1178829
1178829
|
}
|
|
1178830
1178830
|
function buildLongTypeReference({ description, schema: schema2 }) {
|
|
1178831
|
-
const type2 = "
|
|
1178831
|
+
const type2 = "long";
|
|
1178832
1178832
|
if (description == null && schema2.default == null) {
|
|
1178833
1178833
|
return type2;
|
|
1178834
1178834
|
}
|
|
@@ -1181421,34 +1181421,54 @@ function getDefaultAsString(schema2) {
|
|
|
1181421
1181421
|
}
|
|
1181422
1181422
|
|
|
1181423
1181423
|
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/schema/examples/getExample.js
|
|
1181424
|
-
function getExampleAsNumber(schema2) {
|
|
1181424
|
+
function getExampleAsNumber({ schema: schema2, logger, fallback: fallback2 }) {
|
|
1181425
1181425
|
if (schema2.example != null && typeof schema2.example === "number") {
|
|
1181426
1181426
|
return schema2.example;
|
|
1181427
1181427
|
}
|
|
1181428
|
+
if (fallback2 && typeof fallback2 === "number") {
|
|
1181429
|
+
return fallback2;
|
|
1181430
|
+
} else if (fallback2) {
|
|
1181431
|
+
logger.warn(`Expected fallback to be a number, but got ${typeof fallback2}`);
|
|
1181432
|
+
}
|
|
1181428
1181433
|
return void 0;
|
|
1181429
1181434
|
}
|
|
1181430
|
-
function getExampleAsBoolean(schema2) {
|
|
1181435
|
+
function getExampleAsBoolean({ schema: schema2, logger, fallback: fallback2 }) {
|
|
1181431
1181436
|
if (schema2.example != null && typeof schema2.example === "boolean") {
|
|
1181432
1181437
|
return schema2.example;
|
|
1181433
1181438
|
}
|
|
1181439
|
+
if (fallback2 && typeof fallback2 === "boolean") {
|
|
1181440
|
+
return fallback2;
|
|
1181441
|
+
} else if (fallback2) {
|
|
1181442
|
+
logger.warn(`Expected fallback to be a boolean, but got ${typeof fallback2}`);
|
|
1181443
|
+
}
|
|
1181434
1181444
|
return void 0;
|
|
1181435
1181445
|
}
|
|
1181436
|
-
function getExamplesString(schema2) {
|
|
1181446
|
+
function getExamplesString({ schema: schema2, logger, fallback: fallback2 }) {
|
|
1181437
1181447
|
if (schema2.example != null && typeof schema2.example === "string") {
|
|
1181438
1181448
|
return schema2.example;
|
|
1181439
1181449
|
}
|
|
1181450
|
+
if (fallback2 && typeof fallback2 === "string") {
|
|
1181451
|
+
return fallback2;
|
|
1181452
|
+
} else if (fallback2) {
|
|
1181453
|
+
logger.warn(`Expected fallback to be a string, but got ${typeof fallback2}`);
|
|
1181454
|
+
}
|
|
1181440
1181455
|
return void 0;
|
|
1181441
1181456
|
}
|
|
1181442
|
-
function getExampleAsArray(schema2) {
|
|
1181457
|
+
function getExampleAsArray({ schema: schema2, logger, fallback: fallback2 }) {
|
|
1181443
1181458
|
if (schema2.example != null && Array.isArray(schema2.example)) {
|
|
1181444
1181459
|
return schema2.example;
|
|
1181445
1181460
|
}
|
|
1181461
|
+
if (fallback2 && Array.isArray(fallback2)) {
|
|
1181462
|
+
return fallback2;
|
|
1181463
|
+
} else if (fallback2) {
|
|
1181464
|
+
logger.warn(`Expected fallback to be a array, but got ${typeof fallback2}`);
|
|
1181465
|
+
}
|
|
1181446
1181466
|
return void 0;
|
|
1181447
1181467
|
}
|
|
1181448
1181468
|
|
|
1181449
1181469
|
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/schema/convertSchemas.js
|
|
1181450
1181470
|
var SCHEMA_REFERENCE_PREFIX = "#/components/schemas/";
|
|
1181451
|
-
function convertSchema(schema2, wrapAsNullable, context, breadcrumbs, referencedAsRequest = false, propertiesToExclude = /* @__PURE__ */ new Set()) {
|
|
1181471
|
+
function convertSchema(schema2, wrapAsNullable, context, breadcrumbs, referencedAsRequest = false, propertiesToExclude = /* @__PURE__ */ new Set(), fallback2) {
|
|
1181452
1181472
|
if (isReferenceObject(schema2)) {
|
|
1181453
1181473
|
const schemaId = getSchemaIdFromReference(schema2);
|
|
1181454
1181474
|
if (schemaId != null) {
|
|
@@ -1181459,9 +1181479,9 @@ function convertSchema(schema2, wrapAsNullable, context, breadcrumbs, referenced
|
|
|
1181459
1181479
|
}
|
|
1181460
1181480
|
return convertReferenceObject(schema2, wrapAsNullable, context, breadcrumbs);
|
|
1181461
1181481
|
}
|
|
1181462
|
-
return convertSchemaObject(context.resolveSchemaReference(schema2), wrapAsNullable, context, getBreadcrumbsFromReference(schema2.$ref), propertiesToExclude, referencedAsRequest);
|
|
1181482
|
+
return convertSchemaObject(context.resolveSchemaReference(schema2), wrapAsNullable, context, getBreadcrumbsFromReference(schema2.$ref), propertiesToExclude, referencedAsRequest, fallback2);
|
|
1181463
1181483
|
} else {
|
|
1181464
|
-
return convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest);
|
|
1181484
|
+
return convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2);
|
|
1181465
1181485
|
}
|
|
1181466
1181486
|
}
|
|
1181467
1181487
|
function convertReferenceObject(schema2, wrapAsNullable, context, breadcrumbs) {
|
|
@@ -1181491,7 +1181511,7 @@ function getTitleAsName(title2) {
|
|
|
1181491
1181511
|
}
|
|
1181492
1181512
|
return title2;
|
|
1181493
1181513
|
}
|
|
1181494
|
-
function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude = /* @__PURE__ */ new Set(), referencedAsRequest = false) {
|
|
1181514
|
+
function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, propertiesToExclude = /* @__PURE__ */ new Set(), referencedAsRequest = false, fallback2) {
|
|
1181495
1181515
|
var _a5;
|
|
1181496
1181516
|
const nameOverride = getExtension(schema2, FernOpenAPIExtension.TYPE_NAME) ?? (context.options.useTitlesAsName ? getTitleAsName(schema2.title) : void 0);
|
|
1181497
1181517
|
const mixedGroupName = getExtension(schema2, FernOpenAPIExtension.SDK_GROUP_NAME) ?? ((_a5 = getExtension(schema2, OpenAPIExtension.TAGS)) == null ? void 0 : _a5[0]);
|
|
@@ -1181514,7 +1181534,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181514
1181534
|
return fernSchema;
|
|
1181515
1181535
|
}
|
|
1181516
1181536
|
if (!wrapAsNullable && schema2.nullable === true) {
|
|
1181517
|
-
return convertSchemaObject(schema2, true, context, breadcrumbs);
|
|
1181537
|
+
return convertSchemaObject(schema2, true, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2);
|
|
1181518
1181538
|
}
|
|
1181519
1181539
|
if (schema2.enum != null && (schema2.type === "string" || schema2.type == null)) {
|
|
1181520
1181540
|
if (!isListOfStrings(schema2.enum)) {
|
|
@@ -1181527,7 +1181547,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181527
1181547
|
maxLength: schema2.maxLength,
|
|
1181528
1181548
|
pattern: schema2.pattern,
|
|
1181529
1181549
|
format: schema2.format,
|
|
1181530
|
-
example: getExamplesString(schema2)
|
|
1181550
|
+
example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
|
|
1181531
1181551
|
}),
|
|
1181532
1181552
|
groupName,
|
|
1181533
1181553
|
wrapAsNullable,
|
|
@@ -1181570,7 +1181590,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181570
1181590
|
value: convertSchemaObject({
|
|
1181571
1181591
|
...schema2,
|
|
1181572
1181592
|
type: secondElement
|
|
1181573
|
-
}, wrapAsNullable, context, breadcrumbs, propertiesToExclude),
|
|
1181593
|
+
}, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2),
|
|
1181574
1181594
|
groupName,
|
|
1181575
1181595
|
description: schema2.description,
|
|
1181576
1181596
|
availability
|
|
@@ -1181582,7 +1181602,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181582
1181602
|
value: convertSchemaObject({
|
|
1181583
1181603
|
...schema2,
|
|
1181584
1181604
|
type: firstElement
|
|
1181585
|
-
}, wrapAsNullable, context, breadcrumbs, propertiesToExclude),
|
|
1181605
|
+
}, wrapAsNullable, context, breadcrumbs, propertiesToExclude, referencedAsRequest, fallback2),
|
|
1181586
1181606
|
groupName,
|
|
1181587
1181607
|
description: schema2.description,
|
|
1181588
1181608
|
availability
|
|
@@ -1181627,7 +1181647,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181627
1181647
|
generatedName,
|
|
1181628
1181648
|
primitive: PrimitiveSchemaValueWithExample.boolean({
|
|
1181629
1181649
|
default: schema2.default,
|
|
1181630
|
-
example: getExampleAsBoolean(schema2)
|
|
1181650
|
+
example: getExampleAsBoolean({ schema: schema2, logger: context.logger, fallback: fallback2 })
|
|
1181631
1181651
|
}),
|
|
1181632
1181652
|
wrapAsNullable,
|
|
1181633
1181653
|
description,
|
|
@@ -1181649,7 +1181669,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181649
1181669
|
description,
|
|
1181650
1181670
|
availability,
|
|
1181651
1181671
|
wrapAsNullable,
|
|
1181652
|
-
example: getExampleAsNumber(schema2),
|
|
1181672
|
+
example: getExampleAsNumber({ schema: schema2, logger: context.logger, fallback: fallback2 }),
|
|
1181653
1181673
|
groupName
|
|
1181654
1181674
|
});
|
|
1181655
1181675
|
}
|
|
@@ -1181664,7 +1181684,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181664
1181684
|
exclusiveMinimum: getValueIfBoolean(schema2.exclusiveMinimum),
|
|
1181665
1181685
|
exclusiveMaximum: getValueIfBoolean(schema2.exclusiveMaximum),
|
|
1181666
1181686
|
multipleOf: schema2.multipleOf,
|
|
1181667
|
-
example: getExampleAsNumber(schema2)
|
|
1181687
|
+
example: getExampleAsNumber({ schema: schema2, logger: context.logger, fallback: fallback2 })
|
|
1181668
1181688
|
}),
|
|
1181669
1181689
|
wrapAsNullable,
|
|
1181670
1181690
|
description,
|
|
@@ -1181686,7 +1181706,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181686
1181706
|
description,
|
|
1181687
1181707
|
availability,
|
|
1181688
1181708
|
wrapAsNullable,
|
|
1181689
|
-
example: getExampleAsNumber(schema2),
|
|
1181709
|
+
example: getExampleAsNumber({ schema: schema2, logger: context.logger, fallback: fallback2 }),
|
|
1181690
1181710
|
groupName
|
|
1181691
1181711
|
});
|
|
1181692
1181712
|
}
|
|
@@ -1181696,7 +1181716,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181696
1181716
|
nameOverride,
|
|
1181697
1181717
|
generatedName,
|
|
1181698
1181718
|
primitive: PrimitiveSchemaValueWithExample.datetime({
|
|
1181699
|
-
example: getExamplesString(schema2)
|
|
1181719
|
+
example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
|
|
1181700
1181720
|
}),
|
|
1181701
1181721
|
wrapAsNullable,
|
|
1181702
1181722
|
description,
|
|
@@ -1181734,7 +1181754,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181734
1181754
|
format: schema2.format,
|
|
1181735
1181755
|
minLength: schema2.minLength,
|
|
1181736
1181756
|
maxLength: schema2.maxLength,
|
|
1181737
|
-
example: getExamplesString(schema2)
|
|
1181757
|
+
example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
|
|
1181738
1181758
|
}),
|
|
1181739
1181759
|
groupName,
|
|
1181740
1181760
|
wrapAsNullable,
|
|
@@ -1181753,7 +1181773,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1181753
1181773
|
wrapAsNullable,
|
|
1181754
1181774
|
context,
|
|
1181755
1181775
|
groupName,
|
|
1181756
|
-
example: getExampleAsArray(schema2)
|
|
1181776
|
+
example: getExampleAsArray({ schema: schema2, logger: context.logger, fallback: fallback2 })
|
|
1181757
1181777
|
});
|
|
1181758
1181778
|
}
|
|
1181759
1181779
|
if (schema2.additionalProperties != null && schema2.additionalProperties !== false && hasNoProperties(schema2)) {
|
|
@@ -1182001,7 +1182021,7 @@ function convertSchemaObject(schema2, wrapAsNullable, context, breadcrumbs, prop
|
|
|
1182001
1182021
|
format: schema2.format,
|
|
1182002
1182022
|
minLength: schema2.minLength,
|
|
1182003
1182023
|
maxLength: schema2.maxLength,
|
|
1182004
|
-
example: getExamplesString(schema2)
|
|
1182024
|
+
example: getExamplesString({ schema: schema2, logger: context.logger, fallback: fallback2 })
|
|
1182005
1182025
|
}),
|
|
1182006
1182026
|
groupName
|
|
1182007
1182027
|
},
|
|
@@ -1184686,6 +1184706,7 @@ function getVariableReference(parameter) {
|
|
|
1184686
1184706
|
|
|
1184687
1184707
|
// pnp:/home/runner/work/fern/fern/packages/cli/openapi-parser/lib/openapi/v3/converters/endpoint/convertParameters.js
|
|
1184688
1184708
|
function convertParameters({ path: path44, httpMethod, parameters, context, requestBreadcrumbs }) {
|
|
1184709
|
+
var _a5;
|
|
1184689
1184710
|
const convertedParameters = {
|
|
1184690
1184711
|
pathParameters: [],
|
|
1184691
1184712
|
queryParameters: [],
|
|
@@ -1184697,7 +1184718,13 @@ function convertParameters({ path: path44, httpMethod, parameters, context, requ
|
|
|
1184697
1184718
|
const availability = convertAvailability3(resolvedParameter);
|
|
1184698
1184719
|
const parameterBreadcrumbs = [...requestBreadcrumbs, resolvedParameter.name];
|
|
1184699
1184720
|
const generatedName = getGeneratedTypeName(parameterBreadcrumbs);
|
|
1184700
|
-
|
|
1184721
|
+
if ((_a5 = getExamplesString({ schema: resolvedParameter, logger: context.logger })) == null ? void 0 : _a5.includes(" ")) {
|
|
1184722
|
+
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.");
|
|
1184723
|
+
}
|
|
1184724
|
+
let schema2 = resolvedParameter.schema != null ? convertSchema(resolvedParameter.schema, !isRequired, context, parameterBreadcrumbs, false, /* @__PURE__ */ new Set(), getExamplesString({
|
|
1184725
|
+
schema: resolvedParameter,
|
|
1184726
|
+
logger: context.logger
|
|
1184727
|
+
})) : isRequired ? SchemaWithExample.primitive({
|
|
1184701
1184728
|
nameOverride: void 0,
|
|
1184702
1184729
|
generatedName,
|
|
1184703
1184730
|
schema: PrimitiveSchemaValueWithExample.string({
|
|
@@ -1184706,7 +1184733,10 @@ function convertParameters({ path: path44, httpMethod, parameters, context, requ
|
|
|
1184706
1184733
|
format: void 0,
|
|
1184707
1184734
|
minLength: void 0,
|
|
1184708
1184735
|
maxLength: void 0,
|
|
1184709
|
-
example: getExamplesString(
|
|
1184736
|
+
example: getExamplesString({
|
|
1184737
|
+
schema: resolvedParameter,
|
|
1184738
|
+
logger: context.logger
|
|
1184739
|
+
})
|
|
1184710
1184740
|
}),
|
|
1184711
1184741
|
description: void 0,
|
|
1184712
1184742
|
availability,
|
|
@@ -1184723,7 +1184753,10 @@ function convertParameters({ path: path44, httpMethod, parameters, context, requ
|
|
|
1184723
1184753
|
format: void 0,
|
|
1184724
1184754
|
minLength: void 0,
|
|
1184725
1184755
|
maxLength: void 0,
|
|
1184726
|
-
example: getExamplesString(
|
|
1184756
|
+
example: getExamplesString({
|
|
1184757
|
+
schema: resolvedParameter,
|
|
1184758
|
+
logger: context.logger
|
|
1184759
|
+
})
|
|
1184727
1184760
|
}),
|
|
1184728
1184761
|
description: void 0,
|
|
1184729
1184762
|
availability: void 0,
|
|
@@ -1187320,6 +1187353,9 @@ function convertPrimitive2(primitiveExample) {
|
|
|
1187320
1187353
|
}
|
|
1187321
1187354
|
case "datetime":
|
|
1187322
1187355
|
try {
|
|
1187356
|
+
if (!primitiveExample.value.endsWith("Z") && !primitiveExample.value.includes("+")) {
|
|
1187357
|
+
primitiveExample.value += "Z";
|
|
1187358
|
+
}
|
|
1187323
1187359
|
return new Date(primitiveExample.value).toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
1187324
1187360
|
} catch (e) {
|
|
1187325
1187361
|
return "2024-01-15T09:30:00Z";
|
|
@@ -1192599,10 +1192635,10 @@ var CliContext = class {
|
|
|
1192599
1192635
|
return "fern-api";
|
|
1192600
1192636
|
}
|
|
1192601
1192637
|
getPackageVersion() {
|
|
1192602
|
-
if ("0.33.
|
|
1192638
|
+
if ("0.33.5" == null) {
|
|
1192603
1192639
|
this.logger.error("CLI_VERSION is not defined");
|
|
1192604
1192640
|
}
|
|
1192605
|
-
return "0.33.
|
|
1192641
|
+
return "0.33.5";
|
|
1192606
1192642
|
}
|
|
1192607
1192643
|
getCliName() {
|
|
1192608
1192644
|
if ("fern" == null) {
|