Class SchemaFactory
- java.lang.Object
-
- io.smallrye.openapi.runtime.io.schema.SchemaFactory
-
public class SchemaFactory extends Object
- Author:
- Marc Savy <marc@rhymewithgravy.com>
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.microprofile.openapi.models.media.SchemaenumToSchema(AnnotationScannerContext context, org.jboss.jandex.Type enumType)Convert a Jandex enum class type to aSchemamodel.static org.eclipse.microprofile.openapi.models.media.SchemaincludeTypeSchema(AnnotationScannerContext context, org.eclipse.microprofile.openapi.models.media.Schema schema, org.jboss.jandex.Type type)static org.eclipse.microprofile.openapi.models.media.SchemareadSchema(AnnotationScannerContext context, org.eclipse.microprofile.openapi.models.media.Schema schema, org.jboss.jandex.AnnotationInstance annotation, Map<String,Object> defaults)static org.eclipse.microprofile.openapi.models.media.SchemareadSchema(AnnotationScannerContext context, org.eclipse.microprofile.openapi.models.media.Schema schema, org.jboss.jandex.AnnotationInstance annotation, org.jboss.jandex.ClassInfo clazz)Populates the schema using the@Schemaon the provided class.static org.eclipse.microprofile.openapi.models.media.SchemareadSchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance schemaAnnotation)Reads a Schema annotation into a model.static org.eclipse.microprofile.openapi.models.media.SchemareadSchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationValue value)Reads a Schema annotation into a model.static org.eclipse.microprofile.openapi.models.media.SchemaschemaRegistration(AnnotationScannerContext context, org.jboss.jandex.Type type, org.eclipse.microprofile.openapi.models.media.Schema schema)Register the provided schema in the SchemaRegistry if allowed.static org.eclipse.microprofile.openapi.models.media.SchematypeToSchema(AnnotationScannerContext context, org.jboss.jandex.Type type, org.jboss.jandex.AnnotationInstance schemaAnnotation, List<AnnotationScannerExtension> extensions)Converts a Jandex type to aSchemamodel.
-
-
-
Method Detail
-
readSchema
public static org.eclipse.microprofile.openapi.models.media.Schema readSchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationValue value)
Reads a Schema annotation into a model.- Parameters:
context- scanning contextvalue- the annotation value- Returns:
- Schema model
-
readSchema
public static org.eclipse.microprofile.openapi.models.media.Schema readSchema(AnnotationScannerContext context, org.jboss.jandex.AnnotationInstance schemaAnnotation)
Reads a Schema annotation into a model.- Parameters:
context- scanning contextschemaAnnotation- the@Schemaannotation- Returns:
- Schema model
-
readSchema
public static org.eclipse.microprofile.openapi.models.media.Schema readSchema(AnnotationScannerContext context, org.eclipse.microprofile.openapi.models.media.Schema schema, org.jboss.jandex.AnnotationInstance annotation, org.jboss.jandex.ClassInfo clazz)
Populates the schema using the@Schemaon the provided class. If the schema has already been registered (in components), the existing registration will be replaced.- Parameters:
context- scanning contextschema- schema model to populateannotation- schema annotation to readclazz- the class annotated with@Schema- Returns:
- the schema, possibly replaced if
implementationhas been specified in the annotation
-
readSchema
public static org.eclipse.microprofile.openapi.models.media.Schema readSchema(AnnotationScannerContext context, org.eclipse.microprofile.openapi.models.media.Schema schema, org.jboss.jandex.AnnotationInstance annotation, Map<String,Object> defaults)
-
includeTypeSchema
public static org.eclipse.microprofile.openapi.models.media.Schema includeTypeSchema(AnnotationScannerContext context, org.eclipse.microprofile.openapi.models.media.Schema schema, org.jboss.jandex.Type type)
-
typeToSchema
public static org.eclipse.microprofile.openapi.models.media.Schema typeToSchema(AnnotationScannerContext context, org.jboss.jandex.Type type, org.jboss.jandex.AnnotationInstance schemaAnnotation, List<AnnotationScannerExtension> extensions)
Converts a Jandex type to aSchemamodel.- Parameters:
context- scanning contexttype- the implementation type of the item to scanextensions- list of AnnotationScannerExtensions- Returns:
- Schema model
-
enumToSchema
public static org.eclipse.microprofile.openapi.models.media.Schema enumToSchema(AnnotationScannerContext context, org.jboss.jandex.Type enumType)
Convert a Jandex enum class type to aSchemamodel. Adds each enum constant name to the list of the given schema's enumeration list. Enumeration values are obtained preferring values from any method annotated with Jackson's `@JsonValue`, if present. The enum class must be loaded in the context's ClassLoader to perform the value extraction. If the annotation is not present, is not located on a supplier method, or any reflection error occurs, the enumeration values will default to the enum constant names listed in the ClassInfo. The given type must be found in the index.- Parameters:
context- scanning contextenumType- type containing Java Enum constants- Returns:
- Schema model
- See Also:
Field.isEnumConstant()
-
schemaRegistration
public static org.eclipse.microprofile.openapi.models.media.Schema schemaRegistration(AnnotationScannerContext context, org.jboss.jandex.Type type, org.eclipse.microprofile.openapi.models.media.Schema schema)
Register the provided schema in the SchemaRegistry if allowed.- Parameters:
context- scanning contexttype- the type of the schema to registerschema- a schema- Returns:
- a reference to the registered schema or the input schema when registration is not allowed/possible
-
-