Skip to content
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

Merged
merged 22 commits into from
Aug 30, 2022
Merged

Conversation

daddykotex
Copy link
Contributor

@daddykotex daddykotex commented Aug 17, 2022

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

@daddykotex daddykotex marked this pull request as draft August 17, 2022 20:35
case OptionalResponseCode(f) =>
OptionalResponseCode { s => f(get(s)) }
}
Contravariant[ResponseCodeExtractor].contramap(aExt)(get)
Copy link
Contributor Author

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?

@daddykotex daddykotex marked this pull request as ready for review August 18, 2022 19:12
@daddykotex daddykotex changed the title Part 1 of httpResponseCode handling httpResponseCode handling Aug 23, 2022
@QinMing
Copy link

QinMing commented Aug 24, 2022

exciting

…nse-code

 Conflicts:
	sampleSpecs/pizza.smithy
@Baccata
Copy link
Contributor

Baccata commented Aug 29, 2022

Let's create a 0.16 feature branch from main, change the target version for MiMA, and target that branch in this PR instead

@daddykotex
Copy link
Contributor Author

will create a branch and target that new branch

@daddykotex daddykotex changed the base branch from main to 0.16.0 August 29, 2022 19:01
@daddykotex
Copy link
Contributor Author

now pointing at 0.16.0, ideally, #417 would be merged first and synced here before we merge.

@daddykotex
Copy link
Contributor Author

I would say this is ready to go into 0.16.0 if everything is green on the last push

Copy link
Contributor

@lewisjkl lewisjkl left a 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 {
Copy link
Contributor

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].

@Baccata Baccata changed the title httpResponseCode handling httpResponseCode handling (server side) Aug 30, 2022
Copy link
Contributor

@Baccata Baccata left a 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.

@Baccata Baccata merged commit 17d0e13 into 0.16.0 Aug 30, 2022
@Baccata Baccata deleted the dfrancoeur/http-response-code branch August 30, 2022 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants