Skip to content

Conversation

Abhitator216
Copy link
Contributor

@Abhitator216 Abhitator216 commented Jul 24, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Implement a validation check that ensures the query field is not empty or consisting only of whitespace, and that the filters field is not entirely None or containing only None values for all its fields. If both conditions are true, an error should be returned.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

curl 'http://localhost:8080/analytics/v1/search' \
  -H 'sec-ch-ua: "Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiNTEzYWUyODItN2I1NS00MGMwLWFiZGMtYjdiMGYzNDNkMTQ2IiwibWVyY2hhbnRfaWQiOiJtZXJjaGFudF8xNzIxNjQyOTczIiwicm9sZV9pZCI6Im9yZ19hZG1pbiIsImV4cCI6MTcyMjE1NzQ0Miwib3JnX2lkIjoib3JnX2drZHNlNDBIdGx6RkNob2NpU0NzIn0.Fmrxsp-emKQ-67EpcJolMf7EyeDdjl4DcwbmnVSprMU' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36' \
  -H 'Content-Type: application/json' \
  -H 'Referer: http://localhost:9000/' \
  -H 'api-key: hyperswitch' \
  -H 'sec-ch-ua-platform: "macOS"' \
  --data-raw '{"query":"dvs"}'
  • An empty query with an unknown filter produces an error.
  • An empty filter with whitespaces in the query produces an error.
  • An empty query with a known filter should give results.
image

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@Abhitator216 Abhitator216 requested a review from a team as a code owner July 24, 2024 13:34
@Abhitator216 Abhitator216 requested review from lsampras and ivor11 July 24, 2024 14:00
@Abhitator216 Abhitator216 self-assigned this Jul 24, 2024
ivor11
ivor11 previously approved these changes Jul 25, 2024
@Abhitator216 Abhitator216 dismissed stale reviews from su-shivanshmathur and ivor11 via 8431d1f July 25, 2024 07:26
@Abhitator216 Abhitator216 requested a review from ivor11 July 25, 2024 09:39
@Abhitator216 Abhitator216 requested a review from tsdk02 July 26, 2024 07:38
@pixincreate pixincreate added this pull request to the merge queue Jul 26, 2024
@pixincreate pixincreate added C-refactor Category: Refactor A-Analytics labels Jul 26, 2024
@pixincreate pixincreate added this to the July 2024 Release milestone Jul 26, 2024
Merged via the queue into main with commit b60933e Jul 26, 2024
@pixincreate pixincreate deleted the opensearch-api branch July 26, 2024 13:15
pixincreate added a commit that referenced this pull request Jul 30, 2024
* 'main' of github.com:juspay/hyperswitch:
  refactor(router): remove `connector_account_details` and `connector_webhook_details` in merchant_connector_account list response (#5457)
  feat: add env variable for enable key manager service (#5442)
  chore(version): 2024.07.29.0
  feat(payments): support sort criteria in payments list (#5389)
  refactor(connector):  add amount conversion framework to placetopay (#4988)
  feat(connector): [Bambora APAC] add mandate flow (#5376)
  ci: set code owners for payment methods files (#5453)
  refactor(opensearch): Add Error Handling for Empty Query and Filters in Request (#5432)
  chore: address Rust 1.80 clippy lints (#5447)
  feat(connector): [FISERV] Move connector to hyperswitch_connectors (#5441)
  ci: add support for just hack_v2 check for PRs (#5426)
  fix: added created at and modified at keys in PaymentAttemptResponse (#5412)
  refactor(merchant_account_v2): recreate id for `merchant_account` v2  (#5439)
  chore(version): 2024.07.26.0
  feat(events): forward the tenant configuration as part of the kafka message (#5224)
  refactor(connector):  add amount conversion framework to payone (#4981)
  refactor(user_roles): make org and merchant id nullable (#5353)
  fix(euclid): change the address taken in SessionFlowRouting from shipping to billing address (#5435)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Analytics C-refactor Category: Refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

refactor(opensearch): Add Error Handling for Empty Query and Filters in Request
6 participants