@fern-api/fern-api-dev 4.62.3-3-g2870783b556 → 4.62.3-4-gc085443a514
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 +168 -6
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -588535,7 +588535,7 @@ var RequestBodyConverter = class extends converters_exports.AbstractConverters.A
|
|
|
588535
588535
|
contentType
|
|
588536
588536
|
});
|
|
588537
588537
|
if (convertedSchema == null) {
|
|
588538
|
-
return
|
|
588538
|
+
return this.handleSchemalessJsonContent({ contentType, mediaTypeObject });
|
|
588539
588539
|
}
|
|
588540
588540
|
const requestBodyTypeShape = convertedSchema.schema?.typeDeclaration.shape;
|
|
588541
588541
|
if (requestBodyTypeShape?.type === "object") {
|
|
@@ -588591,6 +588591,55 @@ var RequestBodyConverter = class extends converters_exports.AbstractConverters.A
|
|
|
588591
588591
|
};
|
|
588592
588592
|
}
|
|
588593
588593
|
}
|
|
588594
|
+
/**
|
|
588595
|
+
* Handles JSON request bodies that have no schema but DO have native OpenAPI
|
|
588596
|
+
* examples. Creates an unknown-typed reference request body so that examples
|
|
588597
|
+
* are preserved for docs rendering and code snippet generation.
|
|
588598
|
+
*/
|
|
588599
|
+
handleSchemalessJsonContent({ contentType, mediaTypeObject }) {
|
|
588600
|
+
const hasExamples = mediaTypeObject.example != null || mediaTypeObject.examples != null && Object.keys(mediaTypeObject.examples).length > 0;
|
|
588601
|
+
if (!hasExamples) {
|
|
588602
|
+
return void 0;
|
|
588603
|
+
}
|
|
588604
|
+
const v2Examples = {
|
|
588605
|
+
userSpecifiedExamples: {},
|
|
588606
|
+
autogeneratedExamples: {}
|
|
588607
|
+
};
|
|
588608
|
+
const examples = this.context.getNamedExamplesFromMediaTypeObject({
|
|
588609
|
+
mediaTypeObject,
|
|
588610
|
+
breadcrumbs: this.breadcrumbs,
|
|
588611
|
+
defaultExampleName: `${[...this.group, this.method].join("_")}_example`
|
|
588612
|
+
});
|
|
588613
|
+
const usedExampleNames = /* @__PURE__ */ new Set();
|
|
588614
|
+
for (const [key2, example] of examples) {
|
|
588615
|
+
const resolvedExample = this.context.resolveExampleWithValue(example);
|
|
588616
|
+
const resolvedExampleObject = this.context.resolveExampleRecursively({
|
|
588617
|
+
example,
|
|
588618
|
+
breadcrumbs: this.breadcrumbs
|
|
588619
|
+
});
|
|
588620
|
+
let exampleName = key2;
|
|
588621
|
+
if (this.context.isExampleWithSummary(resolvedExampleObject)) {
|
|
588622
|
+
const summary = resolvedExampleObject.summary;
|
|
588623
|
+
if (!usedExampleNames.has(summary)) {
|
|
588624
|
+
exampleName = summary;
|
|
588625
|
+
}
|
|
588626
|
+
}
|
|
588627
|
+
usedExampleNames.add(exampleName);
|
|
588628
|
+
if (resolvedExample != null) {
|
|
588629
|
+
v2Examples.userSpecifiedExamples[exampleName] = resolvedExample;
|
|
588630
|
+
}
|
|
588631
|
+
}
|
|
588632
|
+
return {
|
|
588633
|
+
requestBody: HttpRequestBody.reference({
|
|
588634
|
+
contentType,
|
|
588635
|
+
docs: this.description,
|
|
588636
|
+
requestBodyType: TypeReference2.unknown(),
|
|
588637
|
+
v2Examples
|
|
588638
|
+
}),
|
|
588639
|
+
streamRequestBody: void 0,
|
|
588640
|
+
inlinedTypes: {}
|
|
588641
|
+
};
|
|
588642
|
+
}
|
|
588594
588643
|
handleMultipartContent({ contentType }) {
|
|
588595
588644
|
const mediaTypeObject = this.mediaType;
|
|
588596
588645
|
if (mediaTypeObject == null || mediaTypeObject.schema == null) {
|
|
@@ -590440,6 +590489,18 @@ var OperationConverter = class _OperationConverter extends AbstractOperationConv
|
|
|
590440
590489
|
httpMethod,
|
|
590441
590490
|
baseUrl
|
|
590442
590491
|
});
|
|
590492
|
+
if (Object.keys(fernExamples.examples).length === 0 && Object.keys(fernExamples.streamExamples).length === 0) {
|
|
590493
|
+
const nativeExamples = this.synthesizeEndpointExamplesFromNativeRequestBody({
|
|
590494
|
+
httpPath: path97,
|
|
590495
|
+
httpMethod,
|
|
590496
|
+
baseUrl
|
|
590497
|
+
});
|
|
590498
|
+
if (nativeExamples != null) {
|
|
590499
|
+
for (const [name2, example] of Object.entries(nativeExamples)) {
|
|
590500
|
+
fernExamples.examples[name2] = example;
|
|
590501
|
+
}
|
|
590502
|
+
}
|
|
590503
|
+
}
|
|
590443
590504
|
const endpointLevelSecuritySchemes = new Set(this.operation.security?.flatMap((securityRequirement) => Object.keys(securityRequirement)) ?? []);
|
|
590444
590505
|
const securityHeaders = this.authSchemeToHeaders(Array.from(endpointLevelSecuritySchemes));
|
|
590445
590506
|
if (securityHeaders.length > 0) {
|
|
@@ -590876,6 +590937,107 @@ var OperationConverter = class _OperationConverter extends AbstractOperationConv
|
|
|
590876
590937
|
streamExamples: {}
|
|
590877
590938
|
};
|
|
590878
590939
|
}
|
|
590940
|
+
/**
|
|
590941
|
+
* Synthesizes endpoint-level v2Examples from native OpenAPI request body
|
|
590942
|
+
* examples (mediaType.example / mediaType.examples) when no x-fern-examples
|
|
590943
|
+
* or x-code-samples extensions are present.
|
|
590944
|
+
*
|
|
590945
|
+
* This ensures that specs like Close's, which have native examples on
|
|
590946
|
+
* schemaless request bodies, get rendered in docs and code snippets.
|
|
590947
|
+
*
|
|
590948
|
+
* Also extracts native response examples from the operation's successful (2xx)
|
|
590949
|
+
* responses so that the 200 response panel is preserved in docs.
|
|
590950
|
+
*/
|
|
590951
|
+
synthesizeEndpointExamplesFromNativeRequestBody({ httpPath, httpMethod, baseUrl }) {
|
|
590952
|
+
if (this.operation.requestBody == null) {
|
|
590953
|
+
return void 0;
|
|
590954
|
+
}
|
|
590955
|
+
const resolvedRequestBody = this.context.resolveMaybeReference({
|
|
590956
|
+
schemaOrReference: this.operation.requestBody,
|
|
590957
|
+
breadcrumbs: [...this.breadcrumbs, "requestBody"]
|
|
590958
|
+
});
|
|
590959
|
+
if (resolvedRequestBody == null) {
|
|
590960
|
+
return void 0;
|
|
590961
|
+
}
|
|
590962
|
+
const responseExample = this.extractNativeResponseExample();
|
|
590963
|
+
const result = {};
|
|
590964
|
+
for (const [, mediaType] of Object.entries(resolvedRequestBody.content)) {
|
|
590965
|
+
if (mediaType.schema != null) {
|
|
590966
|
+
continue;
|
|
590967
|
+
}
|
|
590968
|
+
const namedExamples = this.context.getNamedExamplesFromMediaTypeObject({
|
|
590969
|
+
mediaTypeObject: mediaType,
|
|
590970
|
+
breadcrumbs: [...this.breadcrumbs, "requestBody"],
|
|
590971
|
+
defaultExampleName: "Example"
|
|
590972
|
+
});
|
|
590973
|
+
for (const [name2, example] of namedExamples) {
|
|
590974
|
+
const resolvedValue = this.context.resolveExampleWithValue(example);
|
|
590975
|
+
if (resolvedValue != null) {
|
|
590976
|
+
result[name2] = {
|
|
590977
|
+
displayName: void 0,
|
|
590978
|
+
request: {
|
|
590979
|
+
docs: void 0,
|
|
590980
|
+
endpoint: {
|
|
590981
|
+
method: httpMethod,
|
|
590982
|
+
path: this.buildExamplePath(httpPath, {})
|
|
590983
|
+
},
|
|
590984
|
+
baseUrl: void 0,
|
|
590985
|
+
environment: baseUrl,
|
|
590986
|
+
auth: void 0,
|
|
590987
|
+
pathParameters: {},
|
|
590988
|
+
queryParameters: {},
|
|
590989
|
+
headers: {},
|
|
590990
|
+
requestBody: resolvedValue
|
|
590991
|
+
},
|
|
590992
|
+
response: responseExample,
|
|
590993
|
+
codeSamples: void 0
|
|
590994
|
+
};
|
|
590995
|
+
}
|
|
590996
|
+
}
|
|
590997
|
+
}
|
|
590998
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
590999
|
+
}
|
|
591000
|
+
/**
|
|
591001
|
+
* Extracts the first native example from the operation's successful (2xx) response.
|
|
591002
|
+
* This is used to populate the response body in synthesized endpoint examples
|
|
591003
|
+
* so that the 200 response panel is preserved in docs.
|
|
591004
|
+
*/
|
|
591005
|
+
extractNativeResponseExample() {
|
|
591006
|
+
if (this.operation.responses == null) {
|
|
591007
|
+
return void 0;
|
|
591008
|
+
}
|
|
591009
|
+
for (const [statusCode, response] of Object.entries(this.operation.responses)) {
|
|
591010
|
+
const statusCodeNum = parseInt(statusCode);
|
|
591011
|
+
if (isNaN(statusCodeNum) || statusCodeNum < 200 || statusCodeNum >= 300) {
|
|
591012
|
+
continue;
|
|
591013
|
+
}
|
|
591014
|
+
const resolvedResponse = this.context.resolveMaybeReference({
|
|
591015
|
+
schemaOrReference: response,
|
|
591016
|
+
breadcrumbs: [...this.breadcrumbs, "responses", statusCode]
|
|
591017
|
+
});
|
|
591018
|
+
if (resolvedResponse?.content == null) {
|
|
591019
|
+
continue;
|
|
591020
|
+
}
|
|
591021
|
+
for (const [, responseMediaType] of Object.entries(resolvedResponse.content)) {
|
|
591022
|
+
const namedExamples = this.context.getNamedExamplesFromMediaTypeObject({
|
|
591023
|
+
mediaTypeObject: responseMediaType,
|
|
591024
|
+
breadcrumbs: [...this.breadcrumbs, "responses", statusCode],
|
|
591025
|
+
defaultExampleName: "Example"
|
|
591026
|
+
});
|
|
591027
|
+
for (const [, example] of namedExamples) {
|
|
591028
|
+
const resolvedValue = this.context.resolveExampleWithValue(example);
|
|
591029
|
+
if (resolvedValue != null) {
|
|
591030
|
+
return {
|
|
591031
|
+
docs: void 0,
|
|
591032
|
+
statusCode: statusCodeNum,
|
|
591033
|
+
body: api_exports.V2HttpEndpointResponseBody.json(resolvedValue)
|
|
591034
|
+
};
|
|
591035
|
+
}
|
|
591036
|
+
}
|
|
591037
|
+
}
|
|
591038
|
+
}
|
|
591039
|
+
return void 0;
|
|
591040
|
+
}
|
|
590879
591041
|
convertStreamConditionExamples({ httpPath, httpMethod, baseUrl, fernExamples }) {
|
|
590880
591042
|
const filteredJsonExamples = fernExamples.filter((example) => !(example.response != null && "stream" in example.response));
|
|
590881
591043
|
const filteredStreamExamples = fernExamples.filter((example) => example.response != null && "stream" in example.response);
|
|
@@ -602754,7 +602916,7 @@ var AccessTokenPosthogManager = class {
|
|
|
602754
602916
|
properties: {
|
|
602755
602917
|
...event,
|
|
602756
602918
|
...event.properties,
|
|
602757
|
-
version: "4.62.3-
|
|
602919
|
+
version: "4.62.3-4-gc085443a514",
|
|
602758
602920
|
usingAccessToken: true
|
|
602759
602921
|
}
|
|
602760
602922
|
});
|
|
@@ -602805,7 +602967,7 @@ var UserPosthogManager = class {
|
|
|
602805
602967
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
602806
602968
|
event: "CLI",
|
|
602807
602969
|
properties: {
|
|
602808
|
-
version: "4.62.3-
|
|
602970
|
+
version: "4.62.3-4-gc085443a514",
|
|
602809
602971
|
...event,
|
|
602810
602972
|
...event.properties,
|
|
602811
602973
|
usingAccessToken: false,
|
|
@@ -840101,7 +840263,7 @@ var import_path54 = __toESM(require("path"), 1);
|
|
|
840101
840263
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
840102
840264
|
var LOGS_FOLDER_NAME = "logs";
|
|
840103
840265
|
function getCliSource() {
|
|
840104
|
-
const version7 = "4.62.3-
|
|
840266
|
+
const version7 = "4.62.3-4-gc085443a514";
|
|
840105
840267
|
return `cli@${version7}`;
|
|
840106
840268
|
}
|
|
840107
840269
|
var DebugLogger = class {
|
|
@@ -851209,7 +851371,7 @@ var LegacyDocsPublisher = class {
|
|
|
851209
851371
|
previewId,
|
|
851210
851372
|
disableTemplates: void 0,
|
|
851211
851373
|
skipUpload,
|
|
851212
|
-
cliVersion: "4.62.3-
|
|
851374
|
+
cliVersion: "4.62.3-4-gc085443a514"
|
|
851213
851375
|
});
|
|
851214
851376
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
851215
851377
|
return { success: false };
|
|
@@ -924509,7 +924671,7 @@ var CliContext = class {
|
|
|
924509
924671
|
if (false) {
|
|
924510
924672
|
this.logger.error("CLI_VERSION is not defined");
|
|
924511
924673
|
}
|
|
924512
|
-
return "4.62.3-
|
|
924674
|
+
return "4.62.3-4-gc085443a514";
|
|
924513
924675
|
}
|
|
924514
924676
|
getCliName() {
|
|
924515
924677
|
if (false) {
|
package/package.json
CHANGED