Skip to content

Inventory dataset form: optional field gives json export error if left blank #5434

Closed

Description

@FuhuXia

When adding a resource in inventory dataset form, if the field "Format", which is marked optiojnal, is left blank, it gives an error during json export.

Image

How to reproduce

  • add a resource to a dataset
  • choose "Link to a file" as the resource type, leave the format field blank.
  • export the datajson for the org.

Expected behavior

json is exported without error

Actual behavior

An error for the dataset during export,

'required': ['mediaType']

Sketch

User reported this issue. #5415 (comment)

Activity

  1. moved this to 📥 Queue in data.gov team boardon Sep 4, 2025
  2. moved this from 📥 Queue to New 📤 Queue in data.gov team boardon Sep 16, 2025
  3. moved this from New 📤 Queue to 📥 Queue in data.gov team boardon Sep 16, 2025
  4. moved this from 📥 Queue to No status in data.gov team boardon Feb 25, 2026
  5. moved this from 📥 Queue to No status in data.gov team boardon Apr 30, 2026
  6. moved this from 📥 Queue to 📟 Sprint Backlog in data.gov team boardon May 28, 2026
  7. moved this from 📟 Sprint Backlog to 🏗 In Progress [8] in data.gov team boardon Jun 3, 2026
  8. cody-seibert-gsa commented on Jun 5, 2026

    @cody-seibert-gsa
    Contributor

    to reproduce locally, you must include a url to a dataset that has no extension in the url and clear out format. when you do that, exporting the data.json will make a zip with an errorlog.txt that may look like this:

    // errorlog.txt
    2026-06-05 20:06:40,495 - ===================================================
    
    Validation failed, best guess of error:
    
     'mediaType' is a required property
    
    Failed validating 'required' in schema[0]['dependencies']['downloadURL']:
        {'properties': {'mediaType': {'anyOf': [{'pattern': '^[-\\w]+/[-\\w]+(\\.[-\\w]+)*([+][-\\w]+)?$',
                                                 'type': 'string'},
                                                {'pattern': '^(\\[\\[REDACTED).*?(\\]\\])$',
                                                 'type': 'string'}]}},
         'required': ['mediaType']}
    
    On instance:
        {'@type': 'dcat:Distribution',
         'downloadURL': 'http://json-schema.org/draft-04/schema'}
    
    For this dataset:
    
    
    2026-06-05 20:06:40,498 - Dataset id=[ac1f331e-0de6-48f0-a949-9153e9b870a2], title=[test], organization=[top level publisher] omitted, reason above.
    
    // error in terminal
    ckan-1                | 2026-06-05 20:06:39,428 WARNI [ckanext.datajson.package2pod] Missing mediaType for resource in package ['ac1f331e-0de6-48f0-a949-9153e9b870a2']
    

    this pr fixes it GSA/ckanext-datajson#164

  9. moved this from 🏗 In Progress [8] to 👀 Needs Review in data.gov team boardon Jun 9, 2026
  10. cody-seibert-gsa commented on Jun 9, 2026

    @cody-seibert-gsa
    Contributor

    all prs merged, I just need someone to login to inventory for me to verify the dataset http://json-schema.org/draft-04/schema will now successully export

  11. cody-seibert-gsa commented on Jun 10, 2026

    @cody-seibert-gsa
    Contributor

    verified it's fixed with @FuhuXia on prod

  12. moved this from 👀 Needs Review to ✔ Done in data.gov team boardon Jun 10, 2026
  13. closed this as completedby moving to ✔ Done in data.gov team boardon Jun 10, 2026
  14. moved this from ✔ Done to 🗄 Closed in data.gov team boardon Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Inventory.data.govInventory playbooks/rolesbugSoftware defect or bug

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions