ui_patterns icon indicating copy to clipboard operation
ui_patterns copied to clipboard

Config schema issues

Open gambry opened this issue 8 years ago • 5 comments

While testing my patterns I received a couple of errors due schema missing/incongruence. I'm happy to split this issue in two (or more) as I think the issue is deeper than just a schema missing.

core.entity_view_display.paragraph.cta.default:third_party_settings.ds.layout.settings.pattern missing schema This looks like just a missing schema for the pattern layout settings. Easy to fix, however I can see there is no config/schema folder at all - neither in the main module nor in the submodules - so probably there are other missing schema definitions other than the ds.layout.settings.pattern one?

core.entity_view_display.paragraph.cta.default:content.field_cta_link.third_party_settings.ds.ft.settings missing schema I'm not sure if the issue in here is related to DS or UI Patterns Display Suite, but that config schema doesn't exist. And this may be related to the fact Display mode settings for field using pattern field template are stored correctly on submitting the form and saving the view mode, but on certain conditions settings are not maintained (default values are not set properly when field settings form is opened), producing the risk of loosing them if the form is wrongly saved. I haven't found a pattern to reproduce this, I will post more info when I found one.

gambry avatar Nov 21 '17 11:11 gambry

core.entity_view_display.paragraph.cta.default:content.field_cta_link.third_party_settings.ds.ft.settings

~~Looking at ds/config/schema/ds.entity_display.schema.yml and the right schema should be either core.entity_view_display.paragraph.cta.default:content.field_cta_link.third_party_settings.ds.fields.ft.settings or the proper one, which is actually missing.~~

Scrab that, I got lost on schema definition chains. 😄 ds.field_template.pattern schema definition is missing.

gambry avatar Nov 21 '17 11:11 gambry

This below is to fix field formatter third party settings:

ui_pattern.settings:
  type: mapping
  label: 'Ui Pattern settings'
  mapping:
    pattern:
      type: string
      label: 'Pattern id'
    pattern_mapping:
      type: sequence
      label: 'Fields to Pattern variables mapping'
      sequence:
        type: mapping
        label: 'Field mapping'
        mapping:
          destination:
            type: string
            label: 'Variable the field should be mapped to'
          source:
            type: string
            label: 'Field the variable should mapped to'
          weight:
            type: integer
            label: 'Weight'
          plugin:
            type: string
            label: 'Plugin'

ds.field_template.pattern:
  type: ui_pattern.settings
  label: 'Pattern DS third party settings for field formatter'

I'm not sure how to tackle core.entity_view_display.paragraph.cta.default:third_party_settings.ds.layout.settings.pattern missing schema because I'm not sure new layout.settings are meant to be added, and if yes how do you add property to a schema definition.

gambry avatar Nov 21 '17 12:11 gambry

Thank you for reporting this, what are the steps to get to the missing schema error?

ademarco avatar Apr 21 '18 15:04 ademarco

  1. enable ui_patterns_ds.
  2. Select a pattern as layout to (view) display a content type.
  3. Select a pattern as a field template for one of the fields.
  4. Save the view mode.

The error can be seen with config_inspector module in the core.entity_view_display config entity we've just saved, which is probably the quickest way to debug and fix.

I personally noticed the error on a couple of functional tests where I'm just rendering the content with the view modes using patterns.

I hope that helps. I can provide a patch with both the config schema and test coverage, however I'm not 100% clear myself how come DS is not used anywhere in our steps BUT it shows up in the config entity. Before providing a fix I want to be sure this is a real config schema miss and not an unexpected behaviour causing a bug.

Thanks!

gambry avatar Apr 23 '18 08:04 gambry

Thank you for offering to help with this @gambry! We should provide a schema indeed, it was something I was always planning to add, so a PR would be very welcome!

ademarco avatar Apr 23 '18 14:04 ademarco