ckan / ckan/ckanext-scheming

datetime and datetime_tz not correctly validated for resource_fields

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

Description

CKAN 2.7.6

Similar to #86, but it looks like the form_snippets were combined into their own presets without any testing for resources. The validator receives the data_dict, but only does a lookup based on the parent field_name, while the form_snippet combines the field_name with _tz, _date, _time. These are available on the context, but not in the data dict in the validator, and ('resource', 0, 'field_name') shows up as Missing.

I'll try and address this in a PR that does a look up on context in the validator, but I'm not that familiar with why the separate fields wouldn't be present in the data at this point. @wardi Do you have any insight into how that works currently or a suggestion for a better idea? (I did step through many times and look through the code and docs generally, but something is escaping me in terms of how resource fields are processed before they get to a scheming validator)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how resource form_snippets and presets produce the separate datetime and datetime_tz fields before reaching the scheming validator. Read the validator's data_dict and context handling, then verify the resource-field case where ('resource', 0, 'field_name') is Missing. Done means datetime and datetime_tz resource_fields are correctly validated without breaking existing field validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.