Package dk.mada.jaxrs.openapi
Interface SchemaParser
- All Known Implementing Classes:
SchemaParserV30,SchemaParserV31
public interface SchemaParser
OpenApi Schema parser.
Specifications are available at https://spec.openapis.org/
-
Method Summary
Modifier and TypeMethodDescriptiondefault List<io.swagger.v3.oas.models.media.Schema> Returns the anyOf schemas.Returns enumeration values.@Nullable Stringformat()Returns the schema format, or null.default io.swagger.v3.oas.models.media.Schema<?> Returns the schema defining the inner type of a map.default booleanisAllOf()Returns true if this schema represents a combination of types.booleanisAnyOf()Returns true if the schema defines a composition by anyOf.booleanisArray()Returns true if the schema defines an array.booleanisBinary()Returns true if the schema is a binary stream of data.booleanisDate(boolean acceptBrokenType) Returns true if the schema defines a date.booleanisDateTime(boolean acceptBrokenType) Returns if the schema defines a date-time.default booleanReturns true if this schema defines an enumeration.default booleanDetects free-form objects.booleanisMap()Returns true if the schema defines a map.booleanReturns true if the type is nullable.booleanisNumber()Returns true if the schema defines a number.booleanisObject()Returns true if the schema defines an object.booleanisOneOf()Returns true if the schema defines a composition by oneOf.default booleanisRef()Returns true if the schema contains a reference to another type.booleanisString()Returns true if the schema defines a string.default booleanisTime()Returns true if this schema defines (just) time.default booleanReturns true if no type is defined for the schema.default booleanisUnique()Returns true if the schema defines unique items (is a set).default io.swagger.v3.oas.models.media.Schema<?> Returns the schema for the contained items.default @Nullable Stringname()Returns the schema name, or null.static SchemaParserof(io.swagger.v3.oas.models.media.Schema<?> schema) Returns a parser suitable for the given schema.default List<io.swagger.v3.oas.models.media.Schema> Returns the oneOf schemas.io.swagger.v3.oas.models.media.Schema<?> schema()Returns the OpenApi schema this parser operates on.@Nullable Stringtype()Returns the schema type, or null.
-
Method Details
-
schema
io.swagger.v3.oas.models.media.Schema<?> schema()Returns the OpenApi schema this parser operates on.- Returns:
- the OpenApi schema this parser operates on
-
name
Returns the schema name, or null.- Returns:
- the schema name, or null
-
type
@Nullable String type()Returns the schema type, or null.- Returns:
- the schema type, or null
-
isTypeless
default boolean isTypeless()Returns true if no type is defined for the schema. This is used to recognize the empty, non-boolean variant of free-form objects:schema: type: object additionalProperties: {}- Returns:
- true if no type is defined for the schema
-
format
@Nullable String format()Returns the schema format, or null.- Returns:
- the schema format, or null
-
itemsSchema
default io.swagger.v3.oas.models.media.Schema<?> itemsSchema()Returns the schema for the contained items.- Returns:
- the schema for the contained items
-
isAnyOf
boolean isAnyOf()Returns true if the schema defines a composition by anyOf.- Returns:
- true if the schema defines a composition by anyOf
-
anyOfSchemas
Returns the anyOf schemas.- Returns:
- the anyOf schemas
-
isOneOf
boolean isOneOf()Returns true if the schema defines a composition by oneOf.- Returns:
- true if the schema defines a composition by oneOf
-
oneOfSchemas
Returns the oneOf schemas.- Returns:
- the oneOf schemas
-
isArray
boolean isArray()Returns true if the schema defines an array.- Returns:
- true if the schema defines an array
-
isDate
boolean isDate(boolean acceptBrokenType) Returns true if the schema defines a date.- Parameters:
acceptBrokenType- if true, allows null/date to be recognized as a date- Returns:
- true if the schema defines a date
-
isDateTime
boolean isDateTime(boolean acceptBrokenType) Returns if the schema defines a date-time.- Parameters:
acceptBrokenType- if true, allows null/date-time to be recognized as a date-time- Returns:
- if the schema defines a date-time
-
isMap
boolean isMap()Returns true if the schema defines a map.- Returns:
- true if the schema defines a map
-
getMapInnerSchema
default io.swagger.v3.oas.models.media.Schema<?> getMapInnerSchema()Returns the schema defining the inner type of a map. This should only be called if the map is not a free-form object.- Returns:
- the schema defining the inner type of a map
- See Also:
-
isFreeFormObject
default boolean isFreeFormObject()Detects free-form objects. This is only relevant for map-types. See https://swagger.io/docs/specification/v3_0/data-models/dictionaries/ (search for Free-Form Objects)- Returns:
- true if the schema looks like a free-form object
-
isNullable
boolean isNullable()Returns true if the type is nullable.- Returns:
- true if the type is nullable
-
isNumber
boolean isNumber()Returns true if the schema defines a number.- Returns:
- true if the schema defines a number
-
isObject
boolean isObject()Returns true if the schema defines an object.- Returns:
- true if the schema defines an object
-
isRef
default boolean isRef()Returns true if the schema contains a reference to another type.- Returns:
- true if the schema contains a reference to another type
-
isString
boolean isString()Returns true if the schema defines a string.- Returns:
- true if the schema defines a string
-
isTime
default boolean isTime()Returns true if this schema defines (just) time.- Returns:
- true if this schema defines (just) time
-
isUnique
default boolean isUnique()Returns true if the schema defines unique items (is a set).- Returns:
- true if the schema defines unique items (is a set)
-
isAllOf
default boolean isAllOf()Returns true if this schema represents a combination of types. TODO: probably close to new array of types? TODO: rename, something like isCombinedType- Returns:
- true if this schema represents a combination of types
-
isBinary
boolean isBinary()Returns true if the schema is a binary stream of data.- Returns:
- true if the schema is a binary stream of data
-
isEnumeration
default boolean isEnumeration()Returns true if this schema defines an enumeration.- Returns:
- true if this schema defines an enumeration
-
enumerationValues
Returns enumeration values.- Returns:
- enumeration values
-
of
Returns a parser suitable for the given schema. Uses the schema's specification version to determine the parser implementation to use.- Parameters:
schema- the schema to provide a parser for- Returns:
- a parser suitable for the given schema
-