visionforge/demo/playground/src/jvmMain/kotlin/generateSchema.kt

24 lines
736 B
Kotlin
Raw Normal View History

2021-03-07 16:19:43 +03:00
package space.kscience.visionforge.examples
2020-12-06 19:16:48 +03:00
import com.github.ricky12awesome.jss.encodeToSchema
2021-02-24 22:48:17 +03:00
import kotlinx.serialization.ExperimentalSerializationApi
2020-12-06 19:16:48 +03:00
import kotlinx.serialization.json.Json
2021-03-07 16:19:43 +03:00
import space.kscience.visionforge.solid.SolidGroup
import space.kscience.visionforge.solid.Solids
2020-12-06 19:16:48 +03:00
2023-05-14 18:33:30 +03:00
@OptIn(ExperimentalSerializationApi::class)
2021-12-31 13:59:27 +03:00
private val json = Json {
serializersModule = Solids.serializersModuleForSolids
prettyPrintIndent = " "
prettyPrint = true
ignoreUnknownKeys = true
isLenient = true
coerceInputValues = true
encodeDefaults = true
}
2021-02-24 22:48:17 +03:00
@ExperimentalSerializationApi
2020-12-06 19:16:48 +03:00
fun main() {
2021-12-31 13:59:27 +03:00
val schema = json.encodeToSchema(SolidGroup.serializer(), generateDefinitions = false)
2020-12-06 19:16:48 +03:00
println(schema)
2021-02-24 22:48:17 +03:00
}