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

io.github.darvld.wireframe.extensions.Analysis.kt Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
package io.github.darvld.wireframe.extensions

import graphql.schema.*

public fun GraphQLNamedType.isInternalType(): Boolean {
    return GraphQLTypeUtil.isSystemElement().test(this)
}

public fun GraphQLNamedType.isRouteType(): Boolean {
    if (name == "Query" || name == "Mutation" || name == "Subscription") return true

    return false
}

public val GraphQLType.isNullable: Boolean
    get() = this is GraphQLNullableType

public fun GraphQLType.unwrapNonNull(): GraphQLType {
    return if (this is GraphQLNonNull) originalWrappedType else this
}

public tailrec fun GraphQLType.unwrapCompletely(): GraphQLType {
    return if (this is GraphQLModifiedType) wrappedType.unwrapCompletely() else this
}

public fun GraphQLObjectType.getExtensionFields(): Sequence {
    val extensions = extensionDefinitions.flatMap { extension ->
        extension.fieldDefinitions.map { it.name!! }
    }

    return fields.asSequence().filter { it.name in extensions }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy