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

Improve validators to ensure more TCK test coverage #81

Open
pmlopes opened this issue Dec 9, 2022 · 2 comments
Open

Improve validators to ensure more TCK test coverage #81

pmlopes opened this issue Dec 9, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@pmlopes
Copy link
Contributor

pmlopes commented Dec 9, 2022

Currently, we skip about 300 tests from the TCK:

https://github.com/eclipse-vertx/vertx-json-schema/blob/master/src/test/resources/unsupported-tck-tests.properties

This is a general purpose issue to track pull request to address the issues. The issues should be considered "good first issue" kind of tasks.

To address an unsupported test, first one needs to understand the test, for example:

draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 29\ days\ in\ February\ (normal)=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 30\ days\ in\ February\ (leap)=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 31\ days\ in\ April=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 31\ days\ in\ June=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 31\ days\ in\ November=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 31\ days\ in\ September=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 32\ days\ in\ August=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 32\ days\ in\ December=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 32\ days\ in\ January=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 32\ days\ in\ July=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 32\ days\ in\ March=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 32\ days\ in\ May=skip
draft2019-09/optional/format/date/validation\ of\ date\ strings/a\ invalid\ date\ string\ with\ 32\ days\ in\ October=skip

shows that the code we have here:

// date: http://tools.ietf.org/html/rfc3339#section-5.6
private static final Pattern FASTDATE = Pattern.compile("^\\d\\d\\d\\d-[0-1]\\d-[0-3]\\d$");
private static boolean testDate(String value) {
return FASTDATE.matcher(value).find();
}

Is actually not fully correct. It does validate that the input follows the right notation but doesn't validate edge cases like mentioned in the case above.

To fix this, that method must be refactored to perform the complete validation, not just the format string.

While this issue can be solved without much thinking, extra attention should be used to verify the performance/thread safety of the implementation as the code can be on the "hot" path of the execution of a vert.x application.

We will be availabe to support new contributors to work on these issues!

@pmlopes pmlopes added enhancement New feature or request good first issue Good for newcomers labels Dec 9, 2022
@douglas-chanwh
Copy link
Contributor

looks interesting. would like to work on it.

@douglas-chanwh
Copy link
Contributor

@pmlopes could you please give me some comments on the PR? many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants