Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where a message has multiple oneof fields #31

Merged
merged 2 commits into from
Jul 23, 2024
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 Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ integration-test-server: tools ## Generates the server dependencies used by the
--grpc-gateway_opt paths=source_relative \
--grpc-gateway_opt generate_unbound_methods=true \
--grpc-gateway_opt logtostderr=true \
--grpc-gateway_opt generate_unbound_methods=true \
--openapiv2_out ./test/integration/tmp/openapiv2 \
--openapiv2_opt logtostderr=true \
--openapiv2_opt use_go_templates=true \
--openapiv2_opt simple_operation_ids=true \
--openapiv2_opt openapi_naming_strategy=fqn \
--openapiv2_opt disable_default_errors=true \
--openapiv2_opt generate_unbound_methods=true \
service.proto msg.proto

.PHONY: tools
Expand Down
4 changes: 2 additions & 2 deletions generator/service.ts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export type {{.Name}} = Base{{.Name}}
{{end -}}
{{fieldName $field.Name}}: {{tsType $field}};
{{- end}}
}>;
{{- end -}}
}>
{{- end -}};

{{/* Standard, non oneof messages */}}

Expand Down
1 change: 0 additions & 1 deletion generator/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func renderURL(r *registry.Registry) func(method data.Method) string {
methodURL += "?" + renderURLSearchParamsFn
}
}

return methodURL
}
}
Expand Down
16 changes: 12 additions & 4 deletions test/integration/noStaticClasses/noStaticClasses_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ import { b64Decode } from "./fetch.pb";

describe("test static functions", () => {
it("unary request", async () => {
const result = await increment({ counter: 199 });
const result = await increment(
{ counter: 199 },
{ pathPrefix: "http://localhost:8081" }
);

expect(result.result).to.equal(200);
});

it("failing unary request", async () => {
try {
await failingIncrement({ counter: 199 });
await failingIncrement(
{ counter: 199 },
{ pathPrefix: "http://localhost:8081" }
);
expect.fail("expected call to throw");
} catch (e) {
expect(e).to.have.property("message", "this increment does not work");
Expand All @@ -27,8 +33,10 @@ describe("test static functions", () => {

it("streaming request", async () => {
const response = [] as number[];
await streamingIncrements({ counter: 1 }, (resp) =>
response.push(resp.result)
await streamingIncrements(
{ counter: 1 },
(resp) => response.push(resp.result),
{ pathPrefix: "http://localhost:8081" }
);
expect(response).to.deep.equal([2, 3, 4, 5, 6]);
});
Expand Down
Loading
Loading