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

Bugfix: Allow empty arrays and objects in json type fields when inserting data into datastore #4826

Merged
merged 3 commits into from
Jun 14, 2019
Merged

Bugfix: Allow empty arrays and objects in json type fields when inserting data into datastore #4826

merged 3 commits into from
Jun 14, 2019

Conversation

Icontech
Copy link
Contributor

@Icontech Icontech commented Jun 3, 2019

Fixes #4766

Proposed fixes:

Add bugfix from #1776 to INSERT method in upsert_data. This allows empty json arrays or json objects to be inserted into json type fields when creating new data in the datastore.

Features:

  • includes tests covering changes
  • includes updated documentation
  • includes user-visible changes
  • includes API changes
  • includes bugfix for possible backport

Please [X] all the boxes above that apply

…tore_create

Currently, adding an empty array or an empty object to a field of type json using datastore_create results in a validation error and status code 409.

After this change, empty arrays and empty objects can be added to fields of type json.
@Icontech
Copy link
Contributor Author

Icontech commented Jun 5, 2019

The test failing is test_calculate_record_count in test_create.py. The response from 'when_was_last_analyze' is None but should be an array with data.
I've been trying to recreate this error myself by running the tests on my branch, with no luck. I get an array back containing information about when the resource was created. I've tried changing the test to use json fields with empty arrays as values, but same result.
Perhaps someone with more insight into the code base could take a look or give me some advice?

@wardi
Copy link
Contributor

wardi commented Jun 5, 2019

@davidread looks like this test was added in 8aa298d any ideas?

@davidread
Copy link
Contributor

Sadly this test is slightly flaky :(

I've rerun the tests and they pass this time.

@wardi wardi merged commit 7fd6ca6 into ckan:master Jun 14, 2019
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.

Error when posting empty array with type json using datastore_create
3 participants