Package org.apache.juneau.httppart
Class HttpPartSchema
java.lang.Object
org.apache.juneau.httppart.HttpPartSchema
Represents an OpenAPI schema definition.
The schema definition can be applied to any HTTP parts such as bodies, headers, query/form parameters, and URL path parts.
The API is generic enough to apply to any path part although some attributes may only applicable for certain parts.
Schema objects are created via builders instantiated through the create()
method.
Notes:
- This class is thread safe and reusable.
See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HttpPartSchema
Reusable instance of this object, all default settings.static final HttpPartSchema
Array typestatic final HttpPartSchema
Comma-delimited array typestatic final HttpPartSchema
Multi-part array typestatic final HttpPartSchema
Pipe-delimited array typestatic final HttpPartSchema
Space-delimited array typestatic final HttpPartSchema
Tab-delimited array typestatic final HttpPartSchema
UON-formatted array typestatic final HttpPartSchema
Binary typestatic final HttpPartSchema
Spaced binary typestatic final HttpPartSchema
Boolean typestatic final HttpPartSchema
Byte typestatic final HttpPartSchema
Date typestatic final HttpPartSchema
Date-time typestatic final HttpPartSchema
Double typestatic final HttpPartSchema
File typestatic final HttpPartSchema
Float typestatic final HttpPartSchema
Int32 typestatic final HttpPartSchema
Int64 typestatic final HttpPartSchema
Integer typestatic final HttpPartSchema
No typestatic final HttpPartSchema
Number typestatic final HttpPartSchema
Object typestatic final HttpPartSchema
Comma-delimited object typestatic final HttpPartSchema
Pipe-delimited object typestatic final HttpPartSchema
Space-delimited object typestatic final HttpPartSchema
Tab-delimited object typestatic final HttpPartSchema
UON-formated object typestatic final HttpPartSchema
String typestatic final HttpPartSchema
UON-formated simple type -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpPartSchema.Builder
create()
Instantiates a new builder for this object.static HttpPartSchema
create
(Annotation a) Finds the schema information on the specified annotation.static HttpPartSchema
create
(Annotation a, String defaultName) Finds the schema information on the specified annotation.static HttpPartSchema
create
(Class<? extends Annotation> c, Method m) Finds the schema information for the specified method return.static HttpPartSchema
create
(Class<? extends Annotation> c, Type t) Finds the schema information for the specified class.static HttpPartSchema
create
(Class<? extends Annotation> c, ParamInfo mpi) Finds the schema information for the specified method parameter.static HttpPartSchema.Builder
Shortcut for callingcreate().type(type); static HttpPartSchema.Builder
Shortcut for callingcreate().type(type).format(format); Returns thecollectionFormat field of this schema.Returns thedefault field of this schema.getEnum()
Returns theenum field of this schema.Returns theformat field of this schema.Returns theformat field of this schema.getItems()
Returns themaximum field of this schema.Returns themaximum field of this schema.Returns thexxx field of this schema.Returns thexxx field of this schema.Returns thexxx field of this schema.Returns theminimum field of this schema.Returns thexxx field of this schema.Returns thexxx field of this schema.Returns thexxx field of this schema.Returns thexxx field of this schema.getName()
Returns the name of the object described by this schema, for example the query or form parameter name.ClassMeta<?>
Returns the default parsed type for this schema.Class<? extends HttpPartParser>
Returns theparser field of this schema.Returns thexxx field of this schema.getProperty
(String name) Returns the schema information for the specified property.Class<? extends HttpPartSerializer>
Returns theserializer field of this schema.getType()
Returns thetype field of this schema.Returns thetype field of this schema.boolean
Returnstrue if this schema has properties associated with it.boolean
Returns theallowEmptyValue field of this schema.boolean
Returns theexclusiveMaximum field of this schema.boolean
Returns theexclusiveMinimum field of this schema.boolean
Returns therequired field of this schema.boolean
Returns theskipIfEmpty field of this schema.boolean
Returns theuniqueItems field of this schema.static HttpPartSchema.Builder
tArray()
Shortcut for .create ().type(HttpPartDataType.ARRAY )static HttpPartSchema.Builder
tArray
(HttpPartSchema.Builder items) Shortcut for .create ().type(HttpPartDataType.ARRAY ).items(items)static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.CSV )static HttpPartSchema.Builder
tArrayCsv
(HttpPartSchema.Builder items) Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.CSV ).items(items)static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.MULTI )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.MULTI ).items(items)static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.PIPES )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.PIPES ).items(items)static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.SSV )static HttpPartSchema.Builder
tArraySsv
(HttpPartSchema.Builder items) Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.SSV ).items(items)static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.TSV )static HttpPartSchema.Builder
tArrayTsv
(HttpPartSchema.Builder items) Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.TSV ).items(items)static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.UONC )static HttpPartSchema.Builder
tArrayUon
(HttpPartSchema.Builder items) Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.UONC ).items(items)static HttpPartSchema.Builder
tBinary()
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.BINARY )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.BINARY_SPACED )static HttpPartSchema.Builder
tBoolean()
Shortcut for .create ().type(HttpPartDataType.BOOLEAN )static HttpPartSchema.Builder
tByte()
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.BYTE )static HttpPartSchema.Builder
tDate()
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.DATE )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.DATE_TIME )static HttpPartSchema.Builder
tDouble()
Shortcut for .create ().type(HttpPartDataType.NUMBER ).format(HttpPartFormat.DOUBLE )static HttpPartSchema.Builder
tFile()
Shortcut for .create ().type(HttpPartDataType.FILE )static HttpPartSchema.Builder
tFloat()
Shortcut for .create ().type(HttpPartDataType.NUMBER ).format(HttpPartFormat.FLOAT )static HttpPartSchema.Builder
tInt32()
Shortcut for .create ().type(HttpPartDataType.INTEGER ).format(HttpPartFormat.INT32 )static HttpPartSchema.Builder
tInt64()
Shortcut for .create ().type(HttpPartDataType.INTEGER ).format(HttpPartFormat.INT64 )static HttpPartSchema.Builder
tInteger()
Shortcut for .create ().type(HttpPartDataType.INTEGER )static HttpPartSchema.Builder
tNone()
Shortcut for .create ().type(HttpPartDataType.NONE )static HttpPartSchema.Builder
tNumber()
Shortcut for .create ().type(HttpPartDataType.NUMBER )static HttpPartSchema.Builder
tObject()
Shortcut for .create ().type(HttpPartDataType.OBJECT )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.CSV )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.PIPES )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.SSV )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.TSV )static HttpPartSchema.Builder
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.UON )toString()
static HttpPartSchema.Builder
tString()
Shortcut for .create ().type(HttpPartDataType.STRING )static HttpPartSchema.Builder
tUon()
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.UON )validateInput
(String in) Throws aParseException
if the specified pre-parsed input does not validate against this schema.<T> T
validateOutput
(T o, BeanContext bc) Throws aParseException
if the specified parsed output does not validate against this schema.
-
Field Details
-
DEFAULT
Reusable instance of this object, all default settings. -
T_BOOLEAN
Boolean type -
T_FILE
File type -
T_INTEGER
Integer type -
T_INT32
Int32 type -
T_INT64
Int64 type -
T_NONE
No type -
T_NUMBER
Number type -
T_FLOAT
Float type -
T_DOUBLE
Double type -
T_STRING
String type -
T_BYTE
Byte type -
T_BINARY
Binary type -
T_BINARY_SPACED
Spaced binary type -
T_DATE
Date type -
T_DATETIME
Date-time type -
T_UON
UON-formated simple type -
T_ARRAY
Array type -
T_ARRAY_CSV
Comma-delimited array type -
T_ARRAY_PIPES
Pipe-delimited array type -
T_ARRAY_SSV
Space-delimited array type -
T_ARRAY_TSV
Tab-delimited array type -
T_ARRAY_UON
UON-formatted array type -
T_ARRAY_MULTI
Multi-part array type -
T_OBJECT
Object type -
T_OBJECT_CSV
Comma-delimited object type -
T_OBJECT_PIPES
Pipe-delimited object type -
T_OBJECT_SSV
Space-delimited object type -
T_OBJECT_TSV
Tab-delimited object type -
T_OBJECT_UON
UON-formated object type
-
-
Method Details
-
create
Instantiates a new builder for this object.- Returns:
- A new builder for this object.
-
tBoolean
Shortcut for .create ().type(HttpPartDataType.BOOLEAN )- Returns:
- A new builder for this object.
-
tFile
Shortcut for .create ().type(HttpPartDataType.FILE )- Returns:
- A new builder for this object.
-
tInteger
Shortcut for .create ().type(HttpPartDataType.INTEGER )- Returns:
- A new builder for this object.
-
tInt32
Shortcut for .create ().type(HttpPartDataType.INTEGER ).format(HttpPartFormat.INT32 )- Returns:
- A new builder for this object.
-
tInt64
Shortcut for .create ().type(HttpPartDataType.INTEGER ).format(HttpPartFormat.INT64 )- Returns:
- A new builder for this object.
-
tNone
Shortcut for .create ().type(HttpPartDataType.NONE )- Returns:
- A new builder for this object.
-
tNumber
Shortcut for .create ().type(HttpPartDataType.NUMBER )- Returns:
- A new builder for this object.
-
tFloat
Shortcut for .create ().type(HttpPartDataType.NUMBER ).format(HttpPartFormat.FLOAT )- Returns:
- A new builder for this object.
-
tDouble
Shortcut for .create ().type(HttpPartDataType.NUMBER ).format(HttpPartFormat.DOUBLE )- Returns:
- A new builder for this object.
-
tString
Shortcut for .create ().type(HttpPartDataType.STRING )- Returns:
- A new builder for this object.
-
tByte
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.BYTE )- Returns:
- A new builder for this object.
-
tBinary
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.BINARY )- Returns:
- A new builder for this object.
-
tBinarySpaced
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.BINARY_SPACED )- Returns:
- A new builder for this object.
-
tDate
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.DATE )- Returns:
- A new builder for this object.
-
tDateTime
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.DATE_TIME )- Returns:
- A new builder for this object.
-
tUon
Shortcut for .create ().type(HttpPartDataType.STRING ).format(HttpPartFormat.UON )- Returns:
- A new builder for this object.
-
tArray
Shortcut for .create ().type(HttpPartDataType.ARRAY )- Returns:
- A new builder for this object.
-
tArray
Shortcut for .create ().type(HttpPartDataType.ARRAY ).items(items)- Parameters:
items
- The schema of the array items.- Returns:
- A new builder for this object.
-
tArrayCsv
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.CSV )- Returns:
- A new builder for this object.
-
tArrayCsv
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.CSV ).items(items)- Parameters:
items
- The schema of the array items.- Returns:
- A new builder for this object.
-
tArrayPipes
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.PIPES )- Returns:
- A new builder for this object.
-
tArrayPipes
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.PIPES ).items(items)- Parameters:
items
- The schema of the array items.- Returns:
- A new builder for this object.
-
tArraySsv
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.SSV )- Returns:
- A new builder for this object.
-
tArraySsv
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.SSV ).items(items)- Parameters:
items
- The schema of the array items.- Returns:
- A new builder for this object.
-
tArrayTsv
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.TSV )- Returns:
- A new builder for this object.
-
tArrayTsv
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.TSV ).items(items)- Parameters:
items
- The schema of the array items.- Returns:
- A new builder for this object.
-
tArrayUon
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.UONC )- Returns:
- A new builder for this object.
-
tArrayUon
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.UONC ).items(items)- Parameters:
items
- The schema of the array items.- Returns:
- A new builder for this object.
-
tArrayMulti
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.MULTI )- Returns:
- A new builder for this object.
-
tArrayMulti
Shortcut for .create ().type(HttpPartDataType.ARRAY ).collectionFormat(HttpPartCollectionFormat.MULTI ).items(items)- Parameters:
items
- The schema of the array items.- Returns:
- A new builder for this object.
-
tObject
Shortcut for .create ().type(HttpPartDataType.OBJECT )- Returns:
- A new builder for this object.
-
tObjectCsv
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.CSV )- Returns:
- A new builder for this object.
-
tObjectPipes
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.PIPES )- Returns:
- A new builder for this object.
-
tObjectSsv
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.SSV )- Returns:
- A new builder for this object.
-
tObjectTsv
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.TSV )- Returns:
- A new builder for this object.
-
tObjectUon
Shortcut for .create ().type(HttpPartDataType.OBJECT ).collectionFormat(HttpPartCollectionFormat.UON )- Returns:
- A new builder for this object.
-
create
Finds the schema information for the specified method parameter.This method will gather all the schema information from the annotations at the following locations:
- The method parameter.
- The method parameter class.
- The method parameter parent classes and interfaces.
-
create
Finds the schema information for the specified method return.This method will gather all the schema information from the annotations at the following locations:
- The method.
- The method return class.
- The method return parent classes and interfaces.
-
create
Finds the schema information for the specified class.This method will gather all the schema information from the annotations on the class and all parent classes/interfaces.
-
create
Shortcut for callingcreate().type(type); - Parameters:
type
- The schema type value.- Returns:
- A new builder.
-
create
Shortcut for callingcreate().type(type).format(format); - Parameters:
type
- The schema type value.format
- The schema format value.- Returns:
- A new builder.
-
create
Finds the schema information on the specified annotation.- Parameters:
a
- The annotation to find the schema information on..- Returns:
- The schema information found on the annotation.
-
create
Finds the schema information on the specified annotation.- Parameters:
a
- The annotation to find the schema information on..defaultName
- The default part name if not specified on the annotation.- Returns:
- The schema information found on the annotation.
-
getParsedType
Returns the default parsed type for this schema.- Returns:
- The default parsed type for this schema. Never
null .
-
getName
Returns the name of the object described by this schema, for example the query or form parameter name.- Returns:
- The name, or
null if not specified. - See Also:
-
getType
Returns thetype field of this schema.- Returns:
- The
type field of this schema, ornull if not specified. - See Also:
-
getType
Returns thetype field of this schema.- Parameters:
cm
- The class meta of the object.
Used to auto-detect the type if the type was not specified.- Returns:
- The format field of this schema, or
null if not specified. - See Also:
-
getDefault
Returns thedefault field of this schema.- Returns:
- The default value for this schema, or
null if not specified. - See Also:
-
getCollectionFormat
Returns thecollectionFormat field of this schema.- Returns:
- The
collectionFormat field of this schema, ornull if not specified. - See Also:
-
getFormat
Returns theformat field of this schema.- Returns:
- The
format field of this schema, ornull if not specified. - See Also:
-
getFormat
Returns theformat field of this schema.- Parameters:
cm
- The class meta of the object.
Used to auto-detect the format if the format was not specified.- Returns:
- The
format field of this schema, ornull if not specified. - See Also:
-
getItems
Returns themaximum field of this schema.- Returns:
- The schema for child items of the object represented by this schema, or
null if not defined. - See Also:
-
getMaximum
Returns themaximum field of this schema.- Returns:
- The
maximum field of this schema, ornull if not specified. - See Also:
-
getMinimum
Returns theminimum field of this schema.- Returns:
- The
minimum field of this schema, ornull if not specified. - See Also:
-
getMultipleOf
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
getPattern
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
getMaxLength
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
getMinLength
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
getMaxItems
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
getMinItems
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
getMaxProperties
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
getMinProperties
Returns thexxx field of this schema.- Returns:
- The
xxx field of this schema, ornull if not specified. - See Also:
-
isExclusiveMaximum
Returns theexclusiveMaximum field of this schema.- Returns:
- The
exclusiveMaximum field of this schema. - See Also:
-
isExclusiveMinimum
Returns theexclusiveMinimum field of this schema.- Returns:
- The
exclusiveMinimum field of this schema. - See Also:
-
isUniqueItems
Returns theuniqueItems field of this schema.- Returns:
- The
uniqueItems field of this schema. - See Also:
-
isRequired
Returns therequired field of this schema.- Returns:
- The
required field of this schema. - See Also:
-
isSkipIfEmpty
Returns theskipIfEmpty field of this schema.- Returns:
- The
skipIfEmpty field of this schema. - See Also:
-
isAllowEmptyValue
Returns theallowEmptyValue field of this schema.- Returns:
- The
skipIfEmpty field of this schema. - See Also:
-
getEnum
Returns theenum field of this schema.- Returns:
- The
enum field of this schema, ornull if not specified. - See Also:
-
getParser
Returns theparser field of this schema.- Returns:
- The
parser field of this schema, ornull if not specified. - See Also:
-
getSerializer
Returns theserializer field of this schema.- Returns:
- The
serializer field of this schema, ornull if not specified. - See Also:
-
validateInput
Throws aParseException
if the specified pre-parsed input does not validate against this schema.- Parameters:
in
- The input.- Returns:
- The same object passed in.
- Throws:
SchemaValidationException
- if the specified pre-parsed input does not validate against this schema.
-
validateOutput
Throws aParseException
if the specified parsed output does not validate against this schema.- Type Parameters:
T
- The return type.- Parameters:
o
- The parsed output.bc
- The bean context used to detect POJO types.- Returns:
- The same object passed in.
- Throws:
SchemaValidationException
- if the specified parsed output does not validate against this schema.
-
getProperty
Returns the schema information for the specified property.- Parameters:
name
- The property name.- Returns:
- The schema information for the specified property, or
null if properties are not defined on this schema.
-
hasProperties
Returnstrue if this schema has properties associated with it.- Returns:
true if this schema has properties associated with it.
-
toString
-