All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.frtu.kotlin.serdes.json.schema.SchemaGen.kt Maven / Gradle / Ivy

The newest version!
package com.github.frtu.kotlin.serdes.json.schema

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.kjetland.jackson.jsonSchema.JsonSchemaGenerator

/**
 * Json Schema generator
 */
object SchemaGen {
    private val objectMapper = jacksonObjectMapper()
    private val jsonSchemaGenerator = JsonSchemaGenerator(objectMapper)

    fun generateJsonSchema(parameterClass: Class<*>): String {
        return objectMapper.writeValueAsString(jsonSchemaGenerator.generateJsonSchema(parameterClass))
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy