Skip to content

Available Maven Plugin Settings

dermakov edited this page Dec 26, 2021 · 13 revisions

The main way to configure Kobby Maven Plugin is to use plugin execution configuration. The script below shows all available plugin settings with default values in pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/maven-v4_0_0.xsd">
    <build>
        <plugins>
            <plugin>
                <groupId>io.github.ermadmi78</groupId>
                <artifactId>kobby-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate-kotlin</goal>
                        </goals>
                        <configuration>
                            <!-- Schema location and parsing rules configuration -->
                            <schema>
                                <!-- List of GraphQL schema files to generate Kobby DSL -->
                                <!-- By default all `**/*.graphqls` files in `src/main/resources` -->
                                <files>
                                    <file>src/main/resources/my/project/country.graphqls</file>
                                </files>

                                <!-- Configuration of schema files location scanning -->
                                <scan>
                                    <!-- Configuration of schema files location scanning -->
                                    <dir>src/main/resources</dir>

                                    <!-- List of ANT style include patterns to scan schema files -->
                                    <includes>
                                        <include>**/*.graphqls</include>
                                    </includes>

                                    <!-- List of ANT style exclude patterns to scan schema files -->
                                    <excludes>
                                    </excludes>
                                </scan>

                                <!-- Configuration of Kobby GraphQL directives parsing -->
                                <directive>
                                    <!-- Name of `primaryKey` directive -->
                                    <primaryKey>primaryKey</primaryKey>

                                    <!-- Name of `required` directive -->
                                    <required>required</required>

                                    <!-- Name of `default` directive -->
                                    <default>default</default>

                                    <!-- Name of `selection' directive -->
                                    <selection>selection</selection>

                                    <!-- Name of `resolve` directive -->
                                    <resolve>resolve</resolve>
                                </directive>
                            </schema>

                            <!-- Configuration of Kotlin DSL generation -->
                            <kotlin>
                                <!-- Is Kotlin DSL generation enabled-->
                                <enabled>true</enabled>

                                <!-- Mapping GraphQL scalars to Kotlin classes -->
                                <scalars>
                                    <!-- This example maps `JSON` scalar to `Map<String, Any?>` class -->
                                    <!-- GraphQL scalar name-->
                                    <JSON>
                                        <!-- Kotlin package name-->
                                        <packageName>kotlin.collections</packageName>

                                        <!-- Kotlin class name-->
                                        <className>Map</className>

                                        <!-- List of Kotlin class generics -->
                                        <generics>
                                            <generic>
                                                <!-- Generic package name -->
                                                <packageName>kotlin</packageName>

                                                <!-- Generic class name -->
                                                <className>String</className>
                                            </generic>
                                            <generic>
                                                <!-- Generic package name -->
                                                <packageName>kotlin</packageName>

                                                <!-- Generic class name -->
                                                <className>Any</className>

                                                <!-- Is generic nullable. By default is `false` -->
                                                <nullable>true</nullable>
                                            </generic>
                                        </generics>
                                    </JSON>
                                </scalars>

                                <!-- Is root package name for generated DSL -->
                                <!-- should be relative to GraphQL schema directory -->
                                <relativePackage>true</relativePackage>

                                <!-- Root package name for generated DSL -->
                                <packageName>kobby.kotlin</packageName>

                                <!-- Output directory for generated DSL -->
                                <outputDirectory>target/generated-sources/kobby-kotlin</outputDirectory>

                                <!-- Configuration of DSL context generation (entry point to DSL) -->
                                <context>
                                    <!-- Context package name relative to root package name -->
                                    <!-- By default, is empty -->
                                    <packageName></packageName>

                                    <!-- Name of generated DSL context -->
                                    <!-- By default, is name of GraphQL schema file -->
                                    <!-- or `graphql` if there are multiple schema files -->
                                    <name>graphql</name>

                                    <!-- Prefix of generated `Context` interface -->
                                    <!-- By default is capitalized context name -->
                                    <prefix></prefix>

                                    <!-- Postfix of generated `Context` interface -->
                                    <postfix></postfix>

                                    <!-- Name of `query` function in `Context` interface -->
                                    <query>query</query>

                                    <!-- Name of `mutation` function in `Context` interface -->
                                    <mutation>mutation</mutation>

                                    <!-- Name of `subscription` function in `Context` interface -->
                                    <subscription>subscription</subscription>
                                </context>

                                <!-- Configuration of DTO classes generation -->
                                <dto>
                                    <!-- Package name for DTO classes. -->
                                    <!-- Relative to root package name. -->
                                    <packageName>dto</packageName>

                                    <!-- Prefix of DTO classes -->
                                    <!-- generated from GraphQL objects, interfaces and unions -->
                                    <prefix></prefix>

                                    <!-- Postfix of DTO classes -->
                                    <!-- generated from GraphQL objects, interfaces and unions -->
                                    <postfix>Dto</postfix>

                                    <!-- Prefix of DTO classes generated from GraphQL enums -->
                                    <enumPrefix></enumPrefix>

                                    <!-- Postfix of DTO classes generated from GraphQL enums -->
                                    <enumPostfix></enumPostfix>

                                    <!-- Prefix of DTO classes generated from GraphQL inputs -->
                                    <inputPrefix></inputPrefix>

                                    <!-- Postfix of DTO classes generated from GraphQL inputs -->
                                    <inputPostfix></inputPostfix>

                                    <!-- Kobby can generate `equals` and `hashCode` functions -->
                                    <!-- for entities classes -->
                                    <!-- based on fields marked with `@primaryKey` directive. -->
                                    <!-- This parameter provides an ability -->
                                    <!-- to apply the same generation logic to DTO classes -->
                                    <applyPrimaryKeys>false</applyPrimaryKeys>

                                    <!-- Configuration of Jackson annotations generation -->
                                    <!-- for DTO classes -->
                                    <jackson>
                                        <!-- Is Jackson annotations generation enabled -->
                                        <!-- By default `true` if -->
                                        <!-- `com.fasterxml.jackson.core:jackson-annotations` -->
                                        <!-- artifact is in the project dependencies -->
                                        <enabled>true</enabled>

                                        <!-- Customize the @JsonTypeInfo -->
                                        <!-- annotation's `use` property. -->
                                        <typeInfoUse>NAME</typeInfoUse>

                                        <!-- Customize the @JsonTypeInfo -->
                                        <!-- annotation's `include` property. -->
                                        <typeInfoInclude>PROPERTY</typeInfoInclude>

                                        <!-- Customize the @JsonTypeInfo -->
                                        <!-- annotation's `property` property. -->
                                        <typeInfoProperty>__typename</typeInfoProperty>

                                        <!-- Customize the @JsonInclude -->
                                        <!-- annotation's `value` property. -->
                                        <jsonInclude>NON_ABSENT</jsonInclude>
                                    </jackson>

                                    <!-- Configuration of DTO builders generation -->
                                    <builder>
                                        <!-- Is DTO builders generation enabled -->
                                        <enabled>true</enabled>

                                        <!-- Prefix of DTO builder classes -->
                                        <prefix></prefix>

                                        <!-- Postfix of DTO builder classes -->
                                        <postfix>Builder</postfix>

                                        <!-- Name of builder based `copy` function for DTO classes -->
                                        <copyFun>copy</copyFun>
                                    </builder>

                                    <!-- Configuration of helper DTO classes generation -->
                                    <!-- for implementing the GraphQL interaction protocol -->
                                    <graphQL>
                                        <!-- Is helper DTO classes generation enabled -->
                                        <enabled>true</enabled>

                                        <!-- Package name for helper DTO classes -->
                                        <!-- relative to DTO package name -->
                                        <packageName>graphql</packageName>

                                        <!-- Prefix for helper DTO classes -->
                                        <prefix></prefix>

                                        <!-- Postfix for helper DTO classes -->
                                        <postfix></postfix>
                                    </graphQL>
                                </dto>

                                <!-- Configuration of DSL Entities interfaces generation -->
                                <entity>
                                    <!-- Is entities interfaces generation enabled -->
                                    <enabled>true</enabled>

                                    <!-- Package name for entities interfaces -->
                                    <!-- relative to root package name -->
                                    <packageName>entity</packageName>

                                    <!-- Prefix for entities interfaces -->
                                    <prefix></prefix>

                                    <!-- Postfix for entities interfaces -->
                                    <postfix></postfix>

                                    <!-- Inherit context interface in entity interface -->
                                    <!-- https://github.com/ermadmi78/kobby/issues/20 -->
                                    <contextInheritanceEnabled>true</contextInheritanceEnabled>

                                    <!-- Generate context access function in entity interface -->
                                    <!-- https://github.com/ermadmi78/kobby/issues/20 -->
                                    <contextFunEnabled>false</contextFunEnabled>

                                    <!-- Context access function name in entity interface -->
                                    <!-- https://github.com/ermadmi78/kobby/issues/20 -->
                                    <contextFunName>__context</contextFunName>

                                    <!-- Name of `withCurrentProjection` function in entity interface -->
                                    <withCurrentProjectionFun>
                                        __withCurrentProjection
                                    </withCurrentProjectionFun>

                                    <!-- Configuration of DSL Entity Projection interfaces generation -->
                                    <projection>
                                        <!-- Prefix for projection interfaces -->
                                        <projectionPrefix></projectionPrefix>

                                        <!-- Postfix for projection interfaces -->
                                        <projectionPostfix>Projection</projectionPostfix>

                                        <!-- Name of projection argument in field functions -->
                                        <projectionArgument>__projection</projectionArgument>

                                        <!-- Prefix for projection fields -->
                                        <!-- that are not marked with the directive `@default` -->
                                        <withPrefix></withPrefix>

                                        <!-- Postfix for projection fields -->
                                        <!-- that are not marked with the directive `@default` -->
                                        <withPostfix></withPostfix>

                                        <!-- Prefix for default projection fields -->
                                        <!-- (marked with the directive `@default`) -->
                                        <withoutPrefix>__without</withoutPrefix>

                                        <!-- Postfix for default projection fields -->
                                        <!-- (marked with the directive `@default`) -->
                                        <withoutPostfix></withoutPostfix>

                                        <!-- Name of `minimize` function in projection interface -->
                                        <minimizeFun>__minimize</minimizeFun>

                                        <!-- Prefix for qualification interfaces -->
                                        <qualificationPrefix></qualificationPrefix>

                                        <!-- Postfix for qualification interfaces -->
                                        <qualificationPostfix>Qualification</qualificationPostfix>

                                        <!-- Prefix for qualified projection interface -->
                                        <qualifiedProjectionPrefix></qualifiedProjectionPrefix>

                                        <!-- Postfix for qualified projection interface -->
                                        <qualifiedProjectionPostfix>
                                            QualifiedProjection
                                        </qualifiedProjectionPostfix>

                                        <!-- Prefix for qualification functions -->
                                        <onPrefix>__on</onPrefix>

                                        <!-- Postfix for qualification functions -->
                                        <onPostfix></onPostfix>
                                    </projection>

                                    <!-- Configuration of DSL Entity Selection interfaces generation -->
                                    <selection>
                                        <!-- Prefix for selection interfaces -->
                                        <selectionPrefix></selectionPrefix>

                                        <!-- Postfix for selection interfaces -->
                                        <selectionPostfix>Selection</selectionPostfix>

                                        <!-- Name of selection argument in field functions -->
                                        <selectionArgument>__selection</selectionArgument>

                                        <!-- Prefix for query interfaces -->
                                        <queryPrefix></queryPrefix>

                                        <!-- Postfix for query interfaces -->
                                        <queryPostfix>Query</queryPostfix>

                                        <!-- Name of query argument in field functions -->
                                        <queryArgument>__query</queryArgument>
                                    </selection>
                                </entity>

                                <!-- Configuration of DSL Entities implementation classes generation -->
                                <impl>
                                    <!-- Package name for entities implementation classes -->
                                    <!-- relative to root package name -->
                                    <packageName>entity.impl</packageName>

                                    <!-- Prefix for entities implementation classes -->
                                    <prefix></prefix>

                                    <!-- Postfix for entities implementation classes -->
                                    <postfix>Impl</postfix>

                                    <!-- Is implementation classes should be internal -->
                                    <internal>true</internal>

                                    <!-- Prefix for inner fields in implementation classes -->
                                    <innerPrefix>__inner</innerPrefix>

                                    <!-- Postfix for inner fields in implementation classes -->
                                    <innerPostfix></innerPostfix>
                                </impl>

                                <!-- Configuration of adapter classes generation -->
                                <adapter>
                                    <!-- Configuration of Ktor adapter classes generation -->
                                    <ktor>
                                        <!-- Is simple Ktor adapter generation enabled -->
                                        <!-- By default `true` if `io.ktor:ktor-client-cio-jvm` -->
                                        <!-- artifact is in the project dependencies -->
                                        <simpleEnabled>true</simpleEnabled>

                                        <!-- Is composite Ktor adapter generation enabled -->
                                        <!-- By default `true` if `io.ktor:ktor-client-cio-jvm` -->
                                        <!-- artifact is in the project dependencies -->
                                        <compositeEnabled>true</compositeEnabled>

                                        <!-- Package name for Ktor adapter classes -->
                                        <!-- relative to root package name -->
                                        <packageName>adapter.ktor</packageName>

                                        <!-- Prefix for Ktor adapter classes -->
                                        <prefix></prefix>

                                        <!-- Postfix for Ktor adapter classes -->
                                        <postfix>KtorAdapter</postfix>
                                    </ktor>
                                </adapter>

                                <!-- Configuration of resolver interfaces generation -->
                                <resolver>
                                    <!-- Is resolver interfaces generation enabled -->
                                    <!-- By default `true` if -->
                                    <!-- `com.graphql-java-kickstart:graphql-java-tools` -->
                                    <!-- artifact is in the project dependencies -->
                                    <enabled>true</enabled>

                                    <!-- Is wrap subscription resolver functions result -->
                                    <!-- in `org.reactivestreams.Publisher` -->
                                    <!-- By default `true` if `org.reactivestreams:reactive-streams` -->
                                    <!-- artifact is in the project dependencies -->
                                    <publisherEnabled>true</publisherEnabled>

                                    <!-- Package name for resolver interfaces -->
                                    <!-- relative to root package name -->
                                    <packageName>resolver</packageName>

                                    <!-- Prefix for resolver interfaces -->
                                    <!-- By default is capitalized context name -->
                                    <prefix></prefix>

                                    <!-- Postfix for resolver interfaces -->
                                    <postfix>Resolver</postfix>

                                    <!-- Name for parent object argument -->
                                    <!-- By default, is de-capitalized name of parent object type -->
                                    <argument></argument>

                                    <!-- If not null, Kobby will generate default implementation for -->
                                    <!-- functions in resolver interfaces that looks like: -->
                                    <!-- TODO("$toDoMessage") -->
                                    <toDoMessage></toDoMessage>
                                </resolver>
                            </kotlin>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>