Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Franklin Wang <[email protected]>
  • Loading branch information
sbarker2 and gnawf authored Oct 9, 2023
1 parent e3ff70e commit 9eeb347
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,16 @@ data class NadelHydrationActorInputDef(
*
* ```graphql
* type Issue {
* id: ID! # Value used as argument to issueId
* id: ID!
* owner: User @hydrated(from: ["issueOwner"], args: [
* {name: "issueId" value: "issue123"}
* ])
* }
* ```
*/
data class StaticValue (
data class StaticValue(
val value: Value<*>,
): ValueSource()

) : ValueSource()
}
}

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package graphql.nadel.engine.transform.hydration

import graphql.language.NullValue
import graphql.language.StringValue
import graphql.language.Value
import graphql.nadel.engine.blueprint.NadelHydrationFieldInstruction
import graphql.nadel.engine.blueprint.hydration.NadelHydrationActorInputDef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal object NadelBatchHydrationInputBuilder {
actorFieldArg to staticValue
}
}
}
},
)
}

Expand Down
20 changes: 9 additions & 11 deletions lib/src/main/java/graphql/nadel/schema/NadelDirectives.kt
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ object NadelDirectives {
}

private fun createRemoteArgumentSource(value: Value<*>): RemoteArgumentSource {
if (value is StringValue) {
if (value is StringValue) {
val values = listFromDottedString(value.value)
return when (values.first()) {
"\$source" -> RemoteArgumentSource(
Expand All @@ -383,22 +383,20 @@ object NadelDirectives {
sourceType = SourceType.FieldArgument,
)

else ->
RemoteArgumentSource(
argumentName = null,
pathToField = null,
staticValue = value,
sourceType = SourceType.StaticArgument,
)
else -> RemoteArgumentSource(
argumentName = null,
pathToField = null,
staticValue = value,
sourceType = SourceType.StaticArgument,
)
}
}
else {
} else {
return RemoteArgumentSource(
argumentName = null,
pathToField = null,
staticValue = value,
sourceType = SourceType.StaticArgument,
)
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class NeverWiringFactory : WiringFactory {

override fun getScalar(environment: ScalarWiringEnvironment): GraphQLScalarType? {
val scalarName = environment.scalarTypeDefinition.name
if (scalarName == ExtendedScalars.Json.name){
if (scalarName == ExtendedScalars.Json.name) {
return ExtendedScalars.Json
}
return GraphQLScalarType
Expand Down

0 comments on commit 9eeb347

Please sign in to comment.