Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 2.31 KB

README.md

File metadata and controls

72 lines (53 loc) · 2.31 KB

Json schema generator plugin

The module provide generation of json schemas by POJO models with using "javax.validation"

Getting Started

execute generation: mvn json-schema-generator:generate

setup

add plugin in pom

configuration example:

<project>
    <build>
        <plugins>
            <plugin>
                <groupId>io.github.phantomstr.testing-tools</groupId>
                <artifactId>json-schema-generator</artifactId>
                <version>1.0.2-SNAPSHOT</version>
                <configuration>
                    <packages>
                        <package>my.project.models</package>
                    </packages>
                    <includes>
                        <include>Dto.*</include>
                        <include>.*Model</include>
                    </includes>
                    <excludes>
                        <exclude>.*Assert</exclude>
                    </excludes>
                    <targetDirectory>/src/main/resources/model/schema</targetDirectory>
                    <pojoClassesDirectory>${project.build.outputDirectory}</pojoClassesDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

package - using for filtering classes.
If found class start with one of package - it will be used for generation.
default value "**" - all packages will be involved in generation

include - using for filtering classes.
If a class match is found with one of the "include" regular expressions, it will be used for generation.
default value "**" - all packages will be involved in generation

exclude - using for filtering classes.
If a class match is found with one of the "exclude" regular expressions, it will be ignored.
default value "" - all packages will be involved in generation

targetDirectory - path to directory for schemas generation.
defaultValue = ${project.build.sourceDirectory}/schemas

pojoClassesDirectory - root directory with generated classes for models
default value "${project.build.outputDirectory}"

Prerequisites

  • Classes for that schemas are generating should be already compiled

Built With

  • Maven - Dependency Management

Versioning

We use SemVer for versioning.