Skip to content

Commit 443252f

Browse files
SAY-5googsvg
andauthored
fix(scheduler): default Configuration.participants to empty list (#316)
Signed-off-by: SAY-5 <say.apm35@gmail.com> Co-authored-by: Gordan Ovcaric <gordan.ovcaric@hotmail.com>
1 parent d79b0e2 commit 443252f

4 files changed

Lines changed: 33 additions & 3 deletions

File tree

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"Bash(/usr/libexec/java_home:*)",
1313
"Bash(./gradlew clean test:*)",
1414
"Bash(./gradlew:*)",
15-
"Bash(./gradlew build:*)"
15+
"Bash(./gradlew build:*)",
16+
"Bash(gh pr *)",
17+
"Bash(gh issue *)"
1618
]
1719
}
1820
}

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
Valid values are strings `"1"` through `"11"`.
88
See [Google Calendar Colors](https://developers.google.com/calendar/api/v3/reference/colors).
99

10+
### Fixed
11+
* `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.
12+
1013
## [v2.15.1] - Release 2026-03-30
1114

1215
### Changed

src/main/kotlin/com/nylas/models/Scheduler.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ data class Configuration(
1212
@Json(name = "id")
1313
val id: String,
1414
/**
15-
* List of participants included in the scheduled event.
15+
* List of participants included in the scheduled event. The Nylas API
16+
* omits this field for group-event configurations, so default to an
17+
* empty list to avoid a JsonDataException on deserialization while
18+
* keeping the property's runtime type unchanged for existing callers.
1619
*/
1720
@Json(name = "participants")
18-
val participants: List<ConfigurationParticipant>,
21+
val participants: List<ConfigurationParticipant> = emptyList(),
1922
/**
2023
* Rules that determine available time slots for the event.
2124
*/

src/test/kotlin/com/nylas/resources/ConfigurationsTest.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,28 @@ class ConfigurationsTest {
231231
assertEquals("Custom Body", emailTemplate.bookingConfirmed?.body)
232232
}
233233

234+
@Test
235+
fun `Configuration without participants field deserializes to empty list`() {
236+
val adapter = JsonHelper.moshi().adapter(Configuration::class.java)
237+
val jsonBuffer = Buffer().writeUtf8(
238+
"""
239+
{
240+
"id": "group-config-id",
241+
"availability": {
242+
"duration_minutes": 30
243+
},
244+
"event_booking": {
245+
"title": "Group Event"
246+
}
247+
}
248+
""".trimIndent(),
249+
)
250+
val config = adapter.fromJson(jsonBuffer)!!
251+
assertIs<Configuration>(config)
252+
assertEquals("group-config-id", config.id)
253+
assertEquals(emptyList(), config.participants)
254+
}
255+
234256
@Test
235257
fun `AdditionalFieldType METADATA serializes correctly`() {
236258
val adapter = JsonHelper.moshi().adapter(AdditionalField::class.java)

0 commit comments

Comments
 (0)