T - the concrete type of the generated JSON SchemaB - the concrete type of the JSON Schema builderpublic abstract class AbstractJsonSchema<T,B> extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ANNOTATION_JSON_PROPERTY |
static String |
ANNOTATION_JSON_PROPERTY_DESCRIPTION |
static String |
ANNOTATION_NOT_NULL |
protected static io.sundr.model.TypeDef |
BOOLEAN |
protected static io.sundr.model.TypeRef |
BOOLEAN_REF |
protected static io.sundr.model.TypeDef |
DATE |
protected static io.sundr.model.TypeRef |
DATE_REF |
protected static io.sundr.model.TypeDef |
DOUBLE |
protected static io.sundr.model.TypeRef |
DOUBLE_REF |
protected static io.sundr.model.TypeDef |
DURATION |
protected static io.sundr.model.TypeRef |
DURATION_REF |
protected static io.sundr.model.TypeDef |
INT |
protected static io.sundr.model.TypeDef |
INT_OR_STRING |
protected static io.sundr.model.TypeRef |
INT_OR_STRING_REF |
protected static io.sundr.model.TypeRef |
INT_REF |
protected static io.sundr.model.TypeDef |
LONG |
protected static io.sundr.model.TypeRef |
LONG_REF |
protected static io.sundr.model.TypeRef |
P_BOOLEAN_REF |
protected static io.sundr.model.TypeRef |
P_DOUBLE_REF |
protected static io.sundr.model.TypeRef |
P_INT_REF |
protected static io.sundr.model.TypeRef |
P_LONG_REF |
protected static io.sundr.model.TypeDef |
QUANTITY |
protected static io.sundr.model.TypeRef |
QUANTITY_REF |
protected static io.sundr.model.TypeDef |
STRING |
protected static io.sundr.model.TypeRef |
STRING_REF |
| Constructor and Description |
|---|
AbstractJsonSchema() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
addDescription(T schema,
String description) |
abstract void |
addProperty(io.sundr.model.Property property,
B builder,
T schema)
Adds the specified property to the specified builder, calling
internalFrom(String, TypeRef)
to create the property schema. |
protected abstract T |
arrayLikeProperty(T schema)
Builds the schema for array-like properties
|
abstract T |
build(B builder,
List<String> required)
Finishes up the process by actually building the final JSON schema based on the provided
builder and a potentially empty list of names of fields which should be marked as required
|
protected abstract T |
enumProperty(com.fasterxml.jackson.databind.JsonNode... enumValues) |
static String |
getSchemaTypeFor(io.sundr.model.TypeRef typeRef) |
T |
internalFrom(String name,
io.sundr.model.TypeRef typeRef)
Builds the specific JSON schema representing the structural schema for the specified property
|
protected T |
internalFrom(io.sundr.model.TypeDef definition,
String... ignore)
Creates the JSON schema for the particular
TypeDef. |
protected abstract T |
mapLikeProperty()
Builds the schema for map-like properties
|
protected abstract T |
mappedProperty(io.sundr.model.TypeRef ref)
Builds the schema for specifically handled property types (e.g.
|
abstract B |
newBuilder()
Creates a new specific builder object.
|
protected abstract T |
singleProperty(String typeName)
Builds the schema for standard, simple (e.g.
|
protected static final io.sundr.model.TypeDef QUANTITY
protected static final io.sundr.model.TypeDef DURATION
protected static final io.sundr.model.TypeDef INT_OR_STRING
protected static final io.sundr.model.TypeDef BOOLEAN
protected static final io.sundr.model.TypeDef STRING
protected static final io.sundr.model.TypeDef INT
protected static final io.sundr.model.TypeDef LONG
protected static final io.sundr.model.TypeDef DOUBLE
protected static final io.sundr.model.TypeDef DATE
protected static final io.sundr.model.TypeRef QUANTITY_REF
protected static final io.sundr.model.TypeRef DURATION_REF
protected static final io.sundr.model.TypeRef INT_OR_STRING_REF
protected static final io.sundr.model.TypeRef BOOLEAN_REF
protected static final io.sundr.model.TypeRef STRING_REF
protected static final io.sundr.model.TypeRef INT_REF
protected static final io.sundr.model.TypeRef LONG_REF
protected static final io.sundr.model.TypeRef DOUBLE_REF
protected static final io.sundr.model.TypeRef DATE_REF
protected static final io.sundr.model.TypeRef P_INT_REF
protected static final io.sundr.model.TypeRef P_LONG_REF
protected static final io.sundr.model.TypeRef P_DOUBLE_REF
protected static final io.sundr.model.TypeRef P_BOOLEAN_REF
public static final String ANNOTATION_JSON_PROPERTY
public static final String ANNOTATION_JSON_PROPERTY_DESCRIPTION
public static final String ANNOTATION_NOT_NULL
public static String getSchemaTypeFor(io.sundr.model.TypeRef typeRef)
protected T internalFrom(io.sundr.model.TypeDef definition, String... ignore)
TypeDef. This is template method where
sub-classes are supposed to provide specific implementations of abstract methods.definition - The definition.ignore - a potentially empty list of property names to ignore while generating the schemapublic abstract B newBuilder()
public abstract void addProperty(io.sundr.model.Property property,
B builder,
T schema)
internalFrom(String, TypeRef)
to create the property schema.property - the property to add to the currently being built schemabuilder - the builder representing the schema being builtschema - the built schema for the property being addedpublic abstract T build(B builder, List<String> required)
builder - the builder used to build the final schemarequired - the list of names of required fieldspublic T internalFrom(String name, io.sundr.model.TypeRef typeRef)
name - the name of the property which schema we want to buildtypeRef - the type of the property which schema we want to buildprotected abstract T mappedProperty(io.sundr.model.TypeRef ref)
ref - the type of the specifically handled propertyprotected abstract T arrayLikeProperty(T schema)
schema - the schema for the extracted element type for this array-like propertyprotected abstract T mapLikeProperty()
protected abstract T singleProperty(String typeName)
typeName - the mapped name of the property typeprotected abstract T enumProperty(com.fasterxml.jackson.databind.JsonNode... enumValues)
Copyright © 2015–2020 Red Hat. All rights reserved.