https://kotlinlang.org logo
#ktor
Title
# ktor
p

P A

02/24/2023, 5:33 PM
Hello, is there an idiomatic way of handling http patch requests in Kotlin(Ktor, etc)?
a

Aleksei Tirman [JB]

02/24/2023, 9:15 PM
Can you describe your problem in more detail, preferably with a code snippet?
p

P A

02/24/2023, 9:20 PM
I don’t have a code snippet handy at this moment. I’ll share one later. The core of my questions is about how to translate a Patch request into strongly typed (data) classes. In particular, I wonder if there is a Kotlin/Ktor idiomatic way to distinguish between a field being set to null vs a field being removed from the document referenced in a the Patch request.
One way to deal with this is to use a request format such JSON Patch. https://en.m.wikipedia.org/wiki/JSON_Patch
I wonder if there is some well know practice/pattern in Ktor or if there are Kotlin libraries to deal with the ambiguity mentioned above or is everyone just rolling their own custom solutions.
Let me know if my question makes sense, thank you!
12 Views