-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor RemoteArgumentSource to be a sealed class
- Loading branch information
Showing
9 changed files
with
170 additions
and
194 deletions.
There are no files selected for viewing
26 changes: 13 additions & 13 deletions
26
lib/src/main/java/graphql/nadel/dsl/RemoteArgumentSource.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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
package graphql.nadel.dsl | ||
|
||
import graphql.language.Value | ||
import graphql.nadel.util.AnyAstValue | ||
|
||
// todo this should be a union or sealed class thing | ||
data class RemoteArgumentSource( | ||
val argumentName: String?, // for OBJECT_FIELD | ||
val pathToField: List<String>?, | ||
val staticValue: Value<*>?, | ||
val sourceType: SourceType, | ||
) { | ||
enum class SourceType { | ||
ObjectField, | ||
FieldArgument, | ||
StaticArgument | ||
} | ||
sealed class RemoteArgumentSource { | ||
data class ObjectField( | ||
val pathToField: List<String>, | ||
) : RemoteArgumentSource() | ||
|
||
data class FieldArgument( | ||
val argumentName: String, | ||
) : RemoteArgumentSource() | ||
|
||
data class StaticArgument( | ||
val staticValue: AnyAstValue, | ||
) : RemoteArgumentSource() | ||
} |
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
Oops, something went wrong.