All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.nadel.enginekt.blueprint.hydration.NadelHydrationActorInputDef.kt Maven / Gradle / Ivy

Go to download

Nadel is a Java library that combines multiple GrahpQL services together into one API.

The newest version!
package graphql.nadel.enginekt.blueprint.hydration

import graphql.nadel.enginekt.transform.query.NadelQueryPath
import graphql.schema.GraphQLArgument
import graphql.schema.GraphQLFieldDefinition

data class NadelHydrationActorInputDef(
    val name: String,
    val actorArgumentDef: GraphQLArgument,
    val valueSource: ValueSource,
) {
    sealed class ValueSource {
        /**
         * Uses a value from a field in the same object (or its children) as input e.g.
         *
         * ```graphql
         * type Issue {
         *   id: ID! # Value used as argument to issueId
         *   owner: User @hydrated(from: ["issueOwner"], args: [
         *      {name: "issueId" valueFromField: ["id"]}
         *   ])
         * }
         * ```
         */
        data class FieldResultValue(
            val queryPathToField: NadelQueryPath,
            val fieldDefinition: GraphQLFieldDefinition,
        ) : ValueSource()

        /**
         * Uses a value from a field in the same object (or its children) as input e.g.
         *
         * ```graphql
         * type Issue {
         *   secret(password: String): JSON @hydrated(from: ["issueSecret"], args: [
         *     {name: "password", valueFromArg: "password"}
         *   ])
         * }
         * ```
         */
        data class ArgumentValue(
            val argumentName: String,
            val argumentDefinition: GraphQLArgument,
        ) : ValueSource()
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy