Class JsonSchema
- java.lang.Object
-
- au.gov.amsa.sgb.decoder.internal.json.JsonSchema
-
public final class JsonSchema extends java.lang.ObjectSimplified JSON schema generator only targeting Detection class and its dependents. Honours JacksonJsonIgnoreannotations on fields.Limitations include:
- arrays not supported (not required for Detection class)
- fields are considered
requiredif not typed usingOptional
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgenerateSchema(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 insubclassesso 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$idfield.- Returns:
- JSON Schema
-
-