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

Enable Builder Pattern for TypeSafeMiddleware #1506

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

herzi
Copy link

@herzi herzi commented Jun 14, 2020

This change will allow using the builder pattern with TypeSafeMiddleware.

Description

The builder pattern is a useful way of writing compact code in a functional way. Regular middleware can already utilize this from RouterHTTPVerbs_generated.swift like this:

let router = Router()
  .get("products") { _, _, next in next() }
  .post("products") { _, _, next in next() }

Unfortunately, it's not possible to mix and match with type safe middleware.

Motivation and Context

This change increases consistency within Kitura by allowing to utilize method chaining with type safe middleware just as Kitura permits for regular middlewares.

How Has This Been Tested?

  • This code has been modified by me using Xcode and the changes are pretty obvious.
  • I have – however – updated my master branch to contain both a simple Github Action and the changes from the feature branch. Feel free to check out the results.

Checklist:

  • If applicable, I have updated the documentation accordingly.
  • If applicable, I have added tests to cover my changes.
    • Not sure about this one. I haven't added tests. If you like me to add one or two, just tell me.

@CLAassistant
Copy link

CLAassistant commented Jun 14, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@herzi
Copy link
Author

herzi commented Jun 16, 2020

It looks to me like the Travis CI setup is broken for some configurations:

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.

None yet

3 participants