ckan / ckan/ckanext-scheming

Validation issues with scheming multiple text

Open
#369 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 there,

I am updating an old CKAN system, that has been heavily customized. I am in the course of updating ckanext-scheming to version 3.0. Previously an older version was used with ckanext-repeating.

We're using repeating text in our dataset schema twice. Here is the author field's section:
```json
{
"default_value": "context_fullname_email",
"display_snippet": "eaw_repeating_text.html",
"modal_text": "author_help",
"form_snippet": "eaw_schema_repeating_text_js.html",
"label": "Author",
"output_validators": "repeating_text_output",
"validators": "scheming_multiple_text eaw_schema_json_not_empty",
"form_placeholder": "Bach, Johann ",
"field_name": "author",
"display_property": "dc:creator",
"form_blanks": 3,
"preset": "multiple_text",
"required": true

}
```

To migrate from ckanext-repeating to the latest version of scheming I changed the validators from **repeating_text** to **scheming_multiple_text** and I added the **preset: multiple_text**. Unfortunately I couldn't find any more information on how to do the migration anywhere.

Now once I test this schema, I have issue submitting the "new dataset form". Somehow the authors I enter into the repeating text fields are not recognized, as I get a missing author warning.
![image](https://user-images.githubusercontent.com/9096348/235110763-4bcb577b-d18f-4fdb-96b9-c80d7a25a62b.png)

This is caused by the **scheming_multiple_text** validator of ckanext-scheming. Visualizing the validators **data** argument I found that the repeating text fields we use end up in a spot than expected. The repeating text fields end up in **__extras**. But the validator is checking for author.

```python
{('embargo',): '',
('geographic_name',): '',
('has_part',): '',
('id_external',): '',
('is_part_of',): '',
('maintainer',): 'ckadm',
('name',): 'ghfg',
('notes',): 'fdg',
('notes-2',): '',
('open_data',): 'true',
('owner_org',): '87689fbc-3142-40de-89ab-82c760bb34f3',
('private',): 'False',
('publicationlink',): '',
('review_level',): 'none',
('reviewed_by',): '',
('save',): '',
('spatial',): '{}',
('status',): 'incomplete',
('substances',): '',
('substances_generic',): '',
('systems',): '',
('tags_string',): 'federal',
('taxa',): '',
('taxa_generic',): '',
('title',): 'ghfg',
('usage_contact',): 'ckadm',
('variables',): ['alkalinity', ''],
('state',): 'draft',
('type',): 'dataset',
('__extras',): {'_ckan_phase': 'dataset_new_1',
'author-1': 'foerster, christian ""',
'author-2': '',
'author-3': '',
'pkg_name': '',
'timerange-1': '*',
'timerange-2': ''},
('id',): '',
('author',): '',
('author_email',): '',
('maintainer_email',): '',
('license_id',): '',
('url',): '',
('version',): '',
('log_message',): '',
('tag_string',): '',
('return_to',): '',
('separator_domain_metadata',): '',
('ispublication',): '',
('islongterm',): '',
('timerange',): ''}
```

I am not sure how the data is passed and why it ends up in **__extras** instead of author. Does anyone have some advice on how to correct this?

Cheers!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.