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/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 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. */ 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)