Skip to content

Reconsider allowing "contains" to apply to objects #1358

Closed
@handrews

Description

@handrews

During yesterday's meeting, I brought up that in the time since we decided to allow "contains" to apply to objects, we've shifted to more of an emphasis on stability.

"contains" was added in draft-06, and while the details of its interactions with "minContains" and "maxContains" (added in 2019-09) have changed, its assertion behavior on its own has not. Allowing these three keywords to apply to objects is a breaking change.

We could instead revert them to apply only to arrays and introduce keywords named something like "containsPropertyValue", "minContainsPropertyValue", "maxContainsPropertyValue" alongside them. I'll let others sort out the ideal names. "containsProperty" might be fine but also feels a bit like it is talking about property names rather than values. Another option could be "hasValue" or "hasPropertyValue" or something of that sort. All of the name options are less aesthetically appealing than having "contains" work on objects, but they'd preserve more stability.

I don't have an incredibly strong opinion on this, but it seemed to get some traction in the call so I thought I'd file it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions