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

Invalid JSON causes datastore API to throw 500 #4336

Open
dafeder opened this issue Nov 8, 2024 · 0 comments · May be fixed by #4341
Open

Invalid JSON causes datastore API to throw 500 #4336

dafeder opened this issue Nov 8, 2024 · 0 comments · May be fixed by #4341
Assignees
Labels
bug Component: Datastore Good First Issue good issues for first time contributors Refined

Comments

@dafeder
Copy link
Member

dafeder commented Nov 8, 2024

Current Behavior

When we submit valid JSON data to the Datastore API but in a form that does not validate against the query schema, as expected we get a 400 error and some error output. However, submitting completely invalid JSON results in a 500 error.

This issue is specific to the "resource query" datastore endpoint. Submitting invalid JSON to the Metastore API, for instance, will return a 400 "Invalid JSON" response. The datastore should have the same behavior.

Expected Behavior

Submitting completely invalid JSON, such as

{
  "foo": bar,
}

should result in a 400 error and some output.

Steps To Reproduce

POST https://demo.getdkan.org/api/1/datastore/query/cedcd327-4e5d-43f9-8eb1-c11850fa7c55/0 HTTP/1.1

{
  "conditions": [
}

Relevant log output (optional)

The website encountered an unexpected error. Please try again later.

Anything else?

No response

@dafeder dafeder added Component: Datastore bug Good First Issue good issues for first time contributors labels Nov 8, 2024
@janette janette linked a pull request Nov 15, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component: Datastore Good First Issue good issues for first time contributors Refined
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants