未验证 提交 f3fe479f 编写于 作者: 梦境迷离's avatar 梦境迷离 提交者: GitHub

Kotlin: Fix ParameterizedInput and toString() issue (#573)

* fxi ParameterizedInput bug

* fix tostring
上级 0fd77964
......@@ -3,6 +3,7 @@ package ${package}
</#if>
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLParametrizedInput
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLRequestSerializer
import java.util.StringJoiner
<#if javaDoc?has_content>
/**
......
......@@ -130,7 +130,7 @@ open class ${className}()<#if implements?has_content> : <#list implements as int
return true</#if>
}
override fun hashCode(): Int = {
override fun hashCode(): Int {
<#if fields?has_content>
return Objects.hash(<#list fields as field>${field.name}<#if field_has_next>, </#if></#list>)
<#else>
......
......@@ -4,6 +4,7 @@ package ${package}
</#if>
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLParametrizedInput
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLRequestSerializer
import scala.collection.JavaConverters._
<#if fields?has_content>
<#if enumImportItSelfInScala?has_content>
......
......@@ -103,13 +103,15 @@ class GraphQLCodegenReactorToStringTest {
outputBuildDir, mappingConfig, TestUtils.getStaticGeneratedInfo()).generate();
File[] files = Objects.requireNonNull(outputJavaClassesDir.listFiles());
List<String> generatedFileNames = Arrays.stream(files).map(File::getName).filter(f -> Objects.equals("Synchronized.scala", f)).sorted().collect(toList());
List<String> generatedFileNames = Arrays.stream(files).map(File::getName).filter(f -> Objects.equals("Synchronized.scala", f)
|| Objects.equals("QueryCaseParametrizedInput.scala", f)).sorted().collect(toList());
assertEquals(singletonList("Synchronized.scala"), generatedFileNames);
for (File file : files) {
if (Objects.equals("Synchronized.scala", file.getName())) {
if (Arrays.asList("QueryCaseParametrizedInput.scala", "Synchronized.scala").contains(file.getName())) {
assertSameTrimmedContent(
new File(String.format("src/test/resources/expected-classes/scala/tostring/%s.txt", "TOSTRING_Synchronized.scala")),
new File(String.format("src/test/resources/expected-classes/scala/tostring/%s.txt", "TOSTRING_Synchronized.scala",
"QueryCaseParametrizedInput")),
file);
}
}
......
......@@ -172,7 +172,7 @@ open class Commit(
}
override fun hashCode(): Int = {
override fun hashCode(): Int {
return Objects.hash(abbreviatedOid, additions, associatedPullRequests, author, authoredByCommitter, authoredDate, blame, changedFiles, comments, commitResourcePath, commitUrl, committedDate, committedViaWeb, committer, deletions, deployments, history, id, message, messageBody, messageBodyHTML, messageHeadline, messageHeadlineHTML, oid, parents, pushedDate, repository, resourcePath, signature, status, tarballUrl, tree, treeResourcePath, treeUrl, url, viewerCanSubscribe, viewerSubscription, zipballUrl)
}
......
package com.kobylynskyi.graphql.codegen.prot
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLParametrizedInput
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLRequestSerializer
import java.util.StringJoiner
/**
* Parametrized input for field fun in type Query
......
package com.kobylynskyi.graphql.codegen.prot
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLParametrizedInput
import com.kobylynskyi.graphql.codegen.model.graphql.GraphQLRequestSerializer
import scala.collection.JavaConverters._
import TestEnum._
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册