vertx-web icon indicating copy to clipboard operation
vertx-web copied to clipboard

Open Api Service - Missing Form Attributes after Vert.x Update

Open webnobis opened this issue 2 years ago • 4 comments

We defined a Yaml Open Api 3.0 like the project description.

Problem

Missing expected form attributes, requests fails.

Reproduction

To reproduce the bug, please use my example project: webnobis-vertx-open-api2

Steps to reproduce

  1. Check out the example project
  2. To test with Vert.x 4.3.2, use the feature branch
  3. To test with Vert.x 4.3.0, use the master
  4. Execute the JUnit test, either with ./gradlew test or within a IDE
  5. Show log outputs

Behavior with Vert.x 4.3.2

After sending form attributes over the generated service, no form attributes exists, the request fails: Junit-Test-Vert.x-4.3.2 ______________Missing form attributes_______________ Unhandled exception in router io.vertx.ext.web.validation.BodyProcessorException: [Bad Request] Validation error for body application/x-www-form-urlencoded: provided object should contain property charset at io.vertx.ext.web.validation.BodyProcessorException.createValidationError(BodyProcessorException.java:64) ~[vertx-web-validation-4.3.2.jar:4.3.2] at io.vertx.ext.web.validation.impl.body.FormBodyProcessorImpl.lambda$process$0(FormBodyProcessorImpl.java:47)

Behavior with Vert.x 4.3.0

If we used Vert.x 4.3.0, the form attributes are available and the request is success: JUnit-Test-Vert.x-4.3.0 ______________Form attributes: id=the-id|content=the real content|charset=UTF-8 BUILD SUCCESSFUL in 1s Log-Output-Implementation

webnobis avatar Jul 20 '22 10:07 webnobis

do you think this might be related to what im seeing? https://github.com/vert-x3/vertx-web/issues/2220 . there doesn't seem to be a lot of throughput on bugs in this repo.

chris-brace avatar Jul 25 '22 16:07 chris-brace

@chris-brace, yes, files fields are also form fields.

I found this days a workaround, to could use newer Vert.x versions also with the form fields: // Overwrite Body handler, because of https://github.com/vert-x3/vertx-web/issues/2238 .map(RouterBuilder::mountServicesFromExtensions) .map(routerBuilder -> routerBuilder.rootHandler(BodyHandler.create())) .map(RouterBuilder::createRouter)

webnobis avatar Jul 26 '22 09:07 webnobis

ooo thank you i will try this when i get some time

chris-brace avatar Aug 01 '22 19:08 chris-brace

@webnobis this fixed it for me

chris-brace avatar Aug 05 '22 21:08 chris-brace