File tree Expand file tree Collapse file tree 6 files changed +23
-15
lines changed
main/kotlin/com/expedia/graphql
test/kotlin/com/expedia/graphql/schema Expand file tree Collapse file tree 6 files changed +23
-15
lines changed Original file line number Diff line number Diff line change 1+ package com.expedia.graphql.extensions
2+
3+ import graphql.schema.GraphQLList
4+ import graphql.schema.GraphQLNonNull
5+ import graphql.schema.GraphQLType
6+
7+ /* *
8+ * Useful public extension that renders a readable string from the given
9+ * graphql type no matter how deeply nested it is.
10+ * Eg: [[Int!]]!
11+ *
12+ * @return a string representation of the type taking list and non-null into account
13+ */
14+ val GraphQLType .deepName: String
15+ get() = when {
16+ this is GraphQLNonNull -> " ${wrappedType.deepName} !"
17+ this is GraphQLList -> " [${wrappedType.deepName} ]"
18+ else -> name
19+ }
Original file line number Diff line number Diff line change 11package com.expedia.graphql.schema.extensions
22
33import com.expedia.graphql.exceptions.NestingNonNullTypeException
4- import graphql.schema.GraphQLList
54import graphql.schema.GraphQLNonNull
65import graphql.schema.GraphQLType
76import kotlin.reflect.KType
87
9- /* *
10- * Renders a readable string from the given graphql type no matter how deeply nested
11- * Eg: [[Int!]]!
12- */
13- internal val GraphQLType .deepName: String
14- get() = when {
15- this is GraphQLNonNull -> " ${this .wrappedType.deepName} !"
16- this is GraphQLList -> " [${this .wrappedType.deepName} ]"
17- else -> name
18- }
19-
208/* *
219 * Map null and non-null types.
2210 * Throws an exception on wrapping a non-null graphql type twice.
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ package com.expedia.graphql.schema.dataFetchers
22
33import com.expedia.graphql.TopLevelObjectDef
44import com.expedia.graphql.schema.SchemaGeneratorConfig
5- import com.expedia.graphql.schema. extensions.deepName
5+ import com.expedia.graphql.extensions.deepName
66import com.expedia.graphql.toSchema
77import graphql.GraphQL
88import graphql.schema.DataFetcher
Original file line number Diff line number Diff line change 11package com.expedia.graphql.schema.extensions
22
33import com.expedia.graphql.exceptions.NestingNonNullTypeException
4+ import com.expedia.graphql.extensions.deepName
45import graphql.schema.GraphQLList
56import graphql.schema.GraphQLNonNull
67import graphql.schema.GraphQLType
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import com.expedia.graphql.annotations.GraphQLID
66import com.expedia.graphql.annotations.GraphQLIgnore
77import com.expedia.graphql.exceptions.ConflictingTypesException
88import com.expedia.graphql.exceptions.InvalidIdTypeException
9- import com.expedia.graphql.schema. extensions.deepName
9+ import com.expedia.graphql.extensions.deepName
1010import com.expedia.graphql.schema.testSchemaConfig
1111import com.expedia.graphql.toSchema
1212import graphql.GraphQL
Original file line number Diff line number Diff line change 11package com.expedia.graphql.schema.hooks
22
33import com.expedia.graphql.TopLevelObjectDef
4- import com.expedia.graphql.schema. extensions.deepName
4+ import com.expedia.graphql.extensions.deepName
55import com.expedia.graphql.schema.getTestSchemaConfigWithHooks
66import com.expedia.graphql.toSchema
77import graphql.GraphQL
You can’t perform that action at this time.
0 commit comments