Configuration

The processor reads the configuration from the (mandatory) mapping.yaml file. It does contain some general options and the mapping type information.

A mapping yaml looks like this:

options:
  package-name: io.openapiprocessor.sample
  bean-validation: true

map:
   # java type mappings

options:

  • package-name: (required) the root package name of the generated interfaces & models. The package folder tree will be created inside the targetDir (see using gradle).

    Interfaces and models will be generated into the api and model subpackages of package-name.

    • so the final package name of the generated interfaces will be "${package-name}.api",

    • and the final package name of the generated models will be "${package-name}.model"

  • bean-validation (optional, true or false) enables generation of bean validation annotations. Default is false. See Bean Validation.

map:

Using type mapping we can tell the processor to map types (schemas) from an openapi.yaml description to a specific existing java type instead of generating a model class from the source OpenAPI type.

This is one of the core features and has his own description in mapping.