From 70106c7dc8b0ff9f0907504509d254c0e8bf745c Mon Sep 17 00:00:00 2001 From: SAY-5 Date: Thu, 30 Apr 2026 12:06:57 -0700 Subject: [PATCH 1/3] fix(scheduler): default Configuration.participants to empty list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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), so existing callers — including the 'config.participants.first()' pattern in ConfigurationsTest — keep compiling without modification. Closes #310. Signed-off-by: SAY-5 --- src/main/kotlin/com/nylas/models/Scheduler.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/nylas/models/Scheduler.kt b/src/main/kotlin/com/nylas/models/Scheduler.kt index e05fc401..cba794e3 100644 --- a/src/main/kotlin/com/nylas/models/Scheduler.kt +++ b/src/main/kotlin/com/nylas/models/Scheduler.kt @@ -12,10 +12,13 @@ data class Configuration( @Json(name = "id") val id: String, /** - * List of participants included in the scheduled event. + * List of participants included in the scheduled event. The Nylas API + * omits this field for group-event configurations, so default to an + * empty list to avoid a JsonDataException on deserialization while + * keeping the property's runtime type unchanged for existing callers. */ @Json(name = "participants") - val participants: List, + val participants: List = emptyList(), /** * Rules that determine available time slots for the event. */ From e42ac0bdfcd38e15874ac4cd991deadabe6d7ef7 Mon Sep 17 00:00:00 2001 From: Gordan Ovcaric Date: Fri, 1 May 2026 10:15:10 +0200 Subject: [PATCH 2/3] add unit test --- .claude/settings.local.json | 4 +++- .../com/nylas/resources/ConfigurationsTest.kt | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 0165ab35..77a90758 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -12,7 +12,9 @@ "Bash(/usr/libexec/java_home:*)", "Bash(./gradlew clean test:*)", "Bash(./gradlew:*)", - "Bash(./gradlew build:*)" + "Bash(./gradlew build:*)", + "Bash(gh pr *)", + "Bash(gh issue *)" ] } } diff --git a/src/test/kotlin/com/nylas/resources/ConfigurationsTest.kt b/src/test/kotlin/com/nylas/resources/ConfigurationsTest.kt index 61adad10..cb34cde1 100644 --- a/src/test/kotlin/com/nylas/resources/ConfigurationsTest.kt +++ b/src/test/kotlin/com/nylas/resources/ConfigurationsTest.kt @@ -231,6 +231,28 @@ class ConfigurationsTest { assertEquals("Custom Body", emailTemplate.bookingConfirmed?.body) } + @Test + fun `Configuration without participants field deserializes to empty list`() { + val adapter = JsonHelper.moshi().adapter(Configuration::class.java) + val jsonBuffer = Buffer().writeUtf8( + """ + { + "id": "group-config-id", + "availability": { + "duration_minutes": 30 + }, + "event_booking": { + "title": "Group Event" + } + } + """.trimIndent(), + ) + val config = adapter.fromJson(jsonBuffer)!! + assertIs(config) + assertEquals("group-config-id", config.id) + assertEquals(emptyList(), config.participants) + } + @Test fun `AdditionalFieldType METADATA serializes correctly`() { val adapter = JsonHelper.moshi().adapter(AdditionalField::class.java) From dab205fd789f8db24282bb6680ffeafb4ac4104c Mon Sep 17 00:00:00 2001 From: Gordan Ovcaric Date: Fri, 1 May 2026 10:20:19 +0200 Subject: [PATCH 3/3] add to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 83563dfa..d6ba6826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Valid values are strings `"1"` through `"11"`. See [Google Calendar Colors](https://developers.google.com/calendar/api/v3/reference/colors). +### Fixed +* `Configuration.participants` now defaults to an empty list when the field is absent from the API response (e.g. group-event configurations), preventing a `JsonDataException` from being thrown during deserialization. + ## [v2.15.1] - Release 2026-03-30 ### Changed