Skip to content

Commit 7b3b016

Browse files
ridelineroryan-block
authored andcommitted
Rename to useCommentsForDescriptions
1 parent d2d00b2 commit 7b3b016

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/main/kotlin/graphql/kickstart/tools/SchemaParserOptions.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ data class SchemaParserOptions internal constructor(
3333
val typeDefinitionFactories: List<TypeDefinitionFactory>,
3434
val fieldVisibility: GraphqlFieldVisibility?,
3535
val includeUnusedTypes: Boolean,
36-
val commentsAsFallbackDescription: Boolean
36+
val useCommentsForDescriptions: Boolean
3737
) {
3838
companion object {
3939
@JvmStatic
@@ -62,7 +62,7 @@ data class SchemaParserOptions internal constructor(
6262
private var typeDefinitionFactories: MutableList<TypeDefinitionFactory> = mutableListOf(RelayConnectionFactory())
6363
private var fieldVisibility: GraphqlFieldVisibility? = null
6464
private var includeUnusedTypes = false
65-
private var commentsAsFallbackDescription = true
65+
private var useCommentsForDescriptions = true
6666

6767
fun contextClass(contextClass: Class<*>) = this.apply {
6868
this.contextClass = contextClass
@@ -140,8 +140,8 @@ data class SchemaParserOptions internal constructor(
140140
this.includeUnusedTypes = includeUnusedTypes
141141
}
142142

143-
fun commentsAsFallbackDescription(commentsAsFallbackDescription: Boolean) = this.apply {
144-
this.commentsAsFallbackDescription = commentsAsFallbackDescription
143+
fun useCommentsForDescriptions(useCommentsForDescriptions: Boolean) = this.apply {
144+
this.useCommentsForDescriptions = useCommentsForDescriptions
145145
}
146146

147147
@ExperimentalCoroutinesApi
@@ -184,7 +184,7 @@ data class SchemaParserOptions internal constructor(
184184
typeDefinitionFactories,
185185
fieldVisibility,
186186
includeUnusedTypes,
187-
commentsAsFallbackDescription
187+
useCommentsForDescriptions
188188
)
189189
}
190190
}

src/main/kotlin/graphql/kickstart/tools/util/Utils.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ internal val Class<*>.declaredNonProxyMethods: List<JavaMethod>
5353
internal fun getDocumentation(node: AbstractDescribedNode<*>, options: SchemaParserOptions): String? =
5454
when {
5555
node.description != null -> node.description.content
56-
!options.commentsAsFallbackDescription -> null
57-
node.comments == null -> null
58-
node.comments.isEmpty() -> null
56+
!options.useCommentsForDescriptions -> null
57+
node.comments.isNullOrEmpty() -> null
5958
else -> node.comments.asSequence()
6059
.filter { !it.content.startsWith("#") }
6160
.joinToString("\n") { it.content.trimEnd() }

src/test/kotlin/graphql/kickstart/tools/SchemaParserTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ class SchemaParserTest {
575575
}
576576
""")
577577
.resolvers(object : GraphQLQueryResolver {})
578-
.options(SchemaParserOptions.newOptions().commentsAsFallbackDescription(false).allowUnimplementedResolvers(true).build())
578+
.options(SchemaParserOptions.newOptions().useCommentsForDescriptions(false).allowUnimplementedResolvers(true).build())
579579
.build()
580580
.makeExecutableSchema()
581581

0 commit comments

Comments
 (0)