0

I have a module config settings.yml file with a dynamic list of the fields attached to a user entity, eg

archive:
  directory: user-history/archive/
  filename: user-history-archive
  max_cardinality: 5
base_fields:
  uid: true
  name: true
  pass: true
  mail: true
  timezone: true
  status: true
  roles: true
  created: true
  changed: true
  access: true
  login: true
  init: true
  langcode: true
  preferred_langcode: true
  preferred_admin_langcode: true
attached_fields:
  field_alpha_text: 1
  field_beta_term: 1
  field_paragraph: 1
  field_user_story: 1
  user_picture: 0
  field_delta_value: 1
no_change:
  ignore: true
  delete: ''

I am unable to find out how this structure should be described in the module schema.yml file so that config_inspector does not flag the schema as invalid.

I have tried vaiations on

user_history.settings:
  type: config_object
  label: 'User history settings'
  mapping:
    no_change:
      type: mapping
      label: 'No change'
      mapping:
        ignore:
          type: boolean
          label: 'Ignore records with no change'
        delete:
          type: string
          label: 'Delete "no change" records older than'
        batch:
          type: integer
          label: 'Batch size for "no change" record delete'
    base_fields:
      type: mapping
      label: 'Base fields to be tracked'
      mapping:
        uid:
          type: boolean
          label: 'Uid'
        name:
          type: boolean
          label: 'Name'
        pass:
          type: boolean
          label: 'Password'
        mail:
          type: boolean
          label: 'Mail'
        timezone:
          type: boolean
          label: 'Timezone'
        status:
          type: boolean
          label: 'Status'
        roles:
          type: boolean
          label: 'Roles'
        created:
          type: boolean
          label: 'Created'
        changed:
          type: boolean
          label: 'Changed'
        access:
          type: boolean
          label: 'Last access'
        login:
          type: boolean
          label: 'Login'
        init:
          type: boolean
          label: 'Initial mail'
        langcode:
          type: boolean
          label: 'Langcode'
        preferred_langcode:
          type: boolean
          label: 'Preferred langcode'
        preferred_admin_langcode:
          type: boolean
          label: 'Preferred admin langcode'
    attached_fields:
      type: mapping
      label: 'Attached fields to be tracked'
      mapping:
        attached_fields.%key:
          type: integer
          label: [label]
    archive:
      type: mapping
      label: 'Archive settings'
      mapping:
        directory:
          type: string
          label: 'Directory for archive files'
        filename:
          type: string
          label: 'Name for archive files'
        max_cardinality:
          type: integer
          label: 'Maximum field cardinality for separate column values'

but without success.

Any suggestions please?

1
  • I have edited the question to show the full settings.yml and schema.yml files in place of the snippets originally posted in the hope that this might help someone to understand the problem.
    – jlscott
    May 19 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.