microsoft / microsoft/typespec

Revisist the `@defaultResponse` decorator

Open
#2,485 1 comment 0 reactions 0 assignees View on GitHub
design:needed triaged:core
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

This decorator is in openapi and now with the addition of status code ranges it feels a lot less useful.

The problem with this decorator is that it changes the meaning of the operation response from openapi point of view but not from the http library.

So you have this weird thing there one user of the http library would get a different behavior than openapi3

If this is a feature we still want, what if it is just when the status code is an int but has no range
```
@error model ServerError {
@statusCode @minValue(500) @maxValue(599) _: int32;
}

@error model Default {
@statusCode _: int32;
}
op test(): Pet | ServerError | Default;
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.