vert-x3 / vertx-web

HTTP web applications for Vert.x
Apache License 2.0
1.11k stars 532 forks source link

Bug Report: Deprecated SchemaParser Interface in ValidationHandlerBuilder's create Method (vertx-web 4.4.3) #2437

Open codabat opened 1 year ago

codabat commented 1 year ago

Hello,

I would like to report a bug in the vertx-web 4.4.3 repository related to the ValidationHandlerBuilder class.

Issue: The issue pertains to the deprecated SchemaParser interface being used as a parameter in the create method of ValidationHandlerBuilder. Although the create method itself is not deprecated, it still relies on the deprecated SchemaParser interface.

Expected Behavior: It is expected that a non-deprecated method or alternative approach should be provided for instantiating a ValidationHandlerBuilder without depending on the deprecated SchemaParser interface.

Steps to Reproduce:

  1. Set up the vertx-web 4.4.3 environment.
  2. Attempt to instantiate a ValidationHandlerBuilder using the create method.
  3. Observe the usage of the deprecated SchemaParser interface.

Actual Result: The create method requires a SchemaParser instance, which is marked as deprecated, causing concerns regarding the compatibility and recommended practices.

Expected Result: A suitable replacement or updated approach should be available for creating instances of ValidationHandlerBuilder without reliance on the deprecated SchemaParser interface.

Additional Information: Version: vertx-web 4.4.3

Please let me know if any further details are required or if there are specific guidelines to follow for bug reporting in this project.

Thank you for your attention to this matter.

Kind regards, Lorenzo

tsegismont commented 1 year ago

@pk-work can you take a look please?

SchemaParser has been deprecated and we need to adapt the Vert.x Web Validation handler to this.

pk-work commented 1 year ago

@tsegismont I had a look and I think I have an approach to use the new vertx-json-schema validator, but it looks like I need to change

static ValidationHandlerBuilder create(SchemaParser parser)

into

static ValidationHandlerBuilder create(SchemaRepository repo)

and it is not possible to have both signatures at the same time. The effort would be very high.

pk-work commented 1 year ago

I've pushed my approach [1], but for some reason it cannot compile, I always get this exception:

io.vertx.docgen.DocGenException: Could not resolve io.vertx.ext.web.validation.builder.ValidationHandlerBuilder#create(SchemaParser)

I've search the whole package, but can't find an place which could result into this error...

Maybe you can have a look

[1] https://github.com/pk-work/vertx-web/tree/4_4_web_validation_replace_deprecated

pk-work commented 1 year ago

I've pushed now a new version: https://github.com/pk-work/vertx-web/tree/4_4_web_validation_replace_deprecated

It supports the new and the old signature (see above).

But two test cases (schema with circular refs) are failing.

tsegismont commented 1 year ago

@pk-work would you mind creating a PR or draft to ease the review?

pk-work commented 1 year ago

@tsegismont of course, I just saw that I only pushed it to my fork.

https://github.com/vert-x3/vertx-web/pull/2445