-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
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
httpResponseCode handling (server side) #377
Conversation
case OptionalResponseCode(f) => | ||
OptionalResponseCode { s => f(get(s)) } | ||
} | ||
Contravariant[ResponseCodeExtractor].contramap(aExt)(get) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is a contravariant, there must be a type class for the Optional one, right?
This ensure that the member is excluded from the payload when serializing
exciting |
…nse-code Conflicts: sampleSpecs/pizza.smithy
Let's create a 0.16 feature branch from main, change the target version for MiMA, and target that branch in this PR instead |
modules/core/src/smithy4s/http/internals/HttpResponseCodeSchemaVisitor.scala
Outdated
Show resolved
Hide resolved
will create a branch and target that new branch |
modules/http4s/src/smithy4s/http4s/internals/SmithyHttp4sServerEndpoint.scala
Outdated
Show resolved
Hide resolved
now pointing at |
modules/http4s/src/smithy4s/http4s/internals/SmithyHttp4sServerEndpoint.scala
Outdated
Show resolved
Hide resolved
I would say this is ready to go into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very Nice 🎉
case _ => (_: A) => Metadata.empty | ||
case StructureMetaEncode(f) => { (a: A) => | ||
val struct = f(a) | ||
val statusCode = statusCodeVisitor match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as before: you could extract this pattern matching outside of the scope where A
is known and have a A => Option[Int]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daddykotex, let's tackle client-side after this.
Take the value out of the output structure and use it as the status code of the http response.
Discard this member from the serialized json