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

Update sbt plugin to support RelayConfig #295 (#306)

上级 d7fa4ffe
......@@ -2,9 +2,8 @@ package io.github.dreamylost.graphql.codegen
import java.util
import com.kobylynskyi.graphql.codegen.model.{ ApiNamePrefixStrategy, ApiRootInterfaceStrategy }
import com.kobylynskyi.graphql.codegen.model.{ ApiInterfaceStrategy, ApiNamePrefixStrategy, ApiRootInterfaceStrategy, RelayConfig }
import sbt._
import com.kobylynskyi.graphql.codegen.model.ApiInterfaceStrategy
/**
*
......@@ -108,6 +107,8 @@ trait GraphQLCodegenKeys {
val responseProjectionMaxDepth = settingKey[Int]("limit depth when the projection is constructed automatically")
val relayConfig = settingKey[RelayConfig]("Can be used to supply a custom configuration for Relay support.")
//for version
val javaxValidationApiVersion = settingKey[Option[String]]("javax-validation-api version")
val graphqlJavaCodegenVersion = settingKey[Option[String]]("graphql java codegen version")
......
......@@ -41,6 +41,7 @@ class GraphQLCodegenPlugin(configuration: Configuration, private[codegen] val co
lazy val schemaFinderConfig: SchemaFinderConfig = SchemaFinderConfig(null)
lazy val parentInterfacesConfig: ParentInterfacesConfig = ParentInterfacesConfig()
lazy val defaultRelayConfig = new RelayConfig() //for auto import which can change it by `set` methods.
lazy val GraphQLCodegenConfig = self.GraphQLCodegenConfig
}
......@@ -87,6 +88,7 @@ class GraphQLCodegenPlugin(configuration: Configuration, private[codegen] val co
apiReturnListType := None,
apiInterfaceStrategy := MappingConfigConstants.DEFAULT_API_INTERFACE_STRATEGY,
useOptionalForNullableReturnTypes := MappingConfigConstants.DEFAULT_USE_OPTIONAL_FOR_NULLABLE_RETURN_TYPES,
relayConfig := defaultRelayConfig,
// package name configs:
apiPackageName := None,
modelPackageName := None,
......@@ -155,6 +157,7 @@ class GraphQLCodegenPlugin(configuration: Configuration, private[codegen] val co
mappingConfig.setApiInterfaceStrategy((apiInterfaceStrategy in GraphQLCodegenConfig).value)
mappingConfig.setUseOptionalForNullableReturnTypes((useOptionalForNullableReturnTypes in GraphQLCodegenConfig).value)
mappingConfig.setResponseProjectionMaxDepth((responseProjectionMaxDepth in GraphQLCodegenConfig).value)
mappingConfig.setRelayConfig((relayConfig in GraphQLCodegenConfig).value)
sLog.value.debug(s"Current mapping config is <$mappingConfig>")
mappingConfig
......
......@@ -42,7 +42,7 @@ object OkHttp {
post(RequestBody.create(request.toHttpJsonBody, json))
val promise = Promise[T]
println("Graphql query "+request.toHttpJsonBody)
println("Graphql query " + request.toHttpJsonBody)
OkHttp.client.newCall(rb.build()).enqueue(new Callback {
override def onFailure(call: Call, e: IOException): Unit = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册