-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix passing doc string as format parameter (#1024)
closes #1023 The kotlin poet api takes as first argument a format parameter for `addKdoc()`. So comments with percent signs would cause the format argument parser to error.
- Loading branch information
1 parent
a851521
commit 4873c3d
Showing
9 changed files
with
73 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...st/kotlin/com/expediagroup/graphql/plugin/client/generator/types/GenerateGraphQLDocsIT.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.expediagroup.graphql.plugin.client.generator.types | ||
|
||
import com.expediagroup.graphql.plugin.client.generator.verifyGeneratedFileSpecContents | ||
import org.junit.jupiter.api.Test | ||
|
||
class GenerateGraphQLDocsIT { | ||
@Test | ||
fun `verify docs with format params do not blow up`() { | ||
val expected = | ||
""" | ||
package com.expediagroup.graphql.plugin.generator.integration | ||
import com.expediagroup.graphql.client.GraphQLClient | ||
import com.expediagroup.graphql.client.execute | ||
import com.expediagroup.graphql.types.GraphQLResponse | ||
import kotlin.Int | ||
import kotlin.String | ||
const val TEST_QUERY: String = "query TestQuery {\n docQuery {\n id\n }\n}" | ||
class TestQuery( | ||
private val graphQLClient: GraphQLClient | ||
) { | ||
suspend fun execute(): GraphQLResponse<TestQuery.Result> = graphQLClient.execute(TEST_QUERY, | ||
"TestQuery", null) | ||
/** | ||
* Doc object with % and $ floating around | ||
*/ | ||
data class DocObject( | ||
/** | ||
* An id with a comment containing % and $ as well | ||
*/ | ||
val id: Int | ||
) | ||
data class Result( | ||
/** | ||
* Query to test doc strings | ||
*/ | ||
val docQuery: TestQuery.DocObject | ||
) | ||
} | ||
""".trimIndent() | ||
val query = | ||
""" | ||
query TestQuery { | ||
docQuery { | ||
id | ||
} | ||
} | ||
""".trimIndent() | ||
verifyGeneratedFileSpecContents(query, expected) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters