Skip to content

fix(scheduler): default Configuration.participants to empty list#316

Merged
googsvg merged 4 commits intonylas:mainfrom
SAY-5:fix/issue-310-group-event-participants-default
May 1, 2026
Merged

fix(scheduler): default Configuration.participants to empty list#316
googsvg merged 4 commits intonylas:mainfrom
SAY-5:fix/issue-310-group-event-participants-default

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented Apr 30, 2026

Summary

Closes #310.

scheduler().configurations().list(grantId) blew up with

com.squareup.moshi.JsonDataException:
  Required value 'participants' missing at $.data[1]

whenever the response contained a group-event configuration, because the Nylas API omits participants for group events but Configuration.participants was a non-nullable, no-default property in models/Scheduler.kt. moshi-kotlin therefore failed the entire page rather than just that entry.

Fix

Default Configuration.participants to emptyList(). moshi-kotlin honours Kotlin data-class defaults when a field is absent from the JSON, so the field deserializes successfully on group-event configurations and keeps the same value as before on regular configurations.

@Json(name = "participants")
val participants: List<ConfigurationParticipant> = emptyList(),

The property's runtime type is unchanged (List<ConfigurationParticipant>), so existing call sites — including config.participants.first() in ConfigurationsTest.kt — keep compiling without modification, and no behaviour changes for callers that already had participants populated.

Test plan

  • Diff is a single-property default change; config.participants.first() etc. still compile against the new declaration.
  • Couldn't run ./gradlew test locally — the project pins JavaLanguageVersion=8 via Gradle toolchain auto-detection and only JDK 11 is available in this environment. CI should cover this.
  • Maintainer verification: integration call to scheduler().configurations().list(grantId) no longer throws when the response includes a group-event configuration.

Note

Low Risk
Low risk: a small model deserialization tweak to tolerate missing participants, plus a unit test, with no auth/security/data mutation changes.

Overview
Fixes scheduler configuration deserialization when the API omits participants (e.g., group-event configs) by defaulting Configuration.participants to emptyList() instead of treating it as required.

Adds a regression test asserting missing participants deserializes to an empty list, and updates local Claude permissions to allow gh pr/gh issue commands.

Reviewed by Cursor Bugbot for commit e42ac0b. Bugbot is set up for automated code reviews on this repo. Configure here.

SAY-5 and others added 2 commits April 30, 2026 12:06
The Nylas Scheduler API does not include the 'participants' field on
group-event configurations, but Configuration.participants was a
non-nullable, no-default property. moshi-kotlin therefore raised:

  com.squareup.moshi.JsonDataException:
    Required value 'participants' missing at $.data[1]

whenever scheduler().configurations().list() returned a list
containing a group-event configuration, breaking the entire response.

Give the property a default value of emptyList() so moshi-kotlin
applies the default when the field is absent from the response. The
property's runtime type is unchanged (still
List<ConfigurationParticipant>), so existing callers — including the
'config.participants.first()' pattern in ConfigurationsTest — keep
compiling without modification.

Closes nylas#310.

Signed-off-by: SAY-5 <say.apm35@gmail.com>
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.47%. Comparing base (d79b0e2) to head (dab205f).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #316   +/-   ##
=========================================
  Coverage     82.47%   82.47%           
  Complexity      357      357           
=========================================
  Files            37       37           
  Lines          1027     1027           
  Branches         95       95           
=========================================
  Hits            847      847           
  Misses          121      121           
  Partials         59       59           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@googsvg
Copy link
Copy Markdown
Contributor

googsvg commented May 1, 2026

@SAY-5 thanks for solving the issue, sorry I've missed the report of that issue. it just went under the radar

we at Nylas really appreciate the community involvement, and we're grateful for your contribution ❤️

the fix will be deployed with next SDK release, soon :)

cursor[bot]

This comment was marked as resolved.

@cursor

This comment was marked as spam.

@googsvg googsvg merged commit 443252f into nylas:main May 1, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling scheduler.configurations().list() throws when a group-event is created.

3 participants