<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Sealed Class on Piotr Proszowski</title><link>https://proszkie.github.io/tags/sealed-class/</link><description>Recent content in Sealed Class on Piotr Proszowski</description><generator>Hugo</generator><language>en</language><managingEditor>p.proszowski@gmail.com (Piotr Proszowski)</managingEditor><webMaster>p.proszowski@gmail.com (Piotr Proszowski)</webMaster><lastBuildDate>Tue, 21 Jun 2022 17:29:00 +0200</lastBuildDate><atom:link href="https://proszkie.github.io/tags/sealed-class/index.xml" rel="self" type="application/rss+xml"/><item><title>Mapping HTTP request to sealed class with Jackson</title><link>https://proszkie.github.io/posts/map-requests-to-sealed-class/</link><pubDate>Tue, 21 Jun 2022 17:29:00 +0200</pubDate><author>p.proszowski@gmail.com (Piotr Proszowski)</author><guid>https://proszkie.github.io/posts/map-requests-to-sealed-class/</guid><description>&lt;h2 id="tldr">TL;DR&lt;/h2>
&lt;p>Today I learned how to map http request to sealed class in Kotlin and decided to share that with you.&lt;/p>
&lt;h2 id="context">Context&lt;/h2>
&lt;p>Sometimes it can happen that our REST API consumes jsons that have conditional fields. Let&amp;rsquo;s say we have a following endpoint in our application:&lt;/p>
&lt;pre tabindex="0">&lt;code>POST /bet-offers
&lt;/code>&lt;/pre>&lt;p>It is used for adding a new bet offer to our application which offers betting on different sport events. There are different types of bet offers:&lt;/p></description></item></channel></rss>