Skip to content

Commit bf85ad1

Browse files
committed
fix(osv): Do not crash deserialization if new fields are added
Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 0a5b6be commit bf85ad1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

clients/osv/src/main/kotlin/OsvService.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ interface OsvService {
5252
/** The URL of the staging server. */
5353
const val STAGING_SERVER_URL = "https://api-staging.osv.dev"
5454

55-
val JSON = Json { namingStrategy = JsonNamingStrategy.SnakeCase }
55+
val JSON = Json {
56+
namingStrategy = JsonNamingStrategy.SnakeCase
57+
ignoreUnknownKeys = true
58+
}
5659

5760
fun create(serverUrl: String? = null, client: OkHttpClient? = null): OsvService {
5861
val converterFactory = JSON.asConverterFactory(contentType = "application/json".toMediaType())

0 commit comments

Comments
 (0)