Class ExpandedTypeDescription
TypeDescription
that handles:
- nested enums,
- extensible types,
- references, and
- additional properties (which can be either Boolean or Schema).
The OpenAPI document format uses lower-case enum names and values, while the SmallRye definitions use upper-case. This class simplifies adding the special handling for enums declared within a particular class.
Some of the MP OpenAPI items are extensible, meaning they accept sub-item keys with the
"x-" prefix. This class supports extensions. For scalars it delegates to the normal
SnakeYAML processing to correctly type and parse the scalar. For sequences it
creates List
s. For mappings it creates Map
s. The sub-nodes of the lists and
maps are handled by the normal SnakeYAML parsing, so the resulting elements in lists and
maps are of the SnakeYAML-inferred types.
A sub-node $ref
maps to the ref
property on the MP OpenAPI types. This type
description simplifies defining the $ref
property to those types that support it.
In schemas, the additionalProperties
value can be either a boolean or a schema. The MicroProfile
Schema
type exposes getAdditionalPropertiesBoolean
,
setAdditionalPropertiesBoolean
, getAdditionalPropertiesSchema
, and setAdditionalPropertiesSchema
methods. We do not know until runtime and the value is available for each additionalProperties
instance which
type (Boolean or Schema) to use, so we cannot just prepare a smart SnakeYAML Property
implementation. Instead
we augment the schema-specific TypeDescription
so it knows how to decide, at runtime, what to do.
We use this expanded version of TypeDescription
with the generated SnakeYAMLParserHelper class.
-
Field Summary
Fields inherited from class org.yaml.snakeyaml.TypeDescription
beanAccess, excludes, includes
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addExcludes
(String... propNames) Add property names excludes.Adds property handling for extensions.addRef()
Adds property handling for a$ref
reference.static ExpandedTypeDescription
Factory method for ease of chaining other method invocations.org.yaml.snakeyaml.introspector.Property
getProperty
(String name) boolean
Whether a default value exists.Class
<?> impl()
Returns the implementation class associated with this type descr.newInstance
(String propertyName, org.yaml.snakeyaml.nodes.Node node) boolean
setupPropertyType
(String key, org.yaml.snakeyaml.nodes.Node valueNode) Methods inherited from class org.yaml.snakeyaml.TypeDescription
addPropertyParameters, finalizeConstruction, getProperties, getTag, getType, newInstance, putListPropertyType, putMapPropertyType, setExcludes, setIncludes, setProperty, setPropertyUtils, substituteProperty, substituteProperty, toString
-
Method Details
-
create
Factory method for ease of chaining other method invocations.- Parameters:
clazz
- interface type to describeimpl
- implementation class for the interface- Returns:
- resulting TypeDescription
-
addRef
Adds property handling for a$ref
reference.- Returns:
- this type description
-
addExtensions
Adds property handling for extensions.- Returns:
- this type description
-
getProperty
- Overrides:
getProperty
in classorg.yaml.snakeyaml.TypeDescription
-
setupPropertyType
- Overrides:
setupPropertyType
in classorg.yaml.snakeyaml.TypeDescription
-
newInstance
- Overrides:
newInstance
in classorg.yaml.snakeyaml.TypeDescription
-
addExcludes
Add property names excludes.- Parameters:
propNames
- names to exclude
-
impl
Returns the implementation class associated with this type descr.- Returns:
- implementation class
-
hasDefaultProperty
public boolean hasDefaultProperty()Whether a default value exists.- Returns:
true
if default value property is defined
-