ckan / ckan/ckanext-scheming

json fields enclosed in quotes when form does not validate

Open
#217 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
102
Forks
182
PR merge metrics
No merged PRs in 30d

Description

I believe it is somewhat related with https://github.com/ckan/ckanext-scheming/pull/165

If the dataset creation form does not validate, my json fields are enclosed in double-quotes. If it fails validating a seconde time, those double-quotes are escaped and it is enclosed in another set of double-quotes, etc.

For instance, leaving on-purpose some mandatory fields empty so I get a validation error, my geojson field, initially set at
`
{"type": "Polygon", "coordinates": [[[-1.791023, 42.777538], [-1.791023, 47.175876], [2.611496, 47.175876], [2.611496, 42.777538], [-1.791023, 42.777538]]]}
`
becomes
`
"{\"type\": \"Polygon\", \"coordinates\": [[[-1.791023, 42.777538], [-1.791023, 47.175876], [2.611496, 47.175876], [2.611496, 42.777538], [-1.791023, 42.777538]]]}"
`
And after failing again to validate my form, would become on 2nd step:
`
"\"{\\\"type\\\": \\\"Polygon\\\", \\\"coordinates\\\": [[[-1.791023, 42.777538], [-1.791023, 47.175876], [2.611496, 47.175876], [2.611496, 42.777538], [-1.791023, 42.777538]]]}\""
`
This is obviously not json-valid anymore...

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the dataset creation form failure using the geojson field and the example value in the issue, submitting it repeatedly to observe the quoting. Read the related ckanext-scheming pull request 165 for context. Done means the field remains valid JSON after validation errors and repeated submissions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.