Skip to content

Commit

Permalink
Merge pull request #83 from rruizt/persistent-query-manifest
Browse files Browse the repository at this point in the history
Make operation manifest format configurable
  • Loading branch information
aoudiamoncef authored Dec 30, 2023
2 parents 87e75c6 + 380fb69 commit 2b93d68
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 5 deletions.
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

0 comments on commit 2b93d68

Please sign in to comment.