Skip to content

3. Features

dzikoysk edited this page Dec 10, 2022 · 2 revisions

Annotations

Kotlin note: Use @get: prefix on property annotations to enforce Kotlin compiler to attach them on property getters in bytecode. It's required by Java's annotation processor mechanism.

OpenAPI

Annotation Description
@OpenApi The main annotation provided by this plugin used to describe one endpoint

OpenApi Entities

Set of classes that help to describe properties of types used in OpenApi specification.

Annotation Description
@OpenApiPropertyType(Class) Changes type of this property to the new one. For instance you can replace MyMagicId with String.
@OpenApiName(String) Set custom name of poperty
@OpenApiIgnore Ignore this property in specification
@OpenApiExample Provide example usage of this property
@OpenApiByFields(Visibility) By default generator processes only getters, but you can enforce generator to scan fields as well

JsonSchema

Classes annotated with @JsonSchema are processed by annotation processor and for each such class a new resource file is generated in /json-schemes/ directory. All JsonSchema annotations can be used in OpenApi scheme as well, because OpenApi & JsonSchema use the same implementation of type schema generator.

Annotation Description
@JsonSchema The main annotation provided by this plugin used to describe one endpoint
@OneOf / @AnyOf / @AllOf Associate list of classes with given type using one of these JsonScheme combinators
@Custom(name = String, value = String) Provide custom ket-value property for this entry

You can also create a new custom annotation using @CustomAnnotation to aggregate set of custom properties you want to attach to your scheme.

Clone this wiki locally