VirusTotalNet icon indicating copy to clipboard operation
VirusTotalNet copied to clipboard

Update vert.x template to 4.x

Open pmlopes opened this issue 3 years ago • 3 comments

Signed-off-by: Paulo Lopes [email protected]

Fixes #282

Description

This PR will update the template to:

  • ~~JDK 17 (LTS)~~
  • Vert.x 4.2.4

Motivation and Context

The original template has several limitations and is using a almost unsupported release of Vert.x. The current template allows simple functions but lacks ways to configure features like, safe body parsing, CORS, JWTs...

This new template tries to address the issues as described in the linked issue.

How Has This Been Tested?

A basic unit test is added to the project and docker images built and tested.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Version change (see: Impact to existing users)

Impact to existing users

For existing users, the main function entry signature is changed, so it requires a small change to existing functions.

Old:

public class Handler implements io.vertx.core.Handler<RoutingContext> {

  public void handle(RoutingContext routingContext) {
    // user function body
  }
}

New:

public class OpenFaasFunction implements Function<RoutingContext, Future<JsonObject>> {

    public Future<JsonObject> apply(RoutingContext routingContext) {
      // user function body
    }
}

Checklist:

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I've read the CONTRIBUTION guide
  • [x] I have signed-off my commits with git commit -s
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

pmlopes avatar Mar 02 '22 10:03 pmlopes

@alexellis please have a look at the PR and the discussion about upgrading the template. I believe this PR would make it easier to support all features of vert.x and user customization with a small breaking change.

If you wish to avoid the breaking change, I can adapt the function code itself to be closer to the original.

pmlopes avatar Mar 02 '22 10:03 pmlopes

PR is updated to be fully backwards compatible and docs updated.

pmlopes avatar Mar 02 '22 20:03 pmlopes

Fixes #256

pmlopes avatar Mar 02 '22 21:03 pmlopes