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

Feat: Add BodyEncoder and BodyDecoder #29

Merged
merged 4 commits into from
Aug 24, 2018
Merged

Feat: Add BodyEncoder and BodyDecoder #29

merged 4 commits into from
Aug 24, 2018

Conversation

Andrew-Lees11
Copy link
Contributor

This pull requests adds two protocols BodyEncoder and BodyDecoder and extends Query and JSON encoders/decoders to conform to them. These will be used in Kitura for custom enoders/decoders.

This depends on pr 28 which adds an encode to and decode from data to Query encoder and decoder.

A class that conforms to `BodyDecoder` must be able to decode from `Data` into a `Codable` type.
This class can then be used to produce input objects for a Codable route.
*/
public protocol BodyDecoder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If conformances to this protocol must be classes, then define it as public protocol BodyDecoder: AnyObject {}

A class that conforms to `BodyEncoder` must be able to encode a `Codable` type into `Data`.
This class can then be used to produce output objects for a Codable route.
*/
public protocol BodyEncoder {
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.

@ianpartridge ianpartridge merged commit 8e41f3f into master Aug 24, 2018
@ianpartridge ianpartridge deleted the customCoder branch August 24, 2018 14:15
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.

2 participants