softwaremill / softwaremill/tapir
happy flow statuscodes 3xx, 4xx, 5xx considered an error?
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.5k
- Forks
- 468
- Avg merge
- 5h 37m
- Merged PRs (30d)
- 34
Description
Tapir version: 1.2.12
Scala version: 2.13.10
A 3xx, 4xx and 5xx status codes are always considered an error when put into the happy flow (.out).
I think all happy flow definitions should be parsed as right-flow, not left. Consider:
..: PublicEndpoint[Unit, Unit, String, Any]
---
.out(statusCode(StatusCode.TemporaryRedirect))
.out(
header[String]("Location").description("Redirect address")
)
I would expect this endpoint definition to do a call and get back a 307 response with a header. I expect the 307 response and everything else I want to consider an error. The openapi spec will correctly list the response as one-of the possible response (including all listed 4xx and 5xx response).
So also:
..: PublicEndpoint[Unit, Unit, String, Any]
---
.out(statusCode(StatusCode.NotFound))
.out(
header[String]("MyCustomHeader").description("Some value")
)
should follow a right-flow when used with tapir clients.
Only when the response does not fit within the right-flow it should go left and attempt decoding using the defined errorOut types.
What do you think?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the two endpoint examples in the issue and trace how Tapir clients classify responses returned by .out for 3xx, 4xx, and 5xx status codes. Compare that behavior with responses decoded through errorOut and verify that the intended right-flow responses, headers, and OpenAPI response listings remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, scala
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100