eclipse-vertx / eclipse-vertx/vertx-json-schema

format is asserted by default under 2019-09/2020-12, contrary to the specification

Open
#160 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
86
Forks
30
PR merge metrics
No merged PRs in 30d

Description

### Version

5.2.0-SNAPSHOT (master), affects 5.x releases as well

### Context

Since draft 2019-09 the specification defines the `format` keyword as an **annotation by default** — invalid values only fail validation when the format-assertion vocabulary/behavior is explicitly enabled. The validator currently asserts formats unconditionally for every draft, which:

- deviates from the 2019-09/2020-12 specification (stricter than spec);
- keeps 34 default-behavior format tests from the official test suite permanently skipped in `unsupported-tck-tests.properties` ("invalid X string is only an annotation by default");
- gives users no way to control the behavior short of pre-processing their schemas.

### Proposal

A `JsonSchemaOptions.setFormatValidation(Boolean)` option:

- unset (default): draft-dependent — formats asserted up to draft-7 (as today), annotation-only from 2019-09 on (spec default);
- `true`: always assert (previous behavior for 2019-09/2020-12 users who rely on it);
- `false`: never assert.

Note this changes default behavior for 2019-09/2020-12 schemas relying on format errors — those users set `formatValidation(true)` to restore it. PR incoming with the option, tests, docs, and the 34 TCK tests un-skipped (the `optional/format` suites now run with assertion explicitly enabled, per the test-suite usage guidance).

Contributor guide

Open the contributing guide

Research direction

Start with JsonSchemaOptions and the current format-validation behavior, then inspect unsupported-tck-tests.properties and the optional/format suites. Implement the draft-dependent default and explicit true/false controls, update tests and documentation, and confirm the 34 default-behavior TCK tests are no longer skipped while optional format tests run with assertion enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.