Class JsonSchema
- java.lang.Object
-
- au.gov.amsa.sgb.decoder.internal.json.JsonSchema
-
public final class JsonSchema extends java.lang.Object
Simplified JSON schema generator only targeting Detection class and its dependents. Honours JacksonJsonIgnore
annotations on fields.Limitations include:
- arrays not supported (not required for Detection class)
- fields are considered
required
if not typed usingOptional
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
generateSchema(java.lang.Class<?> cls, java.util.Map<java.lang.Class<?>,java.util.List<java.lang.Class<?>>> subclasses, java.lang.String schemaId)
Returns the JSON Schema for the heirarchy of classes pointed to byclasses
.
-
-
-
Method Detail
-
generateSchema
public static java.lang.String generateSchema(java.lang.Class<?> cls, java.util.Map<java.lang.Class<?>,java.util.List<java.lang.Class<?>>> subclasses, java.lang.String schemaId)
Returns the JSON Schema for the heirarchy of classes pointed to byclasses
. Targets Detection class only (but might be extended in the future for more). Any subclasses within the heirarchy should be mentioned insubclasses
so that the appropriate JSON Schema structures are produced. Subclasses should include a discriminator field that allows users to differentiate the JSON representations.- Parameters:
cls
- root class to be converted into a JSON Schemasubclasses
- maps classes to a list of their subclassesschemaId
- value to be used in the$id
field.- Returns:
- JSON Schema
-
-