Skip to content

Feat: Add BodyEncoder and BodyDecoder#29

Merged
ianpartridge merged 4 commits intomasterfrom
customCoder
Aug 24, 2018
Merged

Feat: Add BodyEncoder and BodyDecoder#29
ianpartridge merged 4 commits intomasterfrom
customCoder

Conversation

@Andrew-Lees11
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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