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. |
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
|
1badac1 to
d60c246
Compare
|
Addressed on
Local verification on
|
Re-review of #1376Reviewed at head One problem comes from the new Fix before merge1. LIST and HIERARCHICAL output now keep one copy of a container value per annotation (
Probe on JDK 25:
This is the per-annotation retention that the Suggested fix: in Minor
|
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 stored as the schema's own node, 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() returns a fresh copy of a container or null value, so a caller cannot mutate the cached schema. 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. schemaNodeAnnotation records where the value came from rather than which annotation it is, so Annotation.equals() and hashCode() ignore it. 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. The two maps are built on the first validation, after the parent schema has installed its validators, so an override may resolve a reference and read its own state; the result is cached for later validations. Assisted-By: DeepSeek dsv41 Signed-off-by: simpleqt <2015900818@qq.com> Review follow-up: OutputUnitData now shares one copy of each distinct schema-node container across output units through an identity-keyed cache, so LIST and HIERARCHICAL output no longer retain one copy per annotation. getValue() only copies values marked schemaNodeAnnotation, so a container a custom keyword computes and reports through putAnnotation is returned as that validator built it. The getFieldKeyword deprecation tag now says the hook is called for each required property and keyword on the first validation.
d60c246 to
b0ed3d6
Compare
|
Updated on
Evidence: focused |
Code review (head
|
What this changes
readOnlyandwriteOnlyare annotation keywords in draft 7 and later, but 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. 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 stored as the schema's own node, keeping memory flat per annotated location, and
Annotation.getValue()returns a fresh copy so a caller cannot mutate the cached schema. The wider value type of the genericgetValue()is underBreaking changesin the CHANGELOG.Annotation.equals()andhashCode()ignore the newschemaNodeAnnotationflag, because it records where the value came from rather than which annotation it is.Annotations collected from a schema node are marked with
Annotation.isSchemaNodeAnnotation().unevaluatedItemsandunevaluatedPropertiesignore those annotations, so an annotation keyword that shares a name with an applicator cannot change the validation result when collection is enabled. This covers unknown keywords, root fields of a document container, a keyword a dialect registers as anAnnotationKeyword, andreadOnly/writeOnly.The execution policies skip the error when the keyword value is the boolean
false, because it contradicts the annotation reported for the same value.trueand every non-boolean value still assert.requiredasks the same rule: a property whose schema declaresreadOnly/writeOnlythat the policy would assert for is not reported as missing. Only a declaration directly on the property schema is seen;$refandallOfare not resolved, and the dialect is not consulted. Both limits are documented and pinned by tests; the cross-$refexemption is a pre-existing limitation, unchanged here.RequiredValidator.getFieldKeywordremains a deprecated protected hook, but the two maps are built on the first validation, after the parent schema has installed its validators, so an override may resolve a reference and read its own state. A test registers such an override and validates through it.The README rows,
ExecutionConfig.getReadOnly()/getWriteOnly(),doc/error-reference.mdand the CHANGELOG are updated.Tests
AnnotationKeywordTestcovers the value mapping through the public API, including object/array copies, null, booleancontentSchema, unknown keywords and the Draft 4, Draft 6 and OpenAPI keywords.ReadOnlyWriteOnlyAnnotationTestcovers both keywords as annotations, collection on/off/filtered, policy errors, the OpenAPI dialects, therequiredinteraction, and an override ofgetFieldKeywordthat callsgetParentSchema().getValidators()and reads subclass state.UnevaluatedItemsValidatorTestcovers unknown keywords, a document-container root field and a registeredAnnotationKeyword.UnevaluatedPropertiesValidatorTestcovers a schema-node annotation whose keyword ispropertiesand whose value is aSet, which is the case that only the flag keeps from suppressing anunevaluatedPropertieserror.Verification
AnnotationKeywordTest,ReadOnlyWriteOnlyAnnotationTest,UnevaluatedItemsValidatorTest,UnevaluatedPropertiesValidatorTest: 57 tests, 0 failures, 0 errors, 0 skippedmvn -B -o teston this head: 11183 tests, 0 failures, 0 errors, 47 skipped, JDK 17.0.11mvn -B -o -DskipTests javadoc:javadoc: BUILD SUCCESS