Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge includes and contains to contains #1896

Open
jcamiel opened this issue Sep 6, 2023 · 1 comment
Open

Merge includes and contains to contains #1896

jcamiel opened this issue Sep 6, 2023 · 1 comment
Labels
enhancement New feature or request topic: predicates
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Sep 6, 2023

includes tests if a value is included in a collection, while contains test if a string/byte array is contained in a string/byte array.
We could merge the two predicates an only use contains to simplify the grammar (see https://hurl.dev/docs/asserting-response.html#predicates)

@jcamiel jcamiel added the enhancement New feature or request label Sep 6, 2023
@ens-scmeeu
Copy link

ens-scmeeu commented Sep 8, 2023

While I do like this idea, one reason to NOT to do it (just brainstorming) might be to make contains behave as an inner string/byte array search regardless of type and keep includes as equality in an array/object. For example, you could have this array:

[ "abc", "foobar", "def" ]

...or this object:

{ "abc": true, "foobar": "bar", "def": 123 }

...and these asserts:

jsonpath "$" includes "foo"  # false
jsonpath "$" contains "foo"  # true

However, if you don't like that idea then I would agree to merge them.

@jcamiel jcamiel added this to the 4.2.0 milestone Sep 21, 2023
@jcamiel jcamiel modified the milestones: 4.2.0, 4.3.0 Jan 10, 2024
@jcamiel jcamiel modified the milestones: 4.3.0, 5.0.0 Apr 17, 2024
@jcamiel jcamiel modified the milestones: 5.0.0, 5.1.0 Aug 28, 2024
@jcamiel jcamiel modified the milestones: 6.0.0, 6.1.0 Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request topic: predicates
Projects
None yet
Development

No branches or pull requests

2 participants