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

Validation issues with scheming multiple text #369

Open
ChristianF88 opened this issue Apr 28, 2023 · 1 comment
Open

Validation issues with scheming multiple text #369

ChristianF88 opened this issue Apr 28, 2023 · 1 comment

Comments

@ChristianF88
Copy link

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:

    {
      "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 <joe@eawag.ch>",
      "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

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.

{('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 "<christian.foerster@eawag.ch>"',
  'author-2': '',
  'author-3': '',
  'pkg_name': '',
  'timerange-1': '*',
  'timerange-2': ''},
 ('id',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('author',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('author_email',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('maintainer_email',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('license_id',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('url',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('version',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('log_message',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('tag_string',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('return_to',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('separator_domain_metadata',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('ispublication',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('islongterm',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>',
 ('timerange',): '<ckan.lib.navl.dictization_functions.Missing object at 0x7efc9814fc70>'}

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!

@ChristianF88
Copy link
Author

This problem seems to be related to this issue: ckan/ckan#6875.

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

No branches or pull requests

1 participant