[ask] Will we recommand discriminated union compared with general union?
Open
lib:azure-core
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 156
Description
Say we have a following spec, the operation would have a union response, for `Foo | Bar` some emitters may not serialize them easily without a discriminator property so they may fallback to binary data.
In that case does the TypeSpec would more recommand [discriminated union](https://typespec.io/docs/standard-library/discriminated-types#implementing-unions) compared with general union?
```
model Foo {
foz: string;
}
model Bar {
baz: string;
}
op test(): Foo | Bar;
```
Contributor guide
Assessment
This issue has not been assessed yet.