public class OpenApiDataObjectScanner extends Object
Schema
from the entities encountered.
A depth first search is performed, with the following precedence (high to low):
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.
Schema Annotation
,
Schema Object
Modifier and Type | Field and Description |
---|---|
static org.jboss.jandex.Type |
ARRAY_TYPE_OBJECT |
static org.jboss.jandex.DotName |
COLLECTION_INTERFACE_NAME |
static org.jboss.jandex.Type |
COLLECTION_TYPE |
static org.jboss.jandex.DotName |
ENUM_INTERFACE_NAME |
static org.jboss.jandex.Type |
ENUM_TYPE |
static org.jboss.jandex.DotName |
MAP_INTERFACE_NAME |
static org.jboss.jandex.Type |
MAP_TYPE |
static org.jboss.jandex.Type |
OBJECT_TYPE |
static org.jboss.jandex.DotName |
SET_INTERFACE_NAME |
static org.jboss.jandex.Type |
SET_TYPE |
static org.jboss.jandex.Type |
STRING_TYPE |
Constructor and Description |
---|
OpenApiDataObjectScanner(org.jboss.jandex.IndexView index,
org.jboss.jandex.Type classType)
Constructor for data object scanner.
|
Modifier and Type | Method and Description |
---|---|
static org.eclipse.microprofile.openapi.models.media.Schema |
process(org.jboss.jandex.IndexView index,
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.
|
public static final org.jboss.jandex.Type OBJECT_TYPE
public static final org.jboss.jandex.DotName COLLECTION_INTERFACE_NAME
public static final org.jboss.jandex.Type COLLECTION_TYPE
public static final org.jboss.jandex.DotName MAP_INTERFACE_NAME
public static final org.jboss.jandex.Type MAP_TYPE
public static final org.jboss.jandex.DotName SET_INTERFACE_NAME
public static final org.jboss.jandex.Type SET_TYPE
public static final org.jboss.jandex.DotName ENUM_INTERFACE_NAME
public static final org.jboss.jandex.Type ENUM_TYPE
public static final org.jboss.jandex.Type STRING_TYPE
public static final org.jboss.jandex.Type ARRAY_TYPE_OBJECT
public OpenApiDataObjectScanner(org.jboss.jandex.IndexView index, org.jboss.jandex.Type classType)
Call process()
to build and return the Schema
.
index
- index of types to scanclassType
- root to begin scanpublic static org.eclipse.microprofile.openapi.models.media.Schema process(org.jboss.jandex.IndexView index, org.jboss.jandex.Type type)
index
- index of types to scantype
- root to begin scanpublic static org.eclipse.microprofile.openapi.models.media.Schema process(org.jboss.jandex.PrimitiveType primitive)
primitive
- root to begin scanCopyright © 2018–2020. All rights reserved.