java.lang.Object
io.github.astrapi69.json.ClassToJsonSchemaExtensions
The class
ClassToJsonSchemaExtensions
converts java class objects to json schema object-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.fasterxml.jackson.module.jsonSchema.JsonSchema
toJsonSchema
(Class<T> clazz) Transforms the given java class object to json schemastatic <T> String
toJsonSchemaAsString
(Class<T> clazz) Transforms the given java class object to json schema as stringstatic String
toString
(com.fasterxml.jackson.module.jsonSchema.JsonSchema schema) Transforms the given java class object to json schema as string
-
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
- theJsonSchema
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
-