microsoft / microsoft/typespec
Nullable response have a weird behavior right now
Open
design:needed
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
```cadl
import "@typespec/http";
using TypeSpec.Http;
@error
model Error {
message: string;
}
@route("/1") op read1(): string | null;
@route("/2") op read3(): string | null | Error;
```
[Playground link](https://cadlplayground.z22.web.core.windows.net/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7Cgp1c2luZyBUeXBlU3BlYy5IdHRwOwoKQGVycm9yCm1vZGVsIEXEDCB7CiAgbWVzc2FnZTogc3RyaW5nOwp9CgpAcm91dGUoIi8xIikgb3AgcmVhZDEoKcgkIHwgbnVsbDvKKDLKKDPRKCB8xm87Cg%3D%3D&e=@typespec/openapi3&options=%7B%7D)
Resulting is a `204` no content before PR #355 which remove ignore `null` responses.
Feel like it should be making the string body nullable
Contributor guide
Assessment
This issue has not been assessed yet.