Retained Annotations

To create a retained annotation, you must have a const class which implements "StructureMetadata" or "RetainedAnnotation". That's basically it. The code generator will now know, that the class annotation is relevant at runtime and will store it in the annotation targets generated description. To add functionality to your annotations you can also implement following interfaces to interop with the core framework:

RegistrationHook

Get a callback when the engine registers the default structure converter. This method does not pass its specific annotation target but rather passes the entire converter. This annotation interface should most commonly be used at class-level but is allowed at field-level as well.

APISchemaObjectMetaVisitor (fields only)

You can modify the openapi object of the annotated field using this interface.

ConverterSupplyingVisitor (fields only)

You can specify the converter used by structure converter for this field.

FieldValidator & ClassValidator

See Validators and 5. Validation for further details.

Last updated