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

New query operators #3803

Merged
merged 6 commits into from
Jul 11, 2022
Merged

New query operators #3803

merged 6 commits into from
Jul 11, 2022

Conversation

dafeder
Copy link
Member

@dafeder dafeder commented Jul 11, 2022

Adds custom conditional operators "contains" and "starts with" to the query schema.

QA Steps

  1. Start with demo site
  2. Request (replace URL with correct domain):
POST http://startswith.localtest.me/api/1/datastore/query/d460252e-d42c-474a-9ea9-5287b1d595f6/0 HTTP/1.1

{
  "conditions": [
    {
      "property": "city",
      "value": "New",
      "operator": "starts with"
    }
  ]
}
  1. Confirm one result, with city "New York.
  2. Request (replace URL with correct domain):
POST http://startswith.localtest.me/api/1/datastore/query/d460252e-d42c-474a-9ea9-5287b1d595f6/0 HTTP/1.1

{
  "conditions": [
    {
      "property": "city",
      "value": "York",
      "operator": "contains"
    }
  ]
}
  1. Confirm one result, with city "New York.

@dafeder dafeder marked this pull request as ready for review July 11, 2022 20:35
Comment on lines 1 to 3
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://getdkan.com/api/datastore.query.json",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore this file for now. I was starting to create a simplified schema for single-resource queries, which are all we use except for PFS, but I decided to hold off for now to keep disruption to a minimum.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this isn't needed for this PR, I recommend we pull it out into a separate branch.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment on lines 1 to 3
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://getdkan.com/api/datastore.query.json",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this isn't needed for this PR, I recommend we pull it out into a separate branch.

Copy link
Contributor

@clayliddell clayliddell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM & tested working

@clayliddell clayliddell merged commit 69090f0 into 2.x Jul 11, 2022
@clayliddell clayliddell deleted the startswith branch July 11, 2022 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants