@fern-api/fern-api-dev 5.91.0 → 5.92.0
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 +62 -18
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -130864,6 +130864,7 @@ var init_OpenApiSettingsSchema2 = __esm({
|
|
|
130864
130864
|
"respect-readonly-schemas": schemas_exports8.boolean().optional(),
|
|
130865
130865
|
"use-read-variant-for-responses": schemas_exports8.boolean().optional(),
|
|
130866
130866
|
"respect-forward-compatible-enums": schemas_exports8.boolean().optional(),
|
|
130867
|
+
"respect-optional-request-body": schemas_exports8.boolean().optional(),
|
|
130867
130868
|
"use-bytes-for-binary-response": schemas_exports8.boolean().optional(),
|
|
130868
130869
|
"default-form-parameter-encoding": FormParameterEncoding2.optional(),
|
|
130869
130870
|
filter: OpenApiFilterSchema.optional(),
|
|
@@ -132397,6 +132398,7 @@ var init_ConvertOpenAPIOptions = __esm({
|
|
|
132397
132398
|
respectNullableSchemas: true,
|
|
132398
132399
|
onlyIncludeReferencedSchemas: false,
|
|
132399
132400
|
inlinePathParameters: true,
|
|
132401
|
+
respectOptionalRequestBody: false,
|
|
132400
132402
|
useBytesForBinaryResponse: false,
|
|
132401
132403
|
respectForwardCompatibleEnums: false,
|
|
132402
132404
|
wrapReferencesToNullableInOptional: false,
|
|
@@ -147143,6 +147145,12 @@ function getRequest({ endpoint: endpoint3, declarationFile, context: context3, r
|
|
|
147143
147145
|
requestValue.docs = request7.description;
|
|
147144
147146
|
}
|
|
147145
147147
|
const canCollapse = typeof requestValue.body === "string" && requestValue["path-parameters"] == null && requestValue["query-parameters"] == null && requestValue.headers == null && requestValue.name == null && requestValue.docs == null && (requestValue["content-type"] == null || requestValue["content-type"] === "application/json");
|
|
147148
|
+
if (context3.options.respectOptionalRequestBody && isOptionalJsonBody(request7)) {
|
|
147149
|
+
requestValue.body = typeof requestTypeReference === "string" ? wrapTypeReferenceInOptional(requestTypeReference) : {
|
|
147150
|
+
...requestTypeReference,
|
|
147151
|
+
type: wrapTypeReferenceInOptional(requestTypeReference.type)
|
|
147152
|
+
};
|
|
147153
|
+
}
|
|
147146
147154
|
return {
|
|
147147
147155
|
schemaIdsToExclude: [],
|
|
147148
147156
|
value: canCollapse ? requestValue.body : requestValue
|
|
@@ -147299,7 +147307,7 @@ function getRequest({ endpoint: endpoint3, declarationFile, context: context3, r
|
|
|
147299
147307
|
if (request7.additionalProperties) {
|
|
147300
147308
|
requestBodySchema["extra-properties"] = true;
|
|
147301
147309
|
}
|
|
147302
|
-
if (request7
|
|
147310
|
+
if (isOptionalJsonBody(request7)) {
|
|
147303
147311
|
requestBodySchema.optional = true;
|
|
147304
147312
|
}
|
|
147305
147313
|
const convertedRequestValue = {
|
|
@@ -147398,6 +147406,12 @@ function getRequest({ endpoint: endpoint3, declarationFile, context: context3, r
|
|
|
147398
147406
|
assertNever(request7);
|
|
147399
147407
|
}
|
|
147400
147408
|
}
|
|
147409
|
+
function isOptionalJsonBody(request7) {
|
|
147410
|
+
return request7.type === "json" && request7.required !== true;
|
|
147411
|
+
}
|
|
147412
|
+
function wrapTypeReferenceInOptional(typeReference2) {
|
|
147413
|
+
return typeReference2.startsWith("optional<") ? typeReference2 : `optional<${typeReference2}>`;
|
|
147414
|
+
}
|
|
147401
147415
|
function endpointRequestSupportsInlinedPathParameters({ context: context3, request: request7 }) {
|
|
147402
147416
|
if (!context3.options.inlinePathParameters) {
|
|
147403
147417
|
return false;
|
|
@@ -151775,6 +151789,7 @@ var init_BaseOpenAPIWorkspace = __esm({
|
|
|
151775
151789
|
exampleGeneration;
|
|
151776
151790
|
useBytesForBinaryResponse;
|
|
151777
151791
|
respectForwardCompatibleEnums;
|
|
151792
|
+
respectOptionalRequestBody;
|
|
151778
151793
|
inlineAllOfSchemas;
|
|
151779
151794
|
resolveAliases;
|
|
151780
151795
|
groupEnvironmentsByHost;
|
|
@@ -151799,6 +151814,7 @@ var init_BaseOpenAPIWorkspace = __esm({
|
|
|
151799
151814
|
this.exampleGeneration = args.exampleGeneration;
|
|
151800
151815
|
this.useBytesForBinaryResponse = args.useBytesForBinaryResponse;
|
|
151801
151816
|
this.respectForwardCompatibleEnums = args.respectForwardCompatibleEnums;
|
|
151817
|
+
this.respectOptionalRequestBody = args.respectOptionalRequestBody;
|
|
151802
151818
|
this.inlineAllOfSchemas = args.inlineAllOfSchemas;
|
|
151803
151819
|
this.resolveAliases = args.resolveAliases;
|
|
151804
151820
|
this.groupEnvironmentsByHost = args.groupEnvironmentsByHost;
|
|
@@ -167249,6 +167265,7 @@ function getRequestBody2({ context: context3, operation, streamingExtension, isS
|
|
|
167249
167265
|
};
|
|
167250
167266
|
return {
|
|
167251
167267
|
requestBody: {
|
|
167268
|
+
required: resolvedRequestBody.required,
|
|
167252
167269
|
content: {
|
|
167253
167270
|
[MediaType.APPLICATION_JSON]: {
|
|
167254
167271
|
schema: requestBodySchemaWithLiteralProperty
|
|
@@ -199882,6 +199899,7 @@ var init_getAPIDefinitionSettings = __esm({
|
|
|
199882
199899
|
inlinePathParameters: "inlinePathParameters",
|
|
199883
199900
|
useBytesForBinaryResponse: "useBytesForBinaryResponse",
|
|
199884
199901
|
respectForwardCompatibleEnums: "respectForwardCompatibleEnums",
|
|
199902
|
+
respectOptionalRequestBody: "respectOptionalRequestBody",
|
|
199885
199903
|
filter: "filter",
|
|
199886
199904
|
defaultFormParameterEncoding: "defaultFormParameterEncoding",
|
|
199887
199905
|
exampleGeneration: "exampleGeneration",
|
|
@@ -264186,6 +264204,7 @@ function parseOpenApiDefinitionSettingsSchema(settings) {
|
|
|
264186
264204
|
defaultFormParameterEncoding: settings?.["default-form-parameter-encoding"],
|
|
264187
264205
|
useBytesForBinaryResponse: settings?.["use-bytes-for-binary-response"],
|
|
264188
264206
|
respectForwardCompatibleEnums: settings?.["respect-forward-compatible-enums"],
|
|
264207
|
+
respectOptionalRequestBody: settings?.["respect-optional-request-body"],
|
|
264189
264208
|
additionalPropertiesDefaultsTo: settings?.["additional-properties-defaults-to"],
|
|
264190
264209
|
typeDatesAsStrings: settings?.["type-dates-as-strings"],
|
|
264191
264210
|
preserveSingleSchemaOneOf: settings?.["preserve-single-schema-oneof"],
|
|
@@ -265042,6 +265061,7 @@ var init_convertGeneratorsConfiguration = __esm({
|
|
|
265042
265061
|
inlinePathParameters: void 0,
|
|
265043
265062
|
useBytesForBinaryResponse: void 0,
|
|
265044
265063
|
respectForwardCompatibleEnums: void 0,
|
|
265064
|
+
respectOptionalRequestBody: void 0,
|
|
265045
265065
|
filter: void 0,
|
|
265046
265066
|
exampleGeneration: void 0,
|
|
265047
265067
|
defaultFormParameterEncoding: void 0,
|
|
@@ -275421,6 +275441,10 @@ function convertHeaders({ service, endpoint: endpoint3, example, typeResolver, e
|
|
|
275421
275441
|
serviceHeaders
|
|
275422
275442
|
};
|
|
275423
275443
|
}
|
|
275444
|
+
function isOptionalType({ rawType, typeResolver, file: file4 }) {
|
|
275445
|
+
const resolvedType = typeResolver.resolveType({ type: rawType, file: file4 });
|
|
275446
|
+
return resolvedType?._type === "container" && resolvedType.container._type === "optional";
|
|
275447
|
+
}
|
|
275424
275448
|
function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver, exampleResolver, file: file4, workspace }) {
|
|
275425
275449
|
const requestType = typeof endpoint3.request !== "string" ? endpoint3.request?.body : endpoint3.request;
|
|
275426
275450
|
if (requestType == null) {
|
|
@@ -275430,9 +275454,13 @@ function convertExampleRequestBody({ endpoint: endpoint3, example, typeResolver,
|
|
|
275430
275454
|
return void 0;
|
|
275431
275455
|
}
|
|
275432
275456
|
if (!isInlineRequestBody(requestType)) {
|
|
275457
|
+
const rawTypeBeingExemplified = typeof requestType !== "string" ? requestType.type : requestType;
|
|
275458
|
+
if (example.request === void 0 && isOptionalType({ rawType: rawTypeBeingExemplified, typeResolver, file: file4 })) {
|
|
275459
|
+
return void 0;
|
|
275460
|
+
}
|
|
275433
275461
|
return ExampleRequestBody.reference(convertTypeReferenceExample({
|
|
275434
275462
|
example: example.request,
|
|
275435
|
-
rawTypeBeingExemplified
|
|
275463
|
+
rawTypeBeingExemplified,
|
|
275436
275464
|
typeResolver,
|
|
275437
275465
|
exampleResolver,
|
|
275438
275466
|
fileContainingRawTypeReference: file4,
|
|
@@ -372145,6 +372173,7 @@ var init_OSSWorkspace = __esm({
|
|
|
372145
372173
|
objectQueryParameters: collapseSpecBooleanSetting(specs, (s5) => s5?.objectQueryParameters),
|
|
372146
372174
|
useBytesForBinaryResponse: collapseSpecBooleanSetting(openapiSpecs, (s5) => s5?.useBytesForBinaryResponse),
|
|
372147
372175
|
respectForwardCompatibleEnums: collapseSpecBooleanSetting(openapiSpecs, (s5) => s5?.respectForwardCompatibleEnums),
|
|
372176
|
+
respectOptionalRequestBody: collapseSpecBooleanSetting(openapiSpecs, (s5) => s5?.respectOptionalRequestBody),
|
|
372148
372177
|
inlineAllOfSchemas: collapseSpecBooleanSetting(specs, (s5) => s5?.inlineAllOfSchemas),
|
|
372149
372178
|
resolveAliases: (() => {
|
|
372150
372179
|
const values2 = specs.map((spec) => spec.settings?.resolveAliases);
|
|
@@ -690038,6 +690067,10 @@ function validateExampleEndpointCallParameters({ allDeclarations = {}, examples,
|
|
|
690038
690067
|
// ../fern-definition/validator/lib/rules/valid-example-endpoint-call/validateRequest.js
|
|
690039
690068
|
init_lib10();
|
|
690040
690069
|
init_lib23();
|
|
690070
|
+
var REQUIRED_REQUEST_BODY_VIOLATION = {
|
|
690071
|
+
severity: "fatal",
|
|
690072
|
+
message: "This endpoint requires a request body, so its examples must specify request. Mark the body optional to allow calling the endpoint without one."
|
|
690073
|
+
};
|
|
690041
690074
|
function validateRequest({ example, endpoint: endpoint3, typeResolver, exampleResolver, file: file4, workspace }) {
|
|
690042
690075
|
const violations = [];
|
|
690043
690076
|
const body = typeof endpoint3.request !== "string" ? endpoint3.request?.body : endpoint3.request;
|
|
@@ -690049,14 +690082,11 @@ function validateRequest({ example, endpoint: endpoint3, typeResolver, exampleRe
|
|
|
690049
690082
|
});
|
|
690050
690083
|
}
|
|
690051
690084
|
} else if (isInlineRequestBody(body)) {
|
|
690052
|
-
if (example
|
|
690085
|
+
if (example === void 0) {
|
|
690053
690086
|
if (body.optional) {
|
|
690054
690087
|
return violations;
|
|
690055
690088
|
}
|
|
690056
|
-
violations.push(
|
|
690057
|
-
severity: "fatal",
|
|
690058
|
-
message: "This endpoint requires a request body, so its examples must specify request. Mark the body optional to allow calling the endpoint without one."
|
|
690059
|
-
});
|
|
690089
|
+
violations.push(REQUIRED_REQUEST_BODY_VIOLATION);
|
|
690060
690090
|
return violations;
|
|
690061
690091
|
}
|
|
690062
690092
|
violations.push(...examples_exports6.validateObjectExample({
|
|
@@ -690078,7 +690108,7 @@ function validateRequest({ example, endpoint: endpoint3, typeResolver, exampleRe
|
|
|
690078
690108
|
return { severity: val.severity ?? "fatal", message: val.message };
|
|
690079
690109
|
}));
|
|
690080
690110
|
} else {
|
|
690081
|
-
|
|
690111
|
+
const bodyViolations = examples_exports6.validateTypeReferenceExample({
|
|
690082
690112
|
rawTypeReference: typeof body === "string" ? body : body.type,
|
|
690083
690113
|
example,
|
|
690084
690114
|
file: file4,
|
|
@@ -690089,7 +690119,12 @@ function validateRequest({ example, endpoint: endpoint3, typeResolver, exampleRe
|
|
|
690089
690119
|
depth: 0
|
|
690090
690120
|
}).map((val) => {
|
|
690091
690121
|
return { severity: val.severity ?? "fatal", message: val.message };
|
|
690092
|
-
})
|
|
690122
|
+
});
|
|
690123
|
+
if (example === void 0 && bodyViolations.length > 0) {
|
|
690124
|
+
violations.push(REQUIRED_REQUEST_BODY_VIOLATION);
|
|
690125
|
+
return violations;
|
|
690126
|
+
}
|
|
690127
|
+
violations.push(...bodyViolations);
|
|
690093
690128
|
}
|
|
690094
690129
|
return violations;
|
|
690095
690130
|
}
|
|
@@ -693977,6 +694012,8 @@ var OpenApiSettingsSchema2 = BaseApiSettingsSchema2.extend({
|
|
|
693977
694012
|
useReadVariantForResponses: external_exports.boolean().optional(),
|
|
693978
694013
|
/** Enables respecting forward compatible enums in OpenAPI specifications. Defaults to false. */
|
|
693979
694014
|
respectForwardCompatibleEnums: external_exports.boolean().optional(),
|
|
694015
|
+
/** Enables making a JSON request body that OpenAPI does not mark as required optional in the generated SDK, so callers may omit the body. Defaults to false. */
|
|
694016
|
+
respectOptionalRequestBody: external_exports.boolean().optional(),
|
|
693980
694017
|
/** Enables using the `bytes` type for binary responses in OpenAPI specifications. Defaults to a file stream. */
|
|
693981
694018
|
useBytesForBinaryResponse: external_exports.boolean().optional(),
|
|
693982
694019
|
/** The default encoding of form parameters. Defaults to JSON. */
|
|
@@ -702636,7 +702673,7 @@ var AccessTokenPosthogManager = class {
|
|
|
702636
702673
|
properties: {
|
|
702637
702674
|
...event,
|
|
702638
702675
|
...event.properties,
|
|
702639
|
-
version: "5.
|
|
702676
|
+
version: "5.92.0",
|
|
702640
702677
|
usingAccessToken: true,
|
|
702641
702678
|
...getRunIdProperties()
|
|
702642
702679
|
}
|
|
@@ -702702,7 +702739,7 @@ var UserPosthogManager = class {
|
|
|
702702
702739
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
702703
702740
|
event: "CLI",
|
|
702704
702741
|
properties: {
|
|
702705
|
-
version: "5.
|
|
702742
|
+
version: "5.92.0",
|
|
702706
702743
|
...event,
|
|
702707
702744
|
...event.properties,
|
|
702708
702745
|
usingAccessToken: false,
|
|
@@ -709502,6 +709539,7 @@ var LegacyApiSpecAdapter = class {
|
|
|
709502
709539
|
shouldUseUndiscriminatedUnionsWithLiterals: settings.preferUndiscriminatedUnionsWithLiterals,
|
|
709503
709540
|
objectQueryParameters: settings.objectQueryParameters,
|
|
709504
709541
|
respectForwardCompatibleEnums: settings.respectForwardCompatibleEnums,
|
|
709542
|
+
respectOptionalRequestBody: settings.respectOptionalRequestBody,
|
|
709505
709543
|
useBytesForBinaryResponse: settings.useBytesForBinaryResponse,
|
|
709506
709544
|
defaultFormParameterEncoding: settings.defaultFormParameterEncoding,
|
|
709507
709545
|
filter: settings.filter,
|
|
@@ -881950,6 +881988,7 @@ var SETTINGS_KEY_MAP = {
|
|
|
881950
881988
|
"respect-readonly-schemas": "respectReadonlySchemas",
|
|
881951
881989
|
"use-read-variant-for-responses": "useReadVariantForResponses",
|
|
881952
881990
|
"respect-forward-compatible-enums": "respectForwardCompatibleEnums",
|
|
881991
|
+
"respect-optional-request-body": "respectOptionalRequestBody",
|
|
881953
881992
|
"use-bytes-for-binary-response": "useBytesForBinaryResponse",
|
|
881954
881993
|
"default-form-parameter-encoding": "defaultFormParameterEncoding",
|
|
881955
881994
|
"example-generation": "exampleGeneration",
|
|
@@ -883866,7 +883905,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
883866
883905
|
var LOGS_FOLDER_NAME = "logs";
|
|
883867
883906
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
883868
883907
|
function getCliSource() {
|
|
883869
|
-
const version7 = "5.
|
|
883908
|
+
const version7 = "5.92.0";
|
|
883870
883909
|
return `cli@${version7}`;
|
|
883871
883910
|
}
|
|
883872
883911
|
var DebugLogger = class {
|
|
@@ -909182,7 +909221,7 @@ var LegacyDocsPublisher = class {
|
|
|
909182
909221
|
previewId,
|
|
909183
909222
|
disableTemplates: void 0,
|
|
909184
909223
|
skipUpload,
|
|
909185
|
-
cliVersion: "5.
|
|
909224
|
+
cliVersion: "5.92.0",
|
|
909186
909225
|
loginCommand: "fern auth login"
|
|
909187
909226
|
});
|
|
909188
909227
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -961708,7 +961747,10 @@ var EndpointSnippetGenerator9 = class {
|
|
|
961708
961747
|
this.context.errors.unscope();
|
|
961709
961748
|
this.context.errors.scope(Scope4.RequestBody);
|
|
961710
961749
|
if (request7.body != null) {
|
|
961711
|
-
|
|
961750
|
+
const bodyArg = this.getBodyRequestArg({ body: request7.body, value: snippet.requestBody });
|
|
961751
|
+
if (!typescript_exports.TypeLiteral.isNop(bodyArg)) {
|
|
961752
|
+
args.push(bodyArg);
|
|
961753
|
+
}
|
|
961712
961754
|
}
|
|
961713
961755
|
this.context.errors.unscope();
|
|
961714
961756
|
return args;
|
|
@@ -961831,8 +961873,10 @@ var EndpointSnippetGenerator9 = class {
|
|
|
961831
961873
|
switch (body.type) {
|
|
961832
961874
|
case "properties":
|
|
961833
961875
|
return this.getInlinedRequestBodyPropertyObjectFields({ parameters: body.value, value: value2 });
|
|
961834
|
-
case "referenced":
|
|
961835
|
-
|
|
961876
|
+
case "referenced": {
|
|
961877
|
+
const field5 = this.getReferencedRequestBodyPropertyObjectField({ body, value: value2 });
|
|
961878
|
+
return typescript_exports.TypeLiteral.isNop(field5.value) ? [] : [field5];
|
|
961879
|
+
}
|
|
961836
961880
|
case "fileUpload":
|
|
961837
961881
|
return this.getFileUploadRequestBodyObjectFields({ filePropertyInfo });
|
|
961838
961882
|
default:
|
|
@@ -976091,7 +976135,7 @@ function getAutomationContextFromEnv() {
|
|
|
976091
976135
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
976092
976136
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
976093
976137
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
976094
|
-
cli_version: "5.
|
|
976138
|
+
cli_version: "5.92.0"
|
|
976095
976139
|
};
|
|
976096
976140
|
}
|
|
976097
976141
|
function isAutomationMode() {
|
|
@@ -976923,7 +976967,7 @@ var CliContext = class _CliContext {
|
|
|
976923
976967
|
if (false) {
|
|
976924
976968
|
this.logger.error("CLI_VERSION is not defined");
|
|
976925
976969
|
}
|
|
976926
|
-
return "5.
|
|
976970
|
+
return "5.92.0";
|
|
976927
976971
|
}
|
|
976928
976972
|
getCliName() {
|
|
976929
976973
|
if (false) {
|
package/package.json
CHANGED