https://kotlinlang.org logo
Title
u

user

06/20/2022, 6:31 PM
Validating JSON schema with intersections and unions classes in Kotlin I'm thinking about rewriting small web server project that I have from TypeScript to Kotlin. The problem that I have is server accepts a JSON with unions and intersections. For the purpose of this example: I want incoming JSON to have a string field with either the name one or name two, but not both or none of them, e.g. {"one": "some text"} or {"two": "some other text"} I want format of incoming request be dependent on one of its fields, e.g.: { "someFlag": false, // or can be missing...