ts-proto
ts-proto copied to clipboard
feat(plugin): optional fields for oneof properties
addresses issue #548
I think it might be worthwhile to add a simple test that only instantiates an object of a type with one-of fields, and omits a field.
If we ever break this feature, the TS file won't compile.
for example, in oneof-properties-tests:
it('allows omitting fields', () => {
let msg: PleaseChoose = {
name: 'foo',
}
});
Hi @Larkooo, very strong work!
This can be super useful.
Are you planning to continue working on it?
Just ran into this issue today. Anything I can do to help get the PR merged?
@scott-lc yeah, would be great if you wanted to pick this up; just scanning the PR, I think the issues would be to:
a) See the PR comment about running yarn proto2bin to hopefully remove all of the *.bin files as changed files in the PR
b) Remove the yarn-error.log from the PR
c) Rebase the PR onto the latest main
d) Update one of the integration-tests/* projects to have a schema that reproduces the issue and has a test case that shows the codegen output continues to work as you expect; i.e. @boukeversteegh had suggested this has a starting place:
https://github.com/stephenh/ts-proto/blob/8769ef2ad01d53edc2d373201afeab8ca7403885/integration/oneof-properties/oneof-properties-test.ts
Thanks!