We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ListMap
When decoding MediaType without examples, circe issues an error:
MediaType
examples
DecodingFailure at ./url.post.parameters.examples: Missing required field
A better alternative would be to use ListMap.empty. The implementation in https://github.com/softwaremill/sttp-apispec/blob/master/openapi-circe/src/main/scala/sttp/apispec/openapi/internal/InternalSttpOpenAPICirceDecoders.scala#L61:
ListMap.empty
implicit val mediaTypeDecoder: Decoder[MediaType] = withExtensions(deriveDecoder[MediaType])
is a bit too simple. It seems that we'd better use something like https://github.com/softwaremill/sttp-apispec/blob/master/openapi-circe/src/main/scala/sttp/apispec/openapi/internal/InternalSttpOpenAPICirceDecoders.scala#L65:
implicit val responseDecoder: Decoder[Response] = { implicit def listMapDecoder[A: Decoder]: Decoder[ListMap[String, ReferenceOr[A]]] = Decoder.decodeOption(Decoder.decodeMapLike[String, ReferenceOr[A], ListMap]).map(_.getOrElse(ListMap.empty)) implicit def listMapMediaTypeDecoder: Decoder[ListMap[String, MediaType]] = Decoder.decodeOption(Decoder.decodeMapLike[String, MediaType, ListMap]).map(_.getOrElse(ListMap.empty)) withExtensions(deriveDecoder[Response]) }
The text was updated successfully, but these errors were encountered:
@Primetalk Yes, decoding might have some holes. Maybe you'd like to attempt creating a PR to fix this? :)
Sorry, something went wrong.
softwaremill#136 Decode ListMap[String, MediaType|Encoding|String|Ref…
bbe1a06
…erence[A]]
softwaremill#136 Fix server.extensions
7e4e02d
@adamw Could you take a look #138 ?
Successfully merging a pull request may close this issue.
When decoding
MediaType
withoutexamples
, circe issues an error:A better alternative would be to use
ListMap.empty
.The implementation in https://github.com/softwaremill/sttp-apispec/blob/master/openapi-circe/src/main/scala/sttp/apispec/openapi/internal/InternalSttpOpenAPICirceDecoders.scala#L61:
is a bit too simple. It seems that we'd better use something like https://github.com/softwaremill/sttp-apispec/blob/master/openapi-circe/src/main/scala/sttp/apispec/openapi/internal/InternalSttpOpenAPICirceDecoders.scala#L65:
The text was updated successfully, but these errors were encountered: