Add smart_date JSON:API write support as rsvp_smartdate_jsonapi sub-module

Submitted by StephenGroundwater on
Status
Priority
Medium

The smart_date contrib module does not support JSON:API write operations (POST/PATCH). Drupal's JSON:API processes fields through @DataType-level normalizers only, and SmartDateItem has an rrule property (integer FK to a SmartDateRule entity) that the default normalizer cannot handle during deserialization — causing a 500 "Expected data to be a string or array" crash on any attempt to set a smart_date field via JSON:API.

Impact: The RSVP MCP server cannot set dates when creating or updating events. Events created via MCP land with no date and require manual admin UI intervention.

Approach

Add a sub-module rsvp_smartdate_jsonapi to rsvp-system-module (under modules/) that registers a @DataType("field_item:smartdate") normalizer. It handles value/end_value (Unix timestamps), duration, and timezone correctly and safely skips rrule/rrule_index when null. The normalizer should contain zero RSVP-specific logic so it can be contributed upstream.

This is a temporary shim

When smart_date ships proper JSON:API write support, uninstall and remove this sub-module. To test: disable the sub-module and attempt a JSON:API POST to /jsonapi/node/rsvp_event with a field_rsvp_event_smartdate value.

Upstream issues to watch

  • https://www.drupal.org/project/smart_date/issues/3247537 — Serialization (HAL fixed, JSON:API not addressed)
  • https://www.drupal.org/project/smart_date/issues/3309050 — JSON:API field enhancer for rrules (read-only, needs review)

Definition of done

  • Sub-module created in rsvp-system-module under modules/rsvp_smartdate_jsonapi/
  • JSON:API POST to /jsonapi/node/rsvp_event with smartdate field succeeds
  • MCP create_event tool updated to send correct payload (Unix timestamps + required relationships)
  • Upstream contribution filed or noted as follow-up