Schema missing for `asset_formats` key in module settings.

Created on 9 August 2023, 11 months ago
Updated 11 September 2023, 10 months ago

Problem/Motivation

Config Inspector reports the following when analyzing `orange_dam.settings.yml`

 	Name 	Label 	Type 	Validatable 	Value 	Error 	Validation error
 	asset_formats.TRX 	Undefined 	undefined 	No 	 	missing schema 	
	asset_formats.TR1 	Undefined 	undefined 	No 	 	missing schema 	

Steps to reproduce

Enable config inspector module and check orange_dam.settings.yml.

Proposed resolution

Add the following to the schema file:

orange_dam.asset_format:
  type: string
  content_types:
    type: sequence
    label: 'Content Types'
    sequence:
      type: string
      label: 'Content Type'

(untested)

And rewrite the asset_formats key to:

    asset_formats:
      type: mapping
      label: 'Content Type <> Asset Format Mapping'
      mapping:
        label: 'Asset Format'
        type: string
        content_types:
          type: orange_dam.asset_format

Alternatively, an improvement could be to remove the `asset_formats` key all together and add it to the configuration of the content types, since that is actually what this config key is doing.

Remaining tasks

Decide whether to remove asset_formats and add it to content type config.

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States apotek

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @apotek
  • πŸ‡ΊπŸ‡ΈUnited States adamzimmermann

    Thank you for submitting this. I like the proposed solution+++

  • πŸ‡ΊπŸ‡ΈUnited States apotek

    > I like the proposed solution+++

    @adamzimmerman, I do too :).

    so then the settings would look like this:

    content_types:
      'name of content type':
        use_datatable: true|false
        asset_format: TRX|TR1
      'another content type': { }
    

    The schema would need this added:

    orange_dam.content_type:
      type: mapping
      label: 'Content type properties'
      mapping:
        use_datatable:
          type: boolean
          label: 'Augment with Data Table data'
    +   asset_format:
    +     type: string
    +      label: 'Orange DAM asset format for content type'
    
    

    Though it would be more elegant if the asset_format type were not a string but an enum type so it could be validated.

    This is the easy part. The harder parts:

    1. Refactor the parts of the code that were using the`asset_format` key.
    2. Write update hook to remove end-users `asset_format` config and move the values into their `content_types` config.

  • πŸ‡ΊπŸ‡ΈUnited States adamzimmermann

    Alternatively, an improvement could be to remove the `asset_formats` key all together and add it to the configuration of the content types, since that is actually what this config key is doing.

    I believe this is what you showed in your comment πŸ› Schema missing for `asset_formats` key in module settings. Fixed above, and I'm liking it!

    This is the easy part. The harder parts:

    You are correct.

  • @adamzimmermann opened merge request.
  • Assigned to adamzimmermann
  • Status changed to Needs review 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States adamzimmermann
  • Status changed to Fixed 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States adamzimmermann
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024