AddToCalendar config does not match schema, plus some schema missing

Created on 6 November 2019, about 5 years ago
Updated 7 August 2023, over 1 year ago

The schema for addtocalendar.settings.addtocalendar_show has type string but the default addtocalendar.settings file has exported addtocalendar_show: 0.

Additionally, the add_to_calendar_field field needs schema configuration. This patch addresses both issues.

πŸ“Œ Task
Status

Fixed

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kaythay

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    I just added some basic functional test coverage in πŸ“Œ Addtocalendar could use some automated tests! Fixed that should be helpful in resolving this issue.

    I added protected $strictConfigSchema = FALSE; to the test because indeed there are schema problems in the module. If I remove that declaration and run the test it fails with:

    Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for addtocalendar.settings with the following errors: addtocalendar.settings:addtocalendar_show variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData

    There are other schema problems as well, as the IS notes.

    Anyway, now that we have automated tests, the goal of this issue is to get those tests to run after removing the $strictConfigSchema declaration.

  • Assigned to danflanagan8
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    I just applied the patch in #6 and ran the test locally with the strict schema enforced. I got a little farther I think before the test failed for a schema violation:

    1) Drupal\Tests\addtocalendar\Functional\AddToCalendarTest::testAddToCalendarFormatter
    Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for field.field.node.page.field_addtocalendar with the following errors: field.field.node.page.field_addtocalendar:settings.addtocalendar_settings.data_calendars.iCalendar variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData, field.field.node.page.field_addtocalendar:settings.addtocalendar_settings.data_calendars.Outlook Online variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData, field.field.node.page.field_addtocalendar:settings.addtocalendar_settings.data_calendars.Yahoo! Calendar variable type is integer but applied schema class is Drupal\Core\TypedData\Plugin\DataType\StringData
    

    So that's one thing that needs fixing. That needs to be string though, so we'll need to update the config in the test module. I think technically that indicates we should include an update hook to force that config update on existing sites.

    When I update my zeros to '0' in the test config, the tests pass! Yay!

    But I also think that field.field_settings.add_to_calendar_field should extend the core boolean schema since our field extends that field.

    I'll make both of these updates.

    Regarding #10 I think we should handle that in a new issue since the current test coverage does not cover that case.

  • Status changed to Needs review over 1 year ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    1 pass
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    Here's an updated patch with everything mentioned in #12.

  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US
  • Status changed to Fixed over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States danflanagan8 St. Louis, US

    Fixed!

    Thank you for the nice work, @kaythay! I noticed that the patch in #6 is simply a re-posted version of your original patch in #2.

    I created a followup for the third party settings: πŸ› AddToCalendar third party settings missing schema Fixed

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024