Class ClassToJsonSchemaExtensions

java.lang.Object
io.github.astrapi69.json.ClassToJsonSchemaExtensions

public class ClassToJsonSchemaExtensions extends Object
The class ClassToJsonSchemaExtensions converts java class objects to json schema object
  • Constructor Details

    • ClassToJsonSchemaExtensions

      public ClassToJsonSchemaExtensions()
  • Method Details

    • toString

      public static String toString(com.fasterxml.jackson.module.jsonSchema.JsonSchema schema) throws com.fasterxml.jackson.core.JsonProcessingException
      Transforms the given java class object to json schema as string
      Parameters:
      schema - the JsonSchema object
      Returns:
      the json schema as string
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to String
    • toJsonSchemaAsString

      public static <T> String toJsonSchemaAsString(Class<T> clazz) throws com.fasterxml.jackson.core.JsonProcessingException
      Transforms the given java class object to json schema as string
      Type Parameters:
      T - the generic type
      Parameters:
      clazz - the clazz
      Returns:
      the json schema as string
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to String
    • toJsonSchema

      public static <T> com.fasterxml.jackson.module.jsonSchema.JsonSchema toJsonSchema(Class<T> clazz) throws com.fasterxml.jackson.core.JsonProcessingException
      Transforms the given java class object to json schema
      Type Parameters:
      T - the generic type
      Parameters:
      clazz - the clazz
      Returns:
      the json schema
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - If an error occurs when converting object to String