Conversation
| test("should support description for status code mappings with empty output") { | ||
| val expectedYaml = load("oneOf/expected_status_codes_with_empty_output.yaml") | ||
|
|
||
| val e = endpoint.errorOut(sttp.tapir.oneOf(oneOfMapping(StatusCode.Forbidden, EndpointIO.Empty(Codec.idPlain(), EndpointIO.Info.empty).description("forbidden")))) |
There was a problem hiding this comment.
maybe you can use emptyOutput instead of EndpointIO.Empty(Codec.idPlain(), EndpointIO.Info.empty)?
There was a problem hiding this comment.
I already tried but endpointOutput is defined as
val emptyOutput: EndpointOutput[Unit] = EndpointIO.Empty(Codec.idPlain(), EndpointIO.Info.empty)
and it's type doesn't allow to specify description as EndpointIO does, can I change emptyOutput's type to EndpointIO ?
There was a problem hiding this comment.
Ah ... yes, I think returning a more specific type (I think it will need to be even more specific than EndpointIO) is fine
There was a problem hiding this comment.
all the other methods return specific return types
| val entries = f.documentedCodes.keys.map(code => Some(code) -> Vector(f)).toList | ||
| Right(entries) | ||
| case _: EndpointIO.Empty[_] => Left(Vector.empty) | ||
| case e: EndpointIO.Empty[_] => if (e.info.description.nonEmpty) Left(Vector(e)) else Left(Vector.empty) |
There was a problem hiding this comment.
what happens if we remove this special-case entirely? Maybe that case here isn't needed at all, since we already handle this case in EndpointToOperationResponse.scala
There was a problem hiding this comment.
unfortunately when I remove this case entirely then 89 out of 183 tests in openapi-docs fail, would you like me to check why and try to fix them or just leave it as it is?
There was a problem hiding this comment.
Hmm that's weird, yes please check what's going on :)
closes #687