Skip to content
Snippets Groups Projects

OpenAPI Model Generation

This module generates model classes from the open-api specification of the submission api.

Usage: mvn compile exec:java generates all models into the package de.fitko.fitconnect.api.domain.model.submission under target/generated-sources/openapi/gen.

Config

The relevant config parameters are listed below.


<configuration>
    <!-- open api spec url -->
    <inputSpec>${submission-api.baseurl}/${submission-api.version}/${submission-api.spec}</inputSpec>

    <!-- language generator -->
    <generatorName>java</generatorName>

    <!-- validation is currently disabled, otherwise the generation fails due to duplicate entries -->
    <skipValidateSpec>true</skipValidateSpec>

    <!-- use jackson annotations -->
    <library>resttemplate</library>

    <!-- target package name -->
    <modelPackage>de.fitko.fitconnect.api.domain.model.submission</modelPackage>

    <!-- target folder to write files into -->
    <configOptions>
        <sourceFolder>../../../src/main/java</sourceFolder>
    </configOptions>
</configuration>

Draft/Todo PostProcessing

The de.fitko.fitconnect.api.postprocessing.ModelClassPostProcessor is running in a maven execute step and replaces all comments and unwanted annotations.

Currently, there are some @Nullable and @NonNull annotations from javax.annotations that need to be replaced.

In a further step the cleaned and post-processed model classes can be updated in the original api/domain/model package of the api module via the maven resource plugin.