Skip to content

Supported OpenAPI Specification properties

Christopher Molin edited this page Dec 13, 2024 · 7 revisions

The following are OpenAPI Specification properties which are supported. Other properties may be ignored, or may cause problems.

Note

The following properties are referring to the schema definitions, prefixed by components.schemas.{schema}.

Property Description Value Value Description
{schema} Name of the generated Java class. *
{schema}.type Type of the generated Java class. object Generates a Record class.
enum Generates an Enum class.
{schema}.description JavaDoc description of the generated Java class. * If not set, adds the class name as a placeholder in the JavaDoc description.
{schema}.deprecated Marks the generated Java class as Deprecated. true Annotates the class with @Deprecated and adds @deprecated to the JavaDoc description.
false (default) Does nothing.
{schema}.properties Fields of the generated Record class. *
{schema}.properties.{property} Name of the field. * Added as a @param in the JavaDoc.
{schema}.properties.{property}.description Description of the field. * Description of the @param in the JavaDoc. If not set, the class name of the field will be added as a description.
{schema}.properties.{property}.default Default value of the field. * If set, the field is set to the default value if the provided value is null. (Using Objects.requireNonNullElse())
{schema}.properties.{property}.nullable Marks the field with @Nullable-annotations. true Annotates the field with @Nullable.
false (default) Annotates the field with @Nonnull. This will be annotated @Nullable in the constructor, if default has been set.
{schema}.properties.{property}.$ref Type of the field is another Java class. *
{schema}.properties.{property}.type Type of the field. array Generates the field as List<{items.type}>.
boolean Generates the field as Boolean.
enum Generates the field as an enum type.
integer Generates the field as Integer.
number Generates the field as BigDecimal.
object Generates the field as an object.
string Generates the field as String.
{schema}.properties.{property}.x-enum-descriptions Description of each enum constant. array Generates JavaDocs for each enum constant.
{schema}.x-class-extra-annotation Extra annotations of the class. array Only supports record classes. Annotates classes with these annotations. The property can be set as a single string (for one annotation), or as a literal block |- for multiple annotations.
{schema}.properties.{property}.x-field-extra-annotation Extra annotations of the field. array Only supports fields. Annotates fields with these annotations. The property can be set as a single string (for one annotation), or as a literal block |- for multiple annotations.