-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: make deepName public and move to extensions package (#108)
It's a very handy utility method.
- Loading branch information
1 parent
36610c0
commit ba0f9f1
Showing
6 changed files
with
23 additions
and
15 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/com/expedia/graphql/extensions/deepName.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.expedia.graphql.extensions | ||
|
||
import graphql.schema.GraphQLList | ||
import graphql.schema.GraphQLNonNull | ||
import graphql.schema.GraphQLType | ||
|
||
/** | ||
* Useful public extension that renders a readable string from the given | ||
* graphql type no matter how deeply nested it is. | ||
* Eg: [[Int!]]! | ||
* | ||
* @return a string representation of the type taking list and non-null into account | ||
*/ | ||
val GraphQLType.deepName: String | ||
get() = when { | ||
this is GraphQLNonNull -> "${wrappedType.deepName}!" | ||
this is GraphQLList -> "[${wrappedType.deepName}]" | ||
else -> name | ||
} |
12 changes: 0 additions & 12 deletions
12
src/main/kotlin/com/expedia/graphql/schema/extensions/graphQLTypeExtensions.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
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
1 change: 1 addition & 0 deletions
1
src/test/kotlin/com/expedia/graphql/schema/extensions/GraphQLTypeExtensionsTest.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
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
2 changes: 1 addition & 1 deletion
2
src/test/kotlin/com/expedia/graphql/schema/hooks/SchemaGeneratorHooksTest.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