Skip to main content
Version: Previous

Metadata annotations

The following annotations are found in the package global.genesis.message.core.annotation and can be applied when defining Kotlin data classes to be used as input I message types.

As an example, these input types can be used in Event Handlers and custom Request Servers (see type-safe messages).

It is important to note that these annotations will influence the automatic generation of relevant Json schema definitions within the backend metadata system, as well as enforcing transparent validation checks.

caution

The UniqueItems annotation will generate a Json schema uniqueItems definition. Unfortunately, the current specification of uniqueItems means that only primitive values will be checked for uniqueness (i.e. string, integer, etc), as opposed to fully fledged object definitions. One of the consequences is that it is currently impossible to use Json Schema and allow for advanced uniqueItems checks, including unique id checks. See discussions around key-based uniqueness in here.

Annotation nameTargetsParametersDescription
TitleProperty and classtitle: StringSuggests a human readable name for the annotated class or property
DescriptionProperty and classdescription: StringSuggests a human description for the annotated class or property
StringConstantPropertyconstant: StringDefines a constant value, which is always expected for a property
MinItemsPropertyminItems: IntDefines a minimum number of items for a list type property
MaxItemsPropertymaxItems: IntDefines a maximum number of items for a list type property
UniqueItemsPropertynoneMarks a list type property as unique items only
MinLengthPropertyminLength: IntDefines a minimum number of characters in a String property
MaxLengthPropertymaxLength: IntDefines a maximum number of characters in a String property
PatternPropertypattern: StringDefines an expected regular expression pattern for a String property
ShortMinPropertymin: ShortDefines the minimum value expected for a Short property
ShortMaxPropertymax: ShortDefines the maximum value expected for a Short property
IntMinPropertymin: IntDefines the minimum value expected for an Int property
IntMaxPropertymax: IntDefines the maximum value expected for an Int property
LongMinPropertymin: LongDefines the minimum value expected for a Long property
LongMaxPropertymax: LongDefines the maximum value expected for a Long property
DoubleMinPropertymin: DoubleDefines the minimum value expected for a Double property
DoubleMaxPropertymax: DoubleDefines the maximum value expected for a Double property
BigDecimalMinPropertymin: StringDefines the minimum value expected for a BigDecimal property
BigDecimalMaxPropertymax: StringDefines the maximum value expected for a BigDecimal property