io.github.darvld.wireframe.WireframeCompiler.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compiler-core Show documentation
Show all versions of compiler-core Show documentation
A GraphQL server library for Kotlin.
package io.github.darvld.wireframe
import com.squareup.kotlinpoet.FileSpec
import graphql.language.TypeDefinition
import graphql.schema.GraphQLSchema
import graphql.schema.idl.RuntimeWiring
import graphql.schema.idl.SchemaGenerator
import graphql.schema.idl.SchemaParser
import graphql.schema.idl.TypeDefinitionRegistry
import io.github.darvld.wireframe.base.WireframeBasePlugin
import io.github.darvld.wireframe.extensions.isInternalType
import io.github.darvld.wireframe.extensions.subpackage
import java.nio.file.Path
/**Analyzes `.graphqls` schema definitions using graphql-java and outputs type-safe Kotlin code for the types and
* operations in the schema.*/
public class WireframeCompiler {
/**Encapsulates an output element from the code generator. Use it to write the generated code to an [Appendable],
* or as a file in a target directory.*/
@JvmInline
public value class Output(private val spec: FileSpec) {
public val name: String
get() = spec.name
public val packageName: String
get() = spec.packageName
public fun writeTo(directory: Path) {
spec.writeTo(directory)
}
public fun writeTo(out: Appendable) {
spec.writeTo(out)
}
}
/**Represents a piece of input data to be processed by the compiler.*/
public data class Source(
val sdl: String,
val packageName: String? = null,
val fileName: String? = null,
)
public fun process(
project: String,
basePackage: String,
sources: Iterable
© 2015 - 2024 Weber Informatics LLC | Privacy Policy