Class OpenApiDataObjectScanner
Schema
from the entities encountered.
A depth first search is performed, with the following precedence (high to low):
- Explicitly provided attributes/overrides on @Schema annotated elements. Note that some attributes have special behaviours: for example, ref is mutually exclusive, and implementation replaces the implementation entirely.
- Unannotated fields unless property openapi.infer-unannotated-types set false
- Inferred attributes, such as name, type, format, etc.
Well-known types, such as Collection, Map, Date, etc, are handled in a custom manner.
Jandex-indexed objects from the user's deployment are traversed until a terminal type is
met (such as a primitive, boxed primitive, date, etc), or an entity is encountered that is not
well-known or is not in the Jandex IndexView
.
Current Limitations:
If a type is not available in the provided IndexView then it is not accessible. Excepting
well-known types, this means non-deployment objects may not be scanned.
Future work could consider making the user's deployment classes available to this classloader, with additional code to traverse non-Jandex types reachable from this classloader. But, this is troublesome for performance, security and initialisation reasons -- particular caution would be needed to avoid accidental initialisation of classes that may have externally visible side-effects.
- Author:
- Marc Savy <[email protected]>
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.jboss.jandex.Type
static final org.jboss.jandex.DotName
static final org.jboss.jandex.Type
static final org.jboss.jandex.DotName
static final org.jboss.jandex.Type
static final org.jboss.jandex.DotName
static final org.jboss.jandex.Type
static final org.jboss.jandex.DotName
static final org.jboss.jandex.Type
static final org.jboss.jandex.DotName
static final org.jboss.jandex.Type
static final org.jboss.jandex.Type
-
Constructor Summary
ConstructorsConstructorDescriptionOpenApiDataObjectScanner
(AnnotationScannerContext context, org.jboss.jandex.AnnotationTarget annotationTarget, org.jboss.jandex.Type classType) OpenApiDataObjectScanner
(AnnotationScannerContext context, org.jboss.jandex.Type classType) Constructor for data object scanner. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.eclipse.microprofile.openapi.models.media.Schema
process
(AnnotationScannerContext context, org.jboss.jandex.Type type) Build a Schema with ClassType as root.static org.eclipse.microprofile.openapi.models.media.Schema
process
(org.jboss.jandex.PrimitiveType primitive) Build a Schema with PrimitiveType as root.
-
Field Details
-
ITERABLE_INTERFACE_NAME
public static final org.jboss.jandex.DotName ITERABLE_INTERFACE_NAME -
ITERABLE_TYPE
public static final org.jboss.jandex.Type ITERABLE_TYPE -
STREAM_INTERFACE_NAME
public static final org.jboss.jandex.DotName STREAM_INTERFACE_NAME -
STREAM_TYPE
public static final org.jboss.jandex.Type STREAM_TYPE -
MAP_INTERFACE_NAME
public static final org.jboss.jandex.DotName MAP_INTERFACE_NAME -
MAP_TYPE
public static final org.jboss.jandex.Type MAP_TYPE -
SET_INTERFACE_NAME
public static final org.jboss.jandex.DotName SET_INTERFACE_NAME -
SET_TYPE
public static final org.jboss.jandex.Type SET_TYPE -
ENUM_INTERFACE_NAME
public static final org.jboss.jandex.DotName ENUM_INTERFACE_NAME -
ENUM_TYPE
public static final org.jboss.jandex.Type ENUM_TYPE -
STRING_TYPE
public static final org.jboss.jandex.Type STRING_TYPE -
ARRAY_TYPE_OBJECT
public static final org.jboss.jandex.Type ARRAY_TYPE_OBJECT
-
-
Constructor Details
-
OpenApiDataObjectScanner
Constructor for data object scanner.Call
process()
to build and return theSchema
.- Parameters:
context
- scanning contextclassType
- root to begin scan
-
OpenApiDataObjectScanner
public OpenApiDataObjectScanner(AnnotationScannerContext context, org.jboss.jandex.AnnotationTarget annotationTarget, org.jboss.jandex.Type classType)
-
-
Method Details
-
process
public static org.eclipse.microprofile.openapi.models.media.Schema process(AnnotationScannerContext context, org.jboss.jandex.Type type) Build a Schema with ClassType as root.- Parameters:
context
- scanning contexttype
- root to begin scan- Returns:
- the OAI schema
-
process
public static org.eclipse.microprofile.openapi.models.media.Schema process(org.jboss.jandex.PrimitiveType primitive) Build a Schema with PrimitiveType as root.- Parameters:
primitive
- root to begin scan- Returns:
- the OAI schema
-