json-schema-spec icon indicating copy to clipboard operation
json-schema-spec copied to clipboard

Reverse "contains" <-> "minContains"/"maxContains" dependency

Open handrews opened this issue 2 years ago • 6 comments

Fixes #1311.

handrews avatar Sep 22 '22 20:09 handrews

I think this wording works, but do we want to have minContains & maxContains produce an annotation that is consumed by contains? I understand the "missing keywords can't produce annotations" thing, but that's covered by the current language of assuming a min of 1. Having this annotative communication maintains consistency with how other keywords work.

gregsdennis avatar Sep 22 '22 20:09 gregsdennis

@gregsdennis this wording was intended to specify the behavior in terms of annotations, and then note an alternative (which we do for some other keywords as well). What are you looking for that isn't there? Do you want more explicit discussion of the consumption of annotations in the description of "contains"?

handrews avatar Sep 22 '22 21:09 handrews

I was thinking that minContains and maxContains would actively produce an annotation that would be consumed by contains. This follows the model that we have established with additional* and unevaluated*.

Currently the wording you have for min/max doesn't say anything about annotations. I think this needs to be added.

Essentially, the dependency is on the annotation rather than on the other keyword directly.

gregsdennis avatar Sep 22 '22 22:09 gregsdennis

@gregsdennis

Currently the wording you have for min/max doesn't say anything about annotations. I think this needs to be added.

Lines 2530 and 2544 say:

The value of this keyword is used as its annotation result.

handrews avatar Sep 23 '22 01:09 handrews

Okay, yeah.... I missed that.

gregsdennis avatar Sep 23 '22 01:09 gregsdennis

@gregsdennis no worries, the mentions are very brief! It actually took me a moment to find them again.

handrews avatar Sep 23 '22 02:09 handrews

The force-push just now was to rebase and (more importantly) credit @karenetheridge for first coming up with the idea in the commit log.

handrews avatar Oct 08 '22 19:10 handrews