Repository navigation
Conversation
|
Review of this PR. The core change looks correct: I ran a scratch probe on the PR branch and 1. Policy error contradicts the annotation ( 2. Shared cause left unfixed ( 3. Weak "disabled" test ( 4. Coverage gaps (test file, around line 95) 5. Duplication ( 🤖 Generated with Claude Code |
4ac08c7 to
01b2bd1
Compare
|
Thanks for the detailed read — all five points are addressed on head 1. Policy error now reads the keyword value. Both validators raise the error only when 2. Root cause fixed in 3. The "disabled" test is no longer vacuous. It now pairs 4. Coverage added. Draft 7 root schemas for both keywords (true and false), a nested property asserting both 5. Duplication removed. The collection block lives once in Evidence: focused Deliberately left alone: the vendored Not run: the JDK 21/25 CI legs ( |
|
Thanks for the update. I re-reviewed head 1. Policy semantics narrowed ( 2. 3. Vacuous non-boolean tests (test, ~line 190) 4. 5. Thin tests for the shared helper 6. Structure ( 🤖 Generated with Claude Code |
01b2bd1 to
5018c00
Compare
|
All six are addressed on head You were right and my previous reply was wrong. I described the policies as having "one correction" without owning that the correction changed their semantics: asserting only on boolean if (Boolean.TRUE.equals(policy) && !isKeywordValueFalse()) { ... }So the only behaviour change against upstream is the one the first review asked for — a boolean 2. Same-run coverage. 3. Vacuous tests. Removed. 4. By-reference widening. Documented at the mapping, including that the object/array node is the schema's own and must not be mutated, and pinned with 5. Helper tests. Moved to 6. Structure. The mapping is now Evidence on exactly the pushed content: focused One thing I found but did not fix, because it is a separate pre-existing bug and this PR is single-topic: |
|
Thanks for the update. I re-reviewed head 1. CHANGELOG 2. Name clash ( 3. Placement ( 4. Divergence with 5. Tests 🤖 Generated with Claude Code |
5018c00 to
1e88fe5
Compare
|
All five are addressed on head 1. CHANGELOG. Added an 2. Name clash. You were right that the two overloads ended up on one type: 3. Placement. Fixed by the same change, and I agree the old javadoc was misleading. 4.
Matching them exactly means 5. Tests. The duplicated helpers are now Evidence on exactly Not run: the JDK 21/25 CI legs; only JDK 17.0.11 locally. |
|
Review of head 1. Unknown and root keywords now annotate bool/array/null ( 2. CHANGELOG 3. Policy rule diverges from 4. JSON null is reported as a 5. Annotations expose the schema's own mutable node ( 6. New 7. Policy change filed under 8. 9. Value mapping and false check recomputed on every 10. No OpenAPI 3.0 test for the policy or the |
1e88fe5 to
b09e513
Compare
|
All ten addressed on head 1. Unknown and root keywords, and the generic type. Agreed, and kept deliberately: the vendored annotation suite has 2. The contradiction. Fixed. The old 3. 4. JSON null. Kept as the node, and now stated as contract instead of happening implicitly. The alternatives are worse: returning the Java null makes an annotation whose value is null indistinguishable from a keyword that produced no annotation, and returning a 5. Mutation of the schema. Fixed, and thank you for pushing on this: object, array and null values are now a 6. 7. README. Updated, rows 590-591 now state that a 8. Duplication. Removed: one 9. Recomputing on every 10. Tests. Added: the OpenAPI 3.0 dialect for both keywords with and without the Evidence on exactly |
|
Review of head 1. 2. The required path still throws, and the reply says it does not ( 3. The compatibility rationale for 4. The 5. Error built eagerly on every call ( 6. Breaking and Fixed entries overlap; null is not copied ( |
b09e513 to
06e7171
Compare
|
All six addressed on head 1. Same hardware, same probe, same 2001 annotated locations in both — so the copies are still made, they are just made once. The copy is now built on the first collection by the validator and held in a 2. The required path. You are right and my sentence was wrong: 3. 4. The 5. The eagerly built error. Changed to 6. CHANGELOG. The Evidence on |
|
Review of head 1. The held copy is shared by every validation ( 2. 3. The mutation test never validates twice ( 4. CHANGELOG ( 5. Dead branch and indirection ( 6. Extra field on every validator ( 7. |
06e7171 to
bee897c
Compare
|
All seven are addressed on 1. The held copy is shared. You were right, and I reproduced it: with 2. required and the policy. 3. Tests. The mutation test validates twice. The required tests cover the present instance ( 4. CHANGELOG. The 5. Dead branch and indirection. Removed: 6. Extra field on every validator. Removed with the cache. 7. Verification on this head: full One consequence to be explicit about: the copy-per-annotation cost you measured in the previous round is back for object- and array-valued annotations. To have each annotation's value be independent there is nothing cheaper available in this Jackson version. If you would rather keep the single copy and accept that callers share one mutable node, say so and I will restore the cache and describe the sharing instead of claiming it away. |
|
Review of head 1. Per-annotation 2. 3. The rule is coded twice ( 4. 5. Dead indirection ( 6. Stale Javadoc ( 7. Tests ( |
bee897c to
cf8d6ff
Compare
|
All seven are addressed on
Evidence on exactly |
|
Review of head 1. 2. 3. Eager lookups ( 4. Stale test comments ( 5. Stale Javadoc ( 6. Test duplication ( 7. 8. Annotation suite not run ( 9. CHANGELOG entry length ( |
cf8d6ff to
321dc73
Compare
|
Addressed on
Evidence on exactly |
|
Review of head 1. PR description contradicts the code ( 2. 3. README and 4. Dialect claims only partly tested ( 5. Stale test comment ( 6. Test Javadocs claim more than the tests assert (
7. Redundant tests ( 8. Repeated policy test in |
321dc73 to
fcd6d0e
Compare
|
Addressed on
Verification on |
|
Review of head 1. 2. 3. No test that one policy ignores the other keyword ( 4. 5. Builder setters still undocumented ( |
fcd6d0e to
35258e8
Compare
|
All five points are done on
Verification on |
|
Review of head 1. 2. The policy paragraph is pasted six times ( 3. |
35258e8 to
712f46c
Compare
|
All three are addressed on
Verification on
|
|
Review of head 1. Unknown-keyword booleans now satisfy
This fails open, and a reporting option changes the validation outcome. The unevaluated validators need to ignore annotations from 2. The policy note says any declaration exempts from 3. The 4. No test that collection on/off keeps the validation result ( 5. Resolve the property keywords once ( 6. Overload pair ( 7. The lazy lookup is untested 8. Setter Javadoc ( 9. Test class Javadoc ( 🤖 Generated with Claude Code |
712f46c to
3b33aa5
Compare
|
All nine points are addressed on
Verification on
|
|
Review of head 1. Document-container root fields still fail open (
2. A custom unknown-keyword factory still fails open ( 3. Mark the kind of annotation, not where it came from ( 4. 5. On/off test coverage ( 6. Mostly-null maps per |
3b33aa5 to
305c72b
Compare
|
All six points are addressed on
Verification on
|
|
Review of head
One minor point,
Not blocking. Looks good to merge from my side. |
readOnly and writeOnly are annotation keywords in draft 7 and later, but the two validators only implemented the execution policies that turn them into assertions, so with annotation collection enabled they reported nothing while deprecated, default and the other meta-data keywords appeared in the output. The cause was the mapping from a keyword's schema node to the annotation value: it handled only strings, numbers and objects, so the boolean value of readOnly and writeOnly, arrays such as examples and null values were dropped for every annotation keyword. The mapping is a private static method on AbstractKeywordValidator now, next to putSchemaNodeAnnotation, and covers every JSON type. Strings, numbers and booleans are unwrapped to their Java type; an object, an array and a JSON null are reported as the schema's own node, which must be treated as read-only, because a copy per annotation retains memory proportional to the annotated locations times the node size and a single shared copy is mutated by the first caller. Annotation.getValue() is generic and its value type is wider than before, so existing code such as String s = annotation.getValue() still compiles but can throw ClassCastException for a value that is not a string; the CHANGELOG lists that under Breaking changes. The execution policies now skip the error when the keyword value is the boolean false, because it contradicts the annotation reported for the same value, and still assert for true and for every non-boolean value. required uses the same rule: a property whose schema declares readOnly or writeOnly that the policy asserts for is not reported as missing, so required and the policy cannot make both the absent and the present instance invalid. Only a declaration directly on the property schema is seen, $ref and allOf are not resolved, and the dialect is not consulted, which means Draft 4 and 6 exempt too; tests pin both limits. The README rows, ExecutionConfig.getReadOnly()/getWriteOnly(), doc/error-reference.md and the CHANGELOG are updated. The annotation test suite vendored at src/test/suite/annotations/tests is not executed by the build; the new tests exercise the same cases through the public API. Annotations collected from a schema node are now marked as such. The unevaluatedItems and unevaluatedProperties validators ignore them, so an annotation keyword that shares a name with an applicator, such as an unknown keyword, a root field of a document container, a keyword a dialect registers as an AnnotationKeyword, or readOnly and writeOnly, cannot change the validation result when annotation collection is enabled. This fixes the two remaining fail-open paths: document-container root fields and custom unknown-keyword factories. RequiredValidator keeps getFieldKeyword as a deprecated protected hook, called once at construction, and stores only the declared nodes. Assisted-By: DeepSeek dsv41 Signed-off-by: simpleqt <2015900818@qq.com>
305c72b to
1badac1
Compare
|
Updated the minor point on head
Focused 51/0, full |
Review of #1376Reviewed at head Fix before merge1.
Before this PR the hook ran at validation time, after the validators had loaded. The CHANGELOG warns about subclass state but not about the recursion. Suggested fix: build the two maps lazily on the first Existing bug this PR leaves in place2. A required The {"required":["a"],"properties":{"a":{"$ref":"#/$defs/R"}},"$defs":{"R":{"readOnly":true}}}
No instance passes. The same happens with Minor
|
What this changes
readOnlyandwriteOnlyare annotation keywords in draft 7 and later, and their two validators only implemented the execution policies that turn them into assertions. With annotation collection enabled they reported nothing, whiledeprecated,defaultand the other meta-data keywords appeared in the output.The shared mapping from a keyword's schema node to its annotation value handled only strings, numbers and objects, so booleans, arrays and null were dropped for every annotation keyword: for
{"deprecated":true,"default":false,"examples":[1],"title":"t","readOnly":true}onlytitlewas reported. It now handles every JSON type. Strings, numbers and booleans are unwrapped to their Java type; an object, an array and a JSON null are reported as the schema's own node, not as a copy, and must be treated as read-only. A copy per annotation retains memory proportional to the annotated locations times the size of the node, and a single shared copy is mutated by the first caller.Annotation.getValue()is generic, so the value type existing code can receive is wider; that is underBreaking changesin the CHANGELOG, and the Javadoc ofgetValue()now states the contract.The execution policies change in one way: the error is skipped when the keyword value is the boolean
false, because it contradicts the annotation reported for the same value. This applies whether collection is on or off;trueand every non-boolean value still assert, so nothing that was accepted before is now rejected. Both validators shareReadOnlyWriteOnlyPolicyand build the error only when the policy is in force and asserts.requiredasks the same rule: a property whose schema declaresreadOnly/writeOnlythat the policy would assert for is not reported as missing, so required and the policy cannot make both the absent and the present instance invalid. Only a declaration directly on the property schema is seen ($refandallOfare not resolved), and the dialect is not consulted, so Draft 4 and 6 exempt too; both limits are pinned by tests. The README rows,ExecutionConfig.getReadOnly()/getWriteOnly(),doc/error-reference.mdand the CHANGELOG are updated.Unknown keywords that are treated as annotations can share a name with an applicator keyword in another dialect, for example
additionalItemsin 2020-12 orcontainsin Draft 4. Such an annotation now carries anunknownKeywordflag and theunevaluatedItemsandunevaluatedPropertiesvalidators ignore it, so enabling annotation collection cannot change the validation outcome. The flag is set only byUnknownKeywordFactory; the annotation keywords the dialect defines keep their annotations.Tests
ReadOnlyWriteOnlyAnnotationTest(31) covers both keywords as annotations at the root, in Draft 7, on a nested property, with collection disabled and filtered out, the policy error and the annotation in the same run, the OpenAPI 3.0 and 3.1 policies, therequiredinteraction for the absent and the present instance including non-boolean and null values, both policies enabled at once,falsenot asserting under its policy, and non-boolean and null values still asserting.AnnotationKeywordTest(13) covers the mapping through the public API: the typegetValue()returns for each JSON value type, the node identity of object, array and null values, booleancontentSchema, unknown keywords, and the Draft 4, Draft 6, OpenAPI 3.0 and 3.1 keywords.UnevaluatedItemsValidatorTest(4) covers the two cross-dialect unknown-keyword cases from the review: a 2019-09 root whose 2020-12$refdeclares the unknownadditionalItems, and a 2020-12 root whose Draft 4$refdeclares the unknowncontains. Each case asserts that the error list is identical with annotation collection off and withk -> true, and that the uncollected result has two errors.Verification
AnnotationKeywordTest,ReadOnlyWriteOnlyAnnotationTest,UnevaluatedItemsValidatorTest: 51 tests, 0 failures, 0 errors, 0 skippedmvn -B -o teston this head: 11182 tests, 0 failures, 0 errors, 47 skipped, on JDK 17.0.11 onlyjavadoc:javadoc: BUILD SUCCESSaction_required(fork approval gate), so these numbers are local only