extensionsAs

fun <T> Problem.extensionsAs(deserializer: DeserializationStrategy<T>, json: Json = ProblemJson): T(source)

Decodes the whole extension map into T. This is the typed consuming edge.

Extension members T does not declare are ignored, so a partial view is fine. So is reading a document produced by a newer version of the problem type than T was written against. §3.2 requires this, not just a convenience: "consumers MUST ignore extension members they don't recognize". It holds regardless of json. ignoreUnknownKeys gets re-applied on top of a caller's instance, so a strictly configured application instance cannot turn a conforming document into an exception. Everything else about json, its serializersModule above all, stays the caller's.

See also


inline fun <T> Problem.extensionsAs(json: Json = ProblemJson): T(source)

Decodes the whole extension map into T, with the deserializer resolved from T. Members T does not declare are ignored, as RFC 9457 §3.2 requires.

Samples

problem.extensionsAs<OutOfCredit>()