ckan / ckan/ckanext-scheming

tag_string Field Mandatory

Open
#196 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

Hi,

I can't seem to make Tag's mandatory to fill in without causing other issues.

In my schema the field tag_string looks like this:
{
"field_name": "tag_string",
"label": "Tags",
"preset": "tag_string_autocomplete",
"required": true
}

The option "required: true" makes the default red * show up next to the field, but does not enforce any type of validation. For example if you leave the field blank, there will be no validation errors.

I see on the [preset code](https://github.com/ckan/ckanext-scheming/blob/master/ckanext/scheming/presets.json#L27) that there is the "ignore_missing" validator, and I tried to replace it for the "not_empty" one.

This at first seemed to be working great, until I try to upload a resource, and when submitting the resource form, I got prompted with the following error:

![tag error](https://user-images.githubusercontent.com/6845473/47791370-d444ce00-dd19-11e8-9e4e-46e6875df87c.jpg)

Any suggestion?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with ckanext/scheming/presets.json at the tag_string_autocomplete preset and compare its ignore_missing validator with the attempted not_empty replacement. Reproduce submission of a blank tag_string on the resource form, then verify that required tags produce a useful validation error without causing the reported resource-upload error.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.