@Target(value={FIELD,METHOD,PARAMETER,TYPE}) @Retention(value=RUNTIME) @Repeatable(value=Extensions.class) public @interface Extension
x-
or else an invalid document will potentially be created.
Although this annotation may currently be placed directly on a Java language element target, application developers
should instead utilize the extensions
property of the particular annotation that corresponds to the model
being extended. Use of the annotation directly on a Java element is often ambiguous and it may result in the
extension being added to an incorrect location in the OpenAPI model. Future releases of MicroProfile OpenAPI may
remove the capability of placing this annotation directly on a Java element.
When @Extension
annotations are used both directly on a Java element as well as within another annotation
that targets the same Java element, implementations will apply only the nested extensions to the resulting model.
Example of preferred use with @Extension
nested within an @Schema
annotation:
class MyPojo { @Schema( type = SchemaType.STRING, extensions = @Extension( name = "x-custom-property", value = "custom-value") String property1; }
Example of deprecated use with @Extension
placed directly on a field implied to be a schema
property:
class MyPojo { @Extension( name = "x-custom-property", value = "custom-value") String property1; }
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
name
A name for the extension.
|
java.lang.String |
value
The extension value.
|
Modifier and Type | Optional Element and Description |
---|---|
boolean |
parseValue
Should the value be parsed into an object/array or other simple type (number, boolean, etc) or left as a simple
String.
|
public abstract java.lang.String name
x-
or else an invalid document will
potentially be created.x-
public abstract java.lang.String value
public abstract boolean parseValue