@fern-api/fern-api-dev 5.75.1 → 5.75.3
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/cli.cjs +146 -14
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -153415,7 +153415,7 @@ var init_inferDiscriminatorContext = __esm({
|
|
|
153415
153415
|
});
|
|
153416
153416
|
|
|
153417
153417
|
// ../api-importers/openapi/openapi-ir-parser/lib/schema/convertDiscriminatedOneOf.js
|
|
153418
|
-
function convertDiscriminatedOneOf({ nameOverride, generatedName, title: title2, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminator, context: context3, namespace, groupName, encoding, source: source2 }) {
|
|
153418
|
+
function convertDiscriminatedOneOf({ nameOverride, generatedName, title: title2, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminator, oneOfSchemas, context: context3, namespace, groupName, encoding, source: source2 }) {
|
|
153419
153419
|
const discriminant22 = discriminator.propertyName;
|
|
153420
153420
|
const discriminantNameOverride = getExtension(discriminator, FernOpenAPIExtension.FERN_PROPERTY_NAME);
|
|
153421
153421
|
const discriminatorContext = resolveDiscriminatorContext({ discriminator, context: context3 });
|
|
@@ -153439,6 +153439,13 @@ function convertDiscriminatedOneOf({ nameOverride, generatedName, title: title2,
|
|
|
153439
153439
|
context3.markReferencedByDiscriminatedUnion(ref2, discriminant22, 1);
|
|
153440
153440
|
return [discriminantValue, subtypeReference];
|
|
153441
153441
|
}));
|
|
153442
|
+
warnAboutUnmappedOneOfMembers({
|
|
153443
|
+
oneOfSchemas,
|
|
153444
|
+
mapping: discriminator.mapping,
|
|
153445
|
+
generatedName,
|
|
153446
|
+
breadcrumbs,
|
|
153447
|
+
context: context3
|
|
153448
|
+
});
|
|
153442
153449
|
const convertedProperties = Object.entries(properties7).filter(([propertyName]) => {
|
|
153443
153450
|
return propertyName !== discriminant22;
|
|
153444
153451
|
}).map(([propertyName, propertySchema]) => {
|
|
@@ -153482,6 +153489,38 @@ function convertDiscriminatedOneOf({ nameOverride, generatedName, title: title2,
|
|
|
153482
153489
|
source: source2
|
|
153483
153490
|
});
|
|
153484
153491
|
}
|
|
153492
|
+
function getSchemaNameFromReference(ref2) {
|
|
153493
|
+
const segments = ref2.split("/");
|
|
153494
|
+
return segments[segments.length - 1] ?? ref2;
|
|
153495
|
+
}
|
|
153496
|
+
function warnOnce(context3, message) {
|
|
153497
|
+
let alreadyWarned = alreadyWarnedUnmappedMembersByLogger.get(context3.logger);
|
|
153498
|
+
if (alreadyWarned == null) {
|
|
153499
|
+
alreadyWarned = /* @__PURE__ */ new Set();
|
|
153500
|
+
alreadyWarnedUnmappedMembersByLogger.set(context3.logger, alreadyWarned);
|
|
153501
|
+
}
|
|
153502
|
+
if (alreadyWarned.has(message)) {
|
|
153503
|
+
return;
|
|
153504
|
+
}
|
|
153505
|
+
alreadyWarned.add(message);
|
|
153506
|
+
context3.logger.warn(message);
|
|
153507
|
+
}
|
|
153508
|
+
function warnAboutUnmappedOneOfMembers({ oneOfSchemas, mapping, generatedName, breadcrumbs, context: context3 }) {
|
|
153509
|
+
if (oneOfSchemas == null || oneOfSchemas.length === 0) {
|
|
153510
|
+
return;
|
|
153511
|
+
}
|
|
153512
|
+
const mappedSchemaNames = new Set(Object.values(mapping ?? {}).map(getSchemaNameFromReference));
|
|
153513
|
+
const location2 = breadcrumbs.length > 0 ? `${generatedName} (${breadcrumbs.join(" > ")})` : generatedName;
|
|
153514
|
+
for (const member of oneOfSchemas) {
|
|
153515
|
+
if (isReferenceObject(member)) {
|
|
153516
|
+
if (!mappedSchemaNames.has(getSchemaNameFromReference(member.$ref))) {
|
|
153517
|
+
warnOnce(context3, `Discriminated union "${location2}" lists "${member.$ref}" in its oneOf/anyOf, but it is not present in the discriminator mapping. This variant will be omitted from the generated union, so payloads using it will fail to serialize or deserialize. Add it to the discriminator mapping to include it.`);
|
|
153518
|
+
}
|
|
153519
|
+
} else if (member.type !== "null") {
|
|
153520
|
+
warnOnce(context3, `Discriminated union "${location2}" contains an inline oneOf/anyOf member that is not referenced by the discriminator mapping. This variant will be omitted from the generated union, so payloads using it will fail to serialize or deserialize. Extract it into a named schema and add it to the discriminator mapping to include it.`);
|
|
153521
|
+
}
|
|
153522
|
+
}
|
|
153523
|
+
}
|
|
153485
153524
|
function convertDiscriminatedOneOfWithVariants({ nameOverride, generatedName, title: title2, breadcrumbs, properties: properties7, description, availability, required: required6, wrapAsOptional, wrapAsNullable, discriminant: discriminant22, variants, defaultDiscriminantValue, context: context3, namespace, groupName, encoding, source: source2 }) {
|
|
153486
153525
|
const unionSubTypes = Object.fromEntries(Object.entries(variants).map(([discriminantValue, schema]) => {
|
|
153487
153526
|
if (isReferenceObject(schema)) {
|
|
@@ -153719,6 +153758,7 @@ function mergeOneOfVariantsIntoObject({ variants, context: context3, discriminan
|
|
|
153719
153758
|
required: mergedRequired.length > 0 ? mergedRequired : void 0
|
|
153720
153759
|
};
|
|
153721
153760
|
}
|
|
153761
|
+
var alreadyWarnedUnmappedMembersByLogger;
|
|
153722
153762
|
var init_convertDiscriminatedOneOf = __esm({
|
|
153723
153763
|
"../api-importers/openapi/openapi-ir-parser/lib/schema/convertDiscriminatedOneOf.js"() {
|
|
153724
153764
|
"use strict";
|
|
@@ -153730,6 +153770,7 @@ var init_convertDiscriminatedOneOf = __esm({
|
|
|
153730
153770
|
init_inferDiscriminatorContext();
|
|
153731
153771
|
init_isReferenceObject();
|
|
153732
153772
|
init_isSchemaWithExampleEqual();
|
|
153773
|
+
alreadyWarnedUnmappedMembersByLogger = /* @__PURE__ */ new WeakMap();
|
|
153733
153774
|
}
|
|
153734
153775
|
});
|
|
153735
153776
|
|
|
@@ -155172,6 +155213,7 @@ function convertSchemaObject(schema, wrapAsOptional, wrapAsNullable, context3, b
|
|
|
155172
155213
|
description,
|
|
155173
155214
|
availability,
|
|
155174
155215
|
discriminator: schema.discriminator,
|
|
155216
|
+
oneOfSchemas: schema.oneOf ?? schema.anyOf,
|
|
155175
155217
|
properties: schema.properties ?? {},
|
|
155176
155218
|
required: schema.required,
|
|
155177
155219
|
wrapAsOptional,
|
|
@@ -155232,6 +155274,7 @@ function convertSchemaObject(schema, wrapAsOptional, wrapAsNullable, context3, b
|
|
|
155232
155274
|
description,
|
|
155233
155275
|
availability,
|
|
155234
155276
|
discriminator: schema.discriminator,
|
|
155277
|
+
oneOfSchemas: schema.oneOf ?? schema.anyOf,
|
|
155235
155278
|
properties: schema.properties ?? {},
|
|
155236
155279
|
required: schema.required,
|
|
155237
155280
|
wrapAsOptional,
|
|
@@ -155423,6 +155466,7 @@ function convertSchemaObject(schema, wrapAsOptional, wrapAsNullable, context3, b
|
|
|
155423
155466
|
description,
|
|
155424
155467
|
availability,
|
|
155425
155468
|
discriminator: schema.discriminator,
|
|
155469
|
+
oneOfSchemas: schema.oneOf ?? schema.anyOf,
|
|
155426
155470
|
properties: schema.properties ?? {},
|
|
155427
155471
|
required: schema.required,
|
|
155428
155472
|
wrapAsOptional,
|
|
@@ -344179,13 +344223,28 @@ function getLiteralValueFromSchema(schema) {
|
|
|
344179
344223
|
}
|
|
344180
344224
|
return void 0;
|
|
344181
344225
|
}
|
|
344182
|
-
var LITERAL_REGEX, ExampleConverter;
|
|
344226
|
+
var LITERAL_REGEX, EXAMPLE_CONVERTER_SHARED_STATE, MERGE_ONLY_OBJECT_SCHEMA_FIELDS, ExampleConverter;
|
|
344183
344227
|
var init_ExampleConverter = __esm({
|
|
344184
344228
|
"../api-importers/v3-importer-commons/lib/converters/ExampleConverter.js"() {
|
|
344185
344229
|
"use strict";
|
|
344186
344230
|
init_lib4();
|
|
344187
344231
|
init_lib29();
|
|
344188
344232
|
LITERAL_REGEX = /^literal<\s*(?:"(.*)"|(true|false))\s*>$/;
|
|
344233
|
+
EXAMPLE_CONVERTER_SHARED_STATE = /* @__PURE__ */ new WeakMap();
|
|
344234
|
+
MERGE_ONLY_OBJECT_SCHEMA_FIELDS = /* @__PURE__ */ new Set([
|
|
344235
|
+
"type",
|
|
344236
|
+
"properties",
|
|
344237
|
+
"required",
|
|
344238
|
+
"allOf",
|
|
344239
|
+
"description",
|
|
344240
|
+
"title",
|
|
344241
|
+
"deprecated",
|
|
344242
|
+
"readOnly",
|
|
344243
|
+
"writeOnly",
|
|
344244
|
+
"xml",
|
|
344245
|
+
"externalDocs",
|
|
344246
|
+
"discriminator"
|
|
344247
|
+
]);
|
|
344189
344248
|
ExampleConverter = class _ExampleConverter extends AbstractConverter {
|
|
344190
344249
|
MAX_DEPTH = 12;
|
|
344191
344250
|
EXAMPLE_STRING = examples_exports.STRING;
|
|
@@ -344200,6 +344259,7 @@ var init_ExampleConverter = __esm({
|
|
|
344200
344259
|
exampleGenerationStrategy;
|
|
344201
344260
|
generateOptionalProperties;
|
|
344202
344261
|
seenRefs;
|
|
344262
|
+
sharedState;
|
|
344203
344263
|
constructor({ breadcrumbs, context: context3, schema, example, depth = 0, exampleGenerationStrategy, generateOptionalProperties = false, seenRefs = /* @__PURE__ */ new Set() }) {
|
|
344204
344264
|
super({ breadcrumbs, context: context3 });
|
|
344205
344265
|
this.example = example;
|
|
@@ -344208,6 +344268,16 @@ var init_ExampleConverter = __esm({
|
|
|
344208
344268
|
this.exampleGenerationStrategy = exampleGenerationStrategy;
|
|
344209
344269
|
this.generateOptionalProperties = generateOptionalProperties;
|
|
344210
344270
|
this.seenRefs = seenRefs;
|
|
344271
|
+
const existingSharedState = EXAMPLE_CONVERTER_SHARED_STATE.get(context3);
|
|
344272
|
+
if (existingSharedState != null) {
|
|
344273
|
+
this.sharedState = existingSharedState;
|
|
344274
|
+
} else {
|
|
344275
|
+
this.sharedState = {
|
|
344276
|
+
mergedAllOfProperties: /* @__PURE__ */ new WeakMap(),
|
|
344277
|
+
mergeOnlyAllOfSchemas: /* @__PURE__ */ new WeakMap()
|
|
344278
|
+
};
|
|
344279
|
+
EXAMPLE_CONVERTER_SHARED_STATE.set(context3, this.sharedState);
|
|
344280
|
+
}
|
|
344211
344281
|
}
|
|
344212
344282
|
convert() {
|
|
344213
344283
|
if (this.depth > this.MAX_DEPTH) {
|
|
@@ -344676,7 +344746,8 @@ var init_ExampleConverter = __esm({
|
|
|
344676
344746
|
};
|
|
344677
344747
|
}
|
|
344678
344748
|
const exampleObj = typeof this.example !== "object" || this.example == null ? {} : this.example;
|
|
344679
|
-
const
|
|
344749
|
+
const canGenerateFromMergedAllOf = this.example === void 0 && this.canGenerateFromMergedAllOf(resolvedSchema);
|
|
344750
|
+
const { mergedProperties, mergedRequired } = this.mergeAllOfProperties(resolvedSchema, /* @__PURE__ */ new Set(), 0, canGenerateFromMergedAllOf);
|
|
344680
344751
|
const resultsByKey = Object.entries(mergedProperties).map(([key2, property24]) => {
|
|
344681
344752
|
if (typeof property24 !== "object") {
|
|
344682
344753
|
return {
|
|
@@ -344786,7 +344857,7 @@ var init_ExampleConverter = __esm({
|
|
|
344786
344857
|
return { key: key2, result };
|
|
344787
344858
|
}
|
|
344788
344859
|
});
|
|
344789
|
-
const allOfResults = (resolvedSchema.allOf ?? []).map((subSchema, index3) => {
|
|
344860
|
+
const allOfResults = canGenerateFromMergedAllOf ? [] : (resolvedSchema.allOf ?? []).map((subSchema, index3) => {
|
|
344790
344861
|
const resolvedSubSchema = this.context.resolveMaybeReference({
|
|
344791
344862
|
schemaOrReference: subSchema,
|
|
344792
344863
|
breadcrumbs: [...this.breadcrumbs, `allOf[${index3}]`],
|
|
@@ -345168,11 +345239,21 @@ var init_ExampleConverter = __esm({
|
|
|
345168
345239
|
*
|
|
345169
345240
|
* Precedence: the override's fields win; the base's fields fill in anything missing.
|
|
345170
345241
|
*/
|
|
345171
|
-
mergeAllOfProperties(resolvedSchema, visited = /* @__PURE__ */ new Set(), depth = 0) {
|
|
345242
|
+
mergeAllOfProperties(resolvedSchema, visited = /* @__PURE__ */ new Set(), depth = 0, useCache = false) {
|
|
345243
|
+
if (useCache) {
|
|
345244
|
+
const cached2 = this.sharedState.mergedAllOfProperties.get(resolvedSchema)?.get(depth);
|
|
345245
|
+
if (cached2 != null) {
|
|
345246
|
+
return cached2;
|
|
345247
|
+
}
|
|
345248
|
+
}
|
|
345172
345249
|
const directProps = resolvedSchema.properties ?? {};
|
|
345173
345250
|
const directRequired = resolvedSchema.required ?? [];
|
|
345174
345251
|
if (depth > this.MAX_DEPTH || resolvedSchema.allOf == null || resolvedSchema.allOf.length === 0) {
|
|
345175
|
-
|
|
345252
|
+
const result2 = { mergedProperties: directProps, mergedRequired: directRequired };
|
|
345253
|
+
if (useCache) {
|
|
345254
|
+
this.cacheMergedAllOfProperties(resolvedSchema, depth, result2);
|
|
345255
|
+
}
|
|
345256
|
+
return result2;
|
|
345176
345257
|
}
|
|
345177
345258
|
const baseProps = {};
|
|
345178
345259
|
const baseRequired = new Set(directRequired);
|
|
@@ -345194,7 +345275,7 @@ var init_ExampleConverter = __esm({
|
|
|
345194
345275
|
if (refKey != null) {
|
|
345195
345276
|
childVisited.add(refKey);
|
|
345196
345277
|
}
|
|
345197
|
-
const nested = this.mergeAllOfProperties(resolved, childVisited, depth + 1);
|
|
345278
|
+
const nested = this.mergeAllOfProperties(resolved, childVisited, depth + 1, useCache);
|
|
345198
345279
|
for (const req of nested.mergedRequired) {
|
|
345199
345280
|
baseRequired.add(req);
|
|
345200
345281
|
}
|
|
@@ -345248,7 +345329,58 @@ var init_ExampleConverter = __esm({
|
|
|
345248
345329
|
merged[key2] = baseProp;
|
|
345249
345330
|
}
|
|
345250
345331
|
}
|
|
345251
|
-
|
|
345332
|
+
const result = { mergedProperties: merged, mergedRequired: [...baseRequired] };
|
|
345333
|
+
if (useCache) {
|
|
345334
|
+
this.cacheMergedAllOfProperties(resolvedSchema, depth, result);
|
|
345335
|
+
}
|
|
345336
|
+
return result;
|
|
345337
|
+
}
|
|
345338
|
+
cacheMergedAllOfProperties(schema, depth, mergedAllOfProperties) {
|
|
345339
|
+
const cachedByDepth = this.sharedState.mergedAllOfProperties.get(schema);
|
|
345340
|
+
if (cachedByDepth != null) {
|
|
345341
|
+
cachedByDepth.set(depth, mergedAllOfProperties);
|
|
345342
|
+
} else {
|
|
345343
|
+
this.sharedState.mergedAllOfProperties.set(schema, /* @__PURE__ */ new Map([[depth, mergedAllOfProperties]]));
|
|
345344
|
+
}
|
|
345345
|
+
}
|
|
345346
|
+
canGenerateFromMergedAllOf(resolvedSchema, visiting = /* @__PURE__ */ new WeakSet()) {
|
|
345347
|
+
if (resolvedSchema.allOf == null || resolvedSchema.allOf.length === 0) {
|
|
345348
|
+
return false;
|
|
345349
|
+
}
|
|
345350
|
+
if (!this.isMergeOnlyObjectSchema(resolvedSchema)) {
|
|
345351
|
+
return false;
|
|
345352
|
+
}
|
|
345353
|
+
const cached2 = this.sharedState.mergeOnlyAllOfSchemas.get(resolvedSchema);
|
|
345354
|
+
if (cached2 != null) {
|
|
345355
|
+
return cached2;
|
|
345356
|
+
}
|
|
345357
|
+
if (visiting.has(resolvedSchema)) {
|
|
345358
|
+
return false;
|
|
345359
|
+
}
|
|
345360
|
+
visiting.add(resolvedSchema);
|
|
345361
|
+
const canGenerateFromMergedAllOf = resolvedSchema.allOf.every((subSchema) => {
|
|
345362
|
+
const resolved = this.context.resolveMaybeReference({
|
|
345363
|
+
schemaOrReference: subSchema,
|
|
345364
|
+
breadcrumbs: this.breadcrumbs,
|
|
345365
|
+
skipErrorCollector: true
|
|
345366
|
+
});
|
|
345367
|
+
if (resolved == null || !this.isMergeOnlyObjectSchema(resolved)) {
|
|
345368
|
+
return false;
|
|
345369
|
+
}
|
|
345370
|
+
return resolved.allOf == null || resolved.allOf.length === 0 ? true : this.canGenerateFromMergedAllOf(resolved, visiting);
|
|
345371
|
+
});
|
|
345372
|
+
visiting.delete(resolvedSchema);
|
|
345373
|
+
this.sharedState.mergeOnlyAllOfSchemas.set(resolvedSchema, canGenerateFromMergedAllOf);
|
|
345374
|
+
return canGenerateFromMergedAllOf;
|
|
345375
|
+
}
|
|
345376
|
+
isMergeOnlyObjectSchema(schema) {
|
|
345377
|
+
if (schema.type != null && schema.type !== "object") {
|
|
345378
|
+
return false;
|
|
345379
|
+
}
|
|
345380
|
+
if (schema.type == null && schema.properties == null && schema.allOf == null) {
|
|
345381
|
+
return false;
|
|
345382
|
+
}
|
|
345383
|
+
return Object.keys(schema).every((key2) => MERGE_ONLY_OBJECT_SCHEMA_FIELDS.has(key2));
|
|
345252
345384
|
}
|
|
345253
345385
|
/**
|
|
345254
345386
|
* Checks if a schema is a "constraint-only" schema that only has validation constraints
|
|
@@ -691017,7 +691149,7 @@ var AccessTokenPosthogManager = class {
|
|
|
691017
691149
|
properties: {
|
|
691018
691150
|
...event,
|
|
691019
691151
|
...event.properties,
|
|
691020
|
-
version: "5.75.
|
|
691152
|
+
version: "5.75.3",
|
|
691021
691153
|
usingAccessToken: true,
|
|
691022
691154
|
...getRunIdProperties()
|
|
691023
691155
|
}
|
|
@@ -691083,7 +691215,7 @@ var UserPosthogManager = class {
|
|
|
691083
691215
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
691084
691216
|
event: "CLI",
|
|
691085
691217
|
properties: {
|
|
691086
|
-
version: "5.75.
|
|
691218
|
+
version: "5.75.3",
|
|
691087
691219
|
...event,
|
|
691088
691220
|
...event.properties,
|
|
691089
691221
|
usingAccessToken: false,
|
|
@@ -872184,7 +872316,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
872184
872316
|
var LOGS_FOLDER_NAME = "logs";
|
|
872185
872317
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
872186
872318
|
function getCliSource() {
|
|
872187
|
-
const version7 = "5.75.
|
|
872319
|
+
const version7 = "5.75.3";
|
|
872188
872320
|
return `cli@${version7}`;
|
|
872189
872321
|
}
|
|
872190
872322
|
var DebugLogger = class {
|
|
@@ -904773,7 +904905,7 @@ var LegacyDocsPublisher = class {
|
|
|
904773
904905
|
previewId,
|
|
904774
904906
|
disableTemplates: void 0,
|
|
904775
904907
|
skipUpload,
|
|
904776
|
-
cliVersion: "5.75.
|
|
904908
|
+
cliVersion: "5.75.3",
|
|
904777
904909
|
loginCommand: "fern auth login"
|
|
904778
904910
|
});
|
|
904779
904911
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -971560,7 +971692,7 @@ function getAutomationContextFromEnv() {
|
|
|
971560
971692
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
971561
971693
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
971562
971694
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
971563
|
-
cli_version: "5.75.
|
|
971695
|
+
cli_version: "5.75.3"
|
|
971564
971696
|
};
|
|
971565
971697
|
}
|
|
971566
971698
|
function isAutomationMode() {
|
|
@@ -972392,7 +972524,7 @@ var CliContext = class _CliContext {
|
|
|
972392
972524
|
if (false) {
|
|
972393
972525
|
this.logger.error("CLI_VERSION is not defined");
|
|
972394
972526
|
}
|
|
972395
|
-
return "5.75.
|
|
972527
|
+
return "5.75.3";
|
|
972396
972528
|
}
|
|
972397
972529
|
getCliName() {
|
|
972398
972530
|
if (false) {
|
package/package.json
CHANGED