Skip to content

Commit

Permalink
Merge branch 'main' into niels/fix-typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Swimburger authored Jan 29, 2025
2 parents 52ffbcd + ebb97be commit 873c947
Show file tree
Hide file tree
Showing 242 changed files with 8,997 additions and 65 deletions.
5 changes: 5 additions & 0 deletions generators/typescript/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.48.5] - 2025-01-28

- Fix: Don't double wrap a blob if a user uploads a blob to a multi-part form.
Otherwise file's content-type is lost in Deno.

## [0.48.4] - 2025-01-21

- Fix: When custom config `useBigInt` is `true`, generate examples and snippets with `BigInt("123")`.
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/sdk/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.48.4
0.48.5
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ export class WebFormData implements CrossPlatformFormData {
if (fileName == null && isNamedValue(value)) {
fileName = value.name;
}
if (value instanceof Blob) {
this.fd?.append(key, value, fileName);
return;
}
this.fd?.append(key, new Blob([value]), fileName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { FernOpenapiIr, ResponseWithExample, Source } from "@fern-api/openapi-ir

import { getExtension } from "../../../../getExtension";
import { convertSchema } from "../../../../schema/convertSchemas";
import { convertSchemaWithExampleToSchema } from "../../../../schema/utils/convertSchemaWithExampleToSchema";
import { isReferenceObject } from "../../../../schema/utils/isReferenceObject";
import { AbstractOpenAPIV3ParserContext } from "../../AbstractOpenAPIV3ParserContext";
import { FernOpenAPIExtension } from "../../extensions/fernExtensions";
Expand Down Expand Up @@ -65,7 +64,8 @@ export function convertResponse({
responseBreadcrumbs,
streamFormat,
source,
namespace: context.namespace
namespace: context.namespace,
statusCode: typeof statusCode === "string" ? parseInt(statusCode) : statusCode
});
}
}
Expand Down Expand Up @@ -121,7 +121,8 @@ function convertResolvedResponse({
context,
responseBreadcrumbs,
source,
namespace
namespace,
statusCode
}: {
operationContext: OperationContext;
streamFormat: "sse" | "json" | undefined;
Expand All @@ -130,6 +131,7 @@ function convertResolvedResponse({
responseBreadcrumbs: string[];
source: Source;
namespace: string | undefined;
statusCode?: number;
}): ResponseWithExample | undefined {
const resolvedResponse = isReferenceObject(response) ? context.resolveResponseReference(response) : response;

Expand All @@ -144,7 +146,7 @@ function convertResolvedResponse({
return resolvedSchema.type === "string" && resolvedSchema.format === "binary";
});
if (isDownloadFile) {
return ResponseWithExample.file({ description: resolvedResponse.description, source });
return ResponseWithExample.file({ description: resolvedResponse.description, source, statusCode });
}
}

Expand All @@ -153,6 +155,7 @@ function convertResolvedResponse({
switch (streamFormat) {
case "json":
return ResponseWithExample.streamingJson({
statusCode,
description: resolvedResponse.description,
responseProperty: getExtension<string>(
operationContext.operation,
Expand Down Expand Up @@ -182,7 +185,8 @@ function convertResolvedResponse({
source,
namespace
),
source
source,
statusCode
});
}
}
Expand All @@ -204,7 +208,8 @@ function convertResolvedResponse({
source,
namespace
),
source
source,
statusCode
});
case "sse":
return ResponseWithExample.streamingSse({
Expand All @@ -219,7 +224,8 @@ function convertResolvedResponse({
source,
namespace
),
source
source,
statusCode
});
}
}
Expand All @@ -228,7 +234,8 @@ function convertResolvedResponse({
schema: convertSchema(jsonMediaObject.schema, false, context, responseBreadcrumbs, source, namespace),
responseProperty: getExtension<string>(operationContext.operation, FernOpenAPIExtension.RESPONSE_PROPERTY),
fullExamples: jsonMediaObject.examples,
source
source,
statusCode
});
}

Expand All @@ -245,21 +252,21 @@ function convertResolvedResponse({
mimeType.isImage() ||
mimeType.isVideo()
) {
return ResponseWithExample.file({ description: resolvedResponse.description, source });
return ResponseWithExample.file({ description: resolvedResponse.description, source, statusCode });
}

if (mimeType.isPlainText()) {
const textPlainSchema = mediaObject.schema;
if (textPlainSchema == null) {
return ResponseWithExample.text({ description: resolvedResponse.description, source });
return ResponseWithExample.text({ description: resolvedResponse.description, source, statusCode });
}
const resolvedTextPlainSchema = isReferenceObject(textPlainSchema)
? context.resolveSchemaReference(textPlainSchema)
: textPlainSchema;
if (resolvedTextPlainSchema.type === "string" && resolvedTextPlainSchema.format === "byte") {
return ResponseWithExample.file({ description: resolvedResponse.description, source });
return ResponseWithExample.file({ description: resolvedResponse.description, source, statusCode });
}
return ResponseWithExample.text({ description: resolvedResponse.description, source });
return ResponseWithExample.text({ description: resolvedResponse.description, source, statusCode });
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ types:
},
"response": {
"docs": "OK",
"status-code": 200,
"type": "root.EndUser",
},
"source": {
Expand Down Expand Up @@ -1055,6 +1056,7 @@ types:
},
"response": {
"docs": "OK",
"status-code": 200,
"type": "root.EndUsers",
},
"source": {
Expand Down Expand Up @@ -1151,6 +1153,7 @@ types:
},
"response": {
"docs": "OK",
"status-code": 200,
"type": "root.EndUser",
},
"source": {
Expand Down Expand Up @@ -1215,6 +1218,7 @@ service:
response:
docs: OK
type: root.EndUser
status-code: 200
errors:
- root.GetEndUserByIdRequestUnauthorizedError
- root.GetEndUserByIdRequestNotFoundError
Expand Down Expand Up @@ -1276,6 +1280,7 @@ service:
response:
docs: OK
type: root.EndUser
status-code: 200
errors:
- root.UpdateEndUserByIdRequestBadRequestError
- root.UpdateEndUserByIdRequestUnauthorizedError
Expand Down Expand Up @@ -1351,6 +1356,7 @@ service:
response:
docs: OK
type: root.EndUsers
status-code: 200
errors:
- root.GetEndUsersRequestBadRequestError
- root.GetEndUsersRequestUnauthorizedError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
},
"response": {
"docs": "A simple API response.",
"status-code": 200,
"type": "Response",
},
"source": {
Expand Down Expand Up @@ -94,6 +95,7 @@
response:
docs: A simple API response.
type: Response
status-code: 200
examples:
- request: {}
response:
Expand Down
Loading

0 comments on commit 873c947

Please sign in to comment.