Skip to content

BlackBeltTechnology/judo-psm-generator-jaxrs

Repository files navigation

judo-psm-generator-jaxrs

PSM based JUDO Jakarta RESTful Web Services Java generator

It can be used as:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>hu.blackbelt.judo.archetype</groupId>
    <artifactId>judo-psm-generator-jaxrs-example</artifactId>
    <version>${revision}</version>
    <packaging>pom</packaging>

    <name>JUDO PSM Generator Jakarta RESTful Web Services test</name>
    <description>JUDO PSM Jakarta RESTful Web Services Generator Example.</description>

    <properties>
        <revision>1.0.0-SNAPSHOT</revision>
        <maven>3.9.4</maven>

        <judo-psm-generator-jaxrs>1.0.0</judo-psm-generator-jaxrs>
        <judo-meta-psm-version>1.1.0</judo-meta-psm-version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>hu.blackbelt.judo.meta</groupId>
                <artifactId>judo-psm-generator-maven-plugin</artifactId>
                <version>${judo-meta-psm-version}</version>
                <executions>
                    <execution>
                        <id>execute-psm-rest-generation</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <uris>
                                <uri>mvn:hu.blackbelt.judo.generator:judo-psm-generator-jaxrs-common:${judo-psm-generator-jaxrs-version}</uri>
                                <uri>mvn:hu.blackbelt.judo.generator:judo-psm-generator-jaxrs-api:${judo-psm-generator-jaxrs-version}</uri>
                                <uri>mvn:hu.blackbelt.judo.generator:judo-psm-generator-jaxrs-impl:${judo-psm-generator-jaxrs-version}</uri>
                                <uri>mvn:hu.blackbelt.judo.generator:judo-psm-generator-jaxrs-osgi:${judo-psm-generator-jaxrs-version}</uri>
                            </uris>
                            <helpers>
                                <helper>hu.blackbelt.judo.psm.generator.jaxrs.PsmModelHelper</helper>
                            </helpers>
                            <type>psm-jaxrs</type>
                            <contextAccessor>hu.blackbelt.judo.psm.generator.jaxrs.api.StoredVariableHelper</contextAccessor>
                            <scanPackages>
                                hu.blackbelt.judo.generator.commons,
                                hu.blackbelt.judo.psm.generator.jaxrs
                            </scanPackages>
                            <templateParameters>
                                <debugPrint>true</debugPrint>
                                <apiPrefix>${project.groupId}.model-name.api</apiPrefix>
                                <implPrefix>${project.groupId}.model-name.impl</implPrefix>
                                <osgiPrefix>${project.groupId}.model-name.osgi</osgiPrefix>
                                <generateOpenApiAnnotations>true</generateOpenApiAnnotations>
                                <baseUrl>base-url-of-your-application</baseUrl>
                                <authenticationUrl>authentication-url</authenticationUrl>
                                <specificationVersionNumber>version-number-of-your-specification</specificationVersionNumber>
                            </templateParameters>
                            <psm>
                                mvn:your.psm.model.group.id:your.psm.model.artifact.id:your.psm.model.version!model-name-in-jar.model
                            </psm>
                            <destination>${basedir}/target/generated-sources</destination>
                        </configuration>
                    </execution>
                </executions>

                <dependencies>
                    <dependency>
                        <groupId>hu.blackbelt.judo.meta</groupId>
                        <artifactId>hu.blackbelt.judo.meta.psm.model.[ModelName]</artifactId>
                        <version>${judo-meta-psm-version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

This example generates a complete project setup into target/generated-sources directory. In a project this generation can be placed in the model project as a profile.

The generateOpenApiAnnotations template parameter determines whether the annotations required for OpenAPI documentation generation should be generated or not.

The baseUrl template parameter specifies the prefix of the URL of the application in the OpenAPI documentation. In the OpenAPI documentation, the URL is constructed as follows: {baseUrl}/api/{model-name}/{actor-name}/{actor-name}.

The authenticationUrl template parameter defines the prefix of the openIdConnectUrl in the OpenAPI documentation. In the OpenAPI documentation, the openIdConnectUrl is structured as follows: `{authenticationUrl}/auth/realms/{realm-name}/.well-known/openid-configuration.

The specificationVersionNumber template parameter defines the version number of the OpenAPI specification.

If the generateOpenApiAnnotations parameter is set to false or not specified, the baseUrl, specificationVersionNumber and authenticationUrl parameters will not be considered.

The judo-psm-generator-maven-plugin documentation is placed inside the plugin documentation itself. https://github.com/BlackBeltTechnology/judo-meta-psm