Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _examples/node-ts/server-fastify/server.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const validateType = (value: any, type: string) => {
}


export const JsonEncode = <T = any>(obj: T, _typ: string = ''): string => {
export const JsonEncode = <T = any>(obj: T): string => {
return JSON.stringify(obj)
}

Expand Down
2 changes: 1 addition & 1 deletion _examples/node-ts/server-hono/server.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const validateType = (value: any, type: string) => {
}


export const JsonEncode = <T = any>(obj: T, _typ: string = ''): string => {
export const JsonEncode = <T = any>(obj: T): string => {
return JSON.stringify(obj)
}

Expand Down
2 changes: 1 addition & 1 deletion _examples/node-ts/server/server.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ const validateType = (value: any, type: string) => {
}


export const JsonEncode = <T = any>(obj: T, _typ: string = ''): string => {
export const JsonEncode = <T = any>(obj: T): string => {
return JSON.stringify(obj)
}

Expand Down
6 changes: 3 additions & 3 deletions _examples/node-ts/webapp/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class Example implements ExampleClient {
getUser = (req: GetUserRequest, headers?: object, signal?: AbortSignal): Promise<GetUserResponse> => {
return this.fetch(
this.url('GetUser'),
createHttpRequest(JsonEncode(req, 'GetUserRequest'), headers, signal)).then((res) => {
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return JsonDecode<GetUserResponse>(_data, 'GetUserResponse')
})
Expand All @@ -135,7 +135,7 @@ export class Example implements ExampleClient {
getArticle = (req: GetArticleRequest, headers?: object, signal?: AbortSignal): Promise<GetArticleResponse> => {
return this.fetch(
this.url('GetArticle'),
createHttpRequest(JsonEncode(req, 'GetArticleRequest'), headers, signal)).then((res) => {
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return JsonDecode<GetArticleResponse>(_data, 'GetArticleResponse')
})
Expand Down Expand Up @@ -177,7 +177,7 @@ export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response



export const JsonEncode = <T = any>(obj: T, _typ: string = ''): string => {
export const JsonEncode = <T = any>(obj: T): string => {
return JSON.stringify(obj)
}

Expand Down
6 changes: 3 additions & 3 deletions _examples/sse/webapp/client.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class Chat implements ChatClient {
sendMessage = (req: SendMessageRequest, headers?: object, signal?: AbortSignal): Promise<SendMessageResponse> => {
return this.fetch(
this.url('SendMessage'),
createHttpRequest(JsonEncode(req, 'SendMessageRequest'), headers, signal)).then((res) => {
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return JsonDecode<SendMessageResponse>(_data, 'SendMessageResponse')
})
Expand All @@ -110,7 +110,7 @@ export class Chat implements ChatClient {
}

const _fetch = () => this.fetch(this.url('SubscribeMessages'),
createHttpRequest(JsonEncode(req, 'SubscribeMessagesRequest'), options.headers, abortSignal)
createHttpRequest(JsonEncode(req), options.headers, abortSignal)
).then(async (res) => {
await sseResponse(res, options, _fetch)
}, (error) => {
Expand Down Expand Up @@ -321,7 +321,7 @@ export interface WebrpcStreamController {



export const JsonEncode = <T = any>(obj: T, _typ: string = ''): string => {
export const JsonEncode = <T = any>(obj: T): string => {
return JSON.stringify(obj)
}

Expand Down
2 changes: 1 addition & 1 deletion bigintHelpers.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const JsonDecode = <T = any>(data: string | any, typ: string = ''): T =>
return decodeType(typ, parsed) as T
}
{{- else}}
{{- "\n\n" -}}export const JsonEncode = <T = any>(obj: T, _typ: string = ''): string => {
{{- "\n\n" -}}export const JsonEncode = <T = any>(obj: T): string => {
return JSON.stringify(obj)
}

Expand Down
4 changes: 2 additions & 2 deletions client.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class {{$service.Name}} implements {{$service.Name}}Client {
}

const _fetch = () => this.fetch(this.url('{{.Name}}'),
{{if .Inputs | len }}createHttpRequest(JsonEncode(req, '{{$methodReqName}}'), options.headers, abortSignal){{- else}}createHttpRequest('{}', options.headers, options.signal){{end }}
{{if .Inputs | len }}createHttpRequest(JsonEncode(req), options.headers, abortSignal){{- else}}createHttpRequest('{}', options.headers, options.signal){{end }}
).then(async (res) => {
await sseResponse(res, options, _fetch)
}, (error) => {
Expand All @@ -83,7 +83,7 @@ export class {{$service.Name}} implements {{$service.Name}}Client {
return this.fetch(
this.url('{{.Name}}'),
{{- if .Inputs | len }}
createHttpRequest(JsonEncode(req, '{{$methodReqName}}'), headers, signal)).then((res) => {
createHttpRequest(JsonEncode(req), headers, signal)).then((res) => {
{{- else }}
createHttpRequest('{}', headers, signal)).then((res) => {
{{- end }}
Expand Down
Loading