Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make operation manifest format configurable #83

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ All plugin configuration properties and their defaults:
</rootFolders>
<scalarsMapping></scalarsMapping>
<operationIdGeneratorClass></operationIdGeneratorClass>
<operationManifestFormat>persistedQueryManifest</operationManifestFormat>
<schemaPackageName>com.lahzouz.apollo.graphql.client</schemaPackageName>
<packageName>com.lahzouz.apollo.graphql.client</packageName>
<codegenModels>OPERATION</codegenModels>
Expand Down
6 changes: 3 additions & 3 deletions apollo-client-maven-plugin-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.aoudiamoncef</groupId>
<artifactId>apollo-client-maven-plugin-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -105,7 +105,7 @@
<plugin>
<groupId>com.github.aoudiamoncef</groupId>
<artifactId>apollo-client-maven-plugin</artifactId>
<version>7.0.0</version>
<version>7.1.0-SNAPSHOT</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -138,7 +138,7 @@
<debugDirectory>
${project.build.directory}/generated-sources/graphql-client/books/debug/
</debugDirectory>
<generateOperationDescriptors>false</generateOperationDescriptors>
<generateOperationDescriptors>true</generateOperationDescriptors>
<compilerParams>
<rootFolders>
<rootFolder>${project.basedir}/src/main/graphql/books/</rootFolder>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.lahzouz.java.graphql.client.tests

import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Test
import java.nio.file.Files
import java.nio.file.Paths
import kotlin.io.path.exists

class OperationManifestTest {

@Test
@DisplayName("Checks that operationManifest.json file has been generated and it's not empty")
fun operationManifestTest() {
val path = Paths.get("target/generated/operationOutput/apollo/books/operationOutput.json")

assertTrue(path.exists(), "operationOutput.json was not generated by the plugin")
assertTrue(Files.size(path) > 0, "File is empty")
}
}
2 changes: 1 addition & 1 deletion apollo-client-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.github.aoudiamoncef</groupId>
<artifactId>apollo-client-maven-plugin-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ class GraphQLClientMojo : AbstractMojo() {
generateAsInternal = compilerParams.generateAsInternal,
generateFilterNotNull = compilerParams.generateFilterNotNull,
generateFragmentImplementations = compilerParams.generateFragmentImplementations,
operationManifestFormat = compilerParams.operationManifestFormat,
operationManifestFile = compilationUnit.operationOutputFile,
generateResponseFields = compilerParams.generateResponseFields,
generateQueryDocument = compilerParams.generateQueryDocument,
generateSchema = compilerParams.generateSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ class CompilerParams {
*/
internal val sealedClassesForEnumsMatching: List<String> = emptyList()

/**
* The format in which the operation manifest will be generated.
*
* Default value: "operationOutput"
*/
internal val operationManifestFormat: String = MANIFEST_OPERATION_OUTPUT

/**
* Whether or not to generate Apollo metadata. Apollo metadata is used for multi-module support. Set this to true if you want other
* modules to be able to re-use fragments and types from this module.
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.github.aoudiamoncef</groupId>
<artifactId>apollo-client-maven-plugin-parent</artifactId>
<version>7.0.0</version>
<version>7.1.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>apollo-client-maven-plugin-parent</name>
Expand Down
Loading