Skip to content

Commit

Permalink
fix seed
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Dec 12, 2024
1 parent 8125bd2 commit d7946a4
Show file tree
Hide file tree
Showing 35 changed files with 361 additions and 291 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,12 @@ export class GeneratedSdkClientClassImpl implements GeneratedSdkClientClass {
const getDefaultEndpointImplementation = ({
response
}: {
response: HttpResponseBody.Json | HttpResponseBody.FileDownload | HttpResponseBody.Text | HttpResponseBody.Bytes | undefined;
response:
| HttpResponseBody.Json
| HttpResponseBody.FileDownload
| HttpResponseBody.Text
| HttpResponseBody.Bytes
| undefined;
}) => {
return new GeneratedDefaultEndpointImplementation({
endpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,15 @@ export class GeneratedDefaultEndpointImplementation implements GeneratedEndpoint
withCredentials: this.includeCredentialsOnCrossOriginRequests
};

let cast: ts.TypeNode | undefined = undefined;

if (this.endpoint.response?.body?.type === "text") {
fetcherArgs.responseType = "text";
}

if (this.endpoint.response?.body?.type === "bytes") {
fetcherArgs.responseType = "arrayBuffer";
cast = ts.factory.createTypeReferenceNode("ArrayBuffer");
}

return [
Expand All @@ -444,7 +447,7 @@ export class GeneratedDefaultEndpointImplementation implements GeneratedEndpoint
undefined,
context.coreUtilities.fetcher.fetcher._invoke(fetcherArgs, {
referenceToFetcher: this.generatedSdkClientClass.getReferenceToFetcher(context),
cast: undefined
cast
})
)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,7 @@ export function getSuccessReturnType(
includeContentHeadersOnResponse: opts.includeContentHeadersOnResponse
});
}
case "fileDownload": {
return getFileType({
targetRuntime: context.targetRuntime,
context,
includeContentHeadersOnResponse: opts.includeContentHeadersOnResponse
});
}
case "bytes":
case "bytes":
return ts.factory.createTypeReferenceNode("ArrayBuffer");
case "json":
return context.type.getReferenceToType(response.value.responseBodyType).typeNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,7 @@ export class GeneratedSdkEndpointTypeSchemasImpl implements GeneratedSdkEndpoint
}

if (this.endpoint.response.body.type === "bytes") {
return ts.factory.createAsExpression(
referenceToRawResponse,
context.type.getReferenceToType(TypeReference.primitive({ v1: PrimitiveTypeV1.String, v2: undefined }))
.typeNode
);
return referenceToRawResponse;
}

if (this.endpoint.response.body.value.responseBodyType.type === "unknown") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export const NoUndefinedTypeReferenceRule: Rule = {
if (parsedBytesType != null) {
if (location === TypeReferenceLocation.RequestReference) {
return [];
} if (location === TypeReferenceLocation.Response) {
}
if (location === TypeReferenceLocation.Response) {
return [];
} else {
return [
Expand Down
6 changes: 6 additions & 0 deletions seed/csharp-model/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions seed/csharp-model/bytes/src/SeedBytes.sln

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/csharp-sdk/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions seed/csharp-sdk/bytes/src/SeedBytes.sln

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions seed/csharp-sdk/bytes/src/SeedBytes/Service/ServiceClient.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/go-fiber/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/go-model/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/go-sdk/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions seed/go-sdk/bytes/service/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/java-model/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/java-sdk/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/openapi/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/php-model/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions seed/php-sdk/bytes/.mock/definition/service.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d7946a4

Please sign in to comment.