├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── build.gradle ├── cli ├── build.gradle └── src │ └── main │ └── java │ └── io │ └── github │ └── mstachniuk │ └── graphqlschemafromintrospectiongenerator │ └── Main.java ├── core ├── build.gradle └── src │ ├── main │ └── kotlin │ │ └── io │ │ └── github │ │ └── mstachniuk │ │ └── graphqlschemafromintrospectiongenerator │ │ ├── Generator.kt │ │ ├── GeneratorSettings.kt │ │ └── internal │ │ ├── GeneratorImpl.kt │ │ └── Schema.kt │ └── test │ ├── kotlin │ └── io │ │ └── github │ │ └── mstachniuk │ │ └── graphqlschemafromintrospectiongenerator │ │ ├── GeneratorTest.kt │ │ ├── GraphQLServer.kt │ │ ├── IntroToIntroTest.kt │ │ └── SchemaToSchemaTest.kt │ └── resources │ └── testdata │ ├── input-1.json │ ├── input-10.json │ ├── input-2.json │ ├── input-3.json │ ├── input-4.json │ ├── input-5.json │ ├── input-6.json │ ├── input-7.json │ ├── input-8.json │ ├── input-9.json │ ├── intro2intro.json │ ├── schema-1.graphqls │ ├── schema-10.graphqls │ ├── schema-2.graphqls │ ├── schema-3.graphqls │ ├── schema-4.graphqls │ ├── schema-5.graphqls │ ├── schema-6.graphqls │ ├── schema-7.graphqls │ ├── schema-8.graphqls │ ├── schema-9.graphqls │ └── schema2schema.graphqls ├── docs └── release-notes.md ├── gradle ├── shipkit.gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── version.properties /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iws 3 | *.iml 4 | *.ipr 5 | .gradle 6 | */build/ 7 | */out 8 | !gradle/wrapper/gradle-wrapper.jar 9 | .gradletasknamecache 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # More details on how to configure the Travis build 2 | # https://docs.travis-ci.com/user/customizing-the-build/ 3 | 4 | language: java 5 | dist: trusty 6 | jdk: 7 | - oraclejdk8 8 | 9 | #Skipping install step to avoid having Travis run arbitrary './gradlew assemble' task 10 | # https://docs.travis-ci.com/user/customizing-the-build/#Skipping-the-Installation-Step 11 | install: 12 | - true 13 | 14 | #Don't build tags 15 | branches: 16 | except: 17 | - /^v\d/ 18 | 19 | #Build and perform release (if needed) 20 | script: 21 | - ./gradlew build -s && ./gradlew ciPerformRelease 22 | 23 | after_success: 24 | - bash <(curl -s https://codecov.io/bash) 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 mockito 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GraphQL Schema from Introspection generator 2 | 3 | [![MIT License](http://img.shields.io/badge/license-MIT-green.svg) ](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/blob/master/LICENSE) 4 | [![Build Status](https://travis-ci.org/mstachniuk/graphql-schema-from-introspection-generator.svg?branch=master)](https://travis-ci.org/mstachniuk/graphql-schema-from-introspection-generator) 5 | [![Maven Central](https://img.shields.io/maven-central/v/io.github.mstachniuk/graphql-schema-from-introspection-generator-core.svg)](https://search.maven.org/artifact/io.github.mstachniuk/graphql-schema-from-introspection-generator-core) 6 | [![Bintray](https://api.bintray.com/packages/mstachniuk/mstachniuk-maven-repo/maven/images/download.svg) ](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/_latestVersion) 7 | [![codecov](https://codecov.io/gh/mstachniuk/graphql-schema-from-introspection-generator/branch/master/graph/badge.svg)](https://codecov.io/gh/mstachniuk/graphql-schema-from-introspection-generator) 8 | 9 | This library helps you generate [GraphQL Schema](https://graphql.org/learn/schema/) (also called [GraphQL DSL or SDL](https://graphql-java.readthedocs.io/en/latest/schema.html)) based on Introspection Query response. 10 | It's useful when you use [graphql-java](https://github.com/graphql-java/graphql-java) and [Code First approach](https://graphql-java.readthedocs.io/en/latest/schema.html#creating-a-schema-programmatically) and want to migrate to [Schema First approach](https://graphql-java.readthedocs.io/en/latest/schema.html#creating-a-schema-using-the-sdl). 11 | 12 | ## How to use it? 13 | 14 | 1. Download Command Line Tool from [releases](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/releases) page. 15 | 2. Run `java -jar graphql-schema-from-introspection-generator-cli-X.X.X.jar input.json output.graphqls` 16 | 17 | File *input.json* should contain the output of GrpahQL Introspection query. 18 | If you don't have this file yet, you can use one from: *core/src/test/resources/testdata/* 19 | 3. In *output.graphqls* you will find generated GraphQL Schema. 20 | 21 | ## How get Introspection Query result? 22 | 23 | 1. Run your application. 24 | 2. Run 25 |
26 | Introspection Query 27 | 28 | ``` 29 | query IntrospectionQuery { 30 | __schema { 31 | queryType { name } 32 | mutationType { name } 33 | subscriptionType { name } 34 | types { 35 | ...FullType 36 | } 37 | directives { 38 | name 39 | description 40 | locations 41 | args { 42 | ...InputValue 43 | } 44 | } 45 | } 46 | } 47 | 48 | fragment FullType on __Type { 49 | kind 50 | name 51 | description 52 | fields(includeDeprecated: true) { 53 | name 54 | description 55 | args { 56 | ...InputValue 57 | } 58 | type { 59 | ...TypeRef 60 | } 61 | isDeprecated 62 | deprecationReason 63 | } 64 | inputFields { 65 | ...InputValue 66 | } 67 | interfaces { 68 | ...TypeRef 69 | } 70 | enumValues(includeDeprecated: true) { 71 | name 72 | description 73 | isDeprecated 74 | deprecationReason 75 | } 76 | possibleTypes { 77 | ...TypeRef 78 | } 79 | } 80 | 81 | fragment InputValue on __InputValue { 82 | name 83 | description 84 | type { ...TypeRef } 85 | defaultValue 86 | } 87 | 88 | fragment TypeRef on __Type { 89 | kind 90 | name 91 | ofType { 92 | kind 93 | name 94 | ofType { 95 | kind 96 | name 97 | ofType { 98 | kind 99 | name 100 | ofType { 101 | kind 102 | name 103 | ofType { 104 | kind 105 | name 106 | ofType { 107 | kind 108 | name 109 | ofType { 110 | kind 111 | name 112 | } 113 | } 114 | } 115 | } 116 | } 117 | } 118 | } 119 | } 120 | ``` 121 | 122 | This query based on Introspection Queries in [graphql-java](https://github.com/graphql-java/graphql-java) and [GraphiQL](https://github.com/graphql/graphiql) projects. 123 | 124 |
125 | 126 | 3. Store result in a file and use Command Line tool for generating the schema (See: [How to use it?](#how-to-use-it)). 127 | 128 | 129 | 130 | ## Release Notes 131 | 132 | Release notes: [docs/release-notes.md](/docs/release-notes.md) 133 | 134 | ## How to build project? 135 | 136 | 1. Clone repo 137 | 2. Run `./gradlew build` 138 | 3. You can find Command Line Tool in *cli/build/libs* 139 | 4. You can find core library in *core/build/libs* 140 | 141 | ## Another usage 142 | 143 | You can use the core library in your projects if you want. Just add a dependency (in Gradle): 144 | 145 | `compile group: 'io.github.mstachniuk', name: 'graphql-schema-from-introspection-generator-core'` 146 | 147 | ## How to contribute? 148 | 149 | Please Send PR's, issues and feedback via GitHub. 150 | 151 | ## Alternatives 152 | 153 | During finishing this project I found that similar tool already exists in 154 | [graphql-java](https://github.com/graphql-java/graphql-java) project, see `IntrospectionResultToSchema` class. 155 | 156 | Another possibility is to use [graphql-js](https://github.com/graphql/graphql-js) and this code snippet (NodeJS): 157 | 158 | ```javascript 159 | const graphql = require("graphql"); 160 | const schema = require("path/to/schema.json"); 161 | 162 | const clientSchema = graphql.buildClientSchema(schema.data); 163 | const schemaString = graphql.printSchema(clientSchema); 164 | console.log(schemaString) 165 | ``` 166 | 167 | Unfortunately, I didn't know that before :-( 168 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { 4 | url "https://plugins.gradle.org/m2/" 5 | } 6 | } 7 | dependencies { 8 | classpath "org.shipkit:shipkit:2.2.5" 9 | } 10 | } 11 | 12 | apply plugin: "org.shipkit.java" 13 | 14 | allprojects { 15 | group = 'io.github.mstachniuk' 16 | 17 | repositories { 18 | mavenCentral() 19 | jcenter() 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /cli/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | dependencies { 4 | compile project(":$rootProject.name-core") 5 | testCompile "org.assertj:assertj-core:3.10.0" 6 | } 7 | 8 | bintrayUpload.enabled = false 9 | 10 | jar { 11 | manifest { 12 | attributes 'Main-Class': 'io.github.mstachniuk.graphqlschemafromintrospectiongenerator.Main' 13 | } 14 | from { 15 | configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cli/src/main/java/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/Main.java: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator; 2 | 3 | import java.io.FileNotFoundException; 4 | import java.io.IOException; 5 | import java.io.PrintWriter; 6 | import java.nio.charset.StandardCharsets; 7 | import java.nio.file.Files; 8 | import java.nio.file.Paths; 9 | 10 | public class Main { 11 | public static void main(String[] args) throws IOException { 12 | if (args.length != 2) { 13 | System.out.println("Application generate GpaphQL Schema from Introspection Query result"); 14 | System.out.println("Please specify 2 arguments: input and output file, e.g.:"); 15 | System.out.println("java -jar graphql-schema-from-introspection-generator-cli-X.X.X.jar input.json output.graphqls"); 16 | System.exit(1); 17 | } 18 | 19 | String input = readFile(args[0]); 20 | 21 | String schema = generateSchema(input); 22 | saveSchemaToFile(args[1], schema); 23 | } 24 | 25 | private static String readFile(String filename) throws IOException { 26 | return new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8); 27 | } 28 | 29 | private static String generateSchema(String input) { 30 | Generator generator = new Generator(); 31 | return generator.generate(input); 32 | } 33 | 34 | private static void saveSchemaToFile(String filename, String schema) throws FileNotFoundException { 35 | try (PrintWriter out = new PrintWriter(filename)) { 36 | out.println(schema); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.31' 3 | ext.junitVersion = "5.2.0" 4 | ext.dokka_version = '0.9.17' 5 | 6 | repositories { 7 | mavenCentral() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" 13 | } 14 | } 15 | 16 | apply plugin: 'kotlin' 17 | apply plugin: 'org.jetbrains.dokka' 18 | apply plugin: "jacoco" 19 | 20 | description = 'Generate GraphQL Schema (GraphQL DSL or SDL) based on introspection query result' 21 | 22 | configurations { 23 | ktlint 24 | } 25 | 26 | dependencies { 27 | compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" 28 | compile 'com.beust:klaxon:3.0.1' 29 | testCompile "org.junit.jupiter:junit-jupiter-api:$junitVersion" 30 | testCompile "org.junit.jupiter:junit-jupiter-params:$junitVersion" 31 | testRuntime "org.junit.jupiter:junit-jupiter-engine:$junitVersion" 32 | testCompile 'org.json:json:20180813' 33 | testCompile 'com.graphql-java:graphql-java:9.0' 34 | testCompile 'org.skyscreamer:jsonassert:1.5.0' 35 | ktlint "com.github.shyiko:ktlint:0.27.0" 36 | } 37 | 38 | // graphql-java: 39 | // 8.0 directives are NOT visible in introspection query 40 | // 9.0 directives are visible in introspection query 41 | 42 | compileKotlin { 43 | kotlinOptions.jvmTarget = "1.8" 44 | } 45 | compileTestKotlin { 46 | kotlinOptions.jvmTarget = "1.8" 47 | } 48 | 49 | tasks.withType(Test) { 50 | useJUnitPlatform() 51 | testLogging { 52 | events("passed", "skipped", "failed") 53 | } 54 | jacoco { 55 | destinationFile = file("${buildDir}/jacoco/test.exec") 56 | } 57 | } 58 | 59 | task ktlint(type: JavaExec, group: "verification") { 60 | description = "Check Kotlin code style." 61 | classpath = configurations.ktlint 62 | main = "com.github.shyiko.ktlint.Main" 63 | args "src/**/*.kt" 64 | } 65 | check.dependsOn ktlint 66 | 67 | dokka { 68 | outputFormat = 'javadoc' 69 | outputDirectory = "$buildDir/docs/javadoc" 70 | // suppress internal package 71 | packageOptions { 72 | prefix = "io.github.mstachniuk.graphqlschemafromintrospectiongenerator.internal" 73 | suppress = true 74 | } 75 | } 76 | javadoc.dependsOn dokka 77 | 78 | jacoco { 79 | toolVersion = "0.8.1" 80 | } 81 | 82 | jacocoTestReport { 83 | reports { 84 | xml.enabled true 85 | csv.enabled false 86 | html.destination file("${buildDir}/jacocoHtml") 87 | } 88 | } 89 | 90 | build.dependsOn jacocoTestReport 91 | -------------------------------------------------------------------------------- /core/src/main/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/Generator.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator 2 | 3 | import io.github.mstachniuk.graphqlschemafromintrospectiongenerator.internal.GeneratorImpl 4 | 5 | /** 6 | * This class contains function for generate GraphQL Schema 7 | */ 8 | class Generator { 9 | 10 | /** 11 | * This function generate GraphQL schema language (also called Graphql DSL or SDL) from 12 | * introspection query result. 13 | * 14 | * Argument for this function should be in JSON format returned by introspection query: 15 | * ``` 16 | * { 17 | * "data": { 18 | * "__schema": { 19 | * "queryType": { 20 | * "name": "Query" 21 | * }, 22 | * "types": [...], 23 | * "directives": [...] 24 | * } 25 | * } 26 | * } 27 | * ``` 28 | * 29 | * @param input Introspection query result 30 | * @return GraphQL Schema definition 31 | */ 32 | fun generate(input: String): String { 33 | return GeneratorImpl().generate(input, GeneratorSettings()) 34 | } 35 | 36 | /** 37 | * Another version of [generate] method with additional settings argument. 38 | * 39 | * @param input Introspection query result 40 | * @param settings Settings how to generate Schema 41 | * @return GraphQL Schema definition 42 | * @since 0.2.0 43 | */ 44 | fun generate(input: String, settings: GeneratorSettings): String { 45 | return GeneratorImpl().generate(input, settings) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/GeneratorSettings.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator 2 | 3 | /** 4 | * Class for Generator Settings 5 | * 6 | * @property trimStartComments Comments in GraphQL Schema usually start from leading space (between # and first letter). This lead that graphql-java will generate description field also with leading space what can lead to different generated schema. To avoid that this property is set to false by default. 7 | * @property trimEndComments Sometimes comments ends with space. It is not trim by default. When this property is false it can produce empty lines in comments when description contains new lines \n 8 | */ 9 | data class GeneratorSettings(val trimStartComments: Boolean = false, val trimEndComments: Boolean = false) 10 | -------------------------------------------------------------------------------- /core/src/main/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/internal/GeneratorImpl.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator.internal 2 | 3 | import com.beust.klaxon.Klaxon 4 | import io.github.mstachniuk.graphqlschemafromintrospectiongenerator.GeneratorSettings 5 | 6 | internal class GeneratorImpl { 7 | 8 | val margin = " " 9 | val primitiveScalars = listOf("Boolean", "Float", "ID", "Int", "String") 10 | val primitiveDirectives = listOf("include", "skip", "defer", "deprecated") 11 | 12 | fun generate( 13 | input: String, 14 | settings: GeneratorSettings 15 | ): String { 16 | val response = Klaxon().parse(input) ?: return "" 17 | 18 | val output = printSchema(response) + printTypes(response, settings) + printDirectives(response, settings) 19 | 20 | return output.trimIndent().trimIndent() 21 | } 22 | 23 | private fun printDirectives(response: IntrospectionResponse, settings: GeneratorSettings): String { 24 | return response.data.schema.directives!! 25 | .filter { !primitiveDirectives.contains(it.name) } 26 | .sortedBy { it.name } 27 | .map { "${printDescription(it, settings, false)}directive @${it.name}${printArguments(it.args, settings)} on ${printDirectiveLocation(it)}" } 28 | .joinToString("\n\n") 29 | } 30 | 31 | private fun printDirectiveLocation(directive: GraphQLDirective): String { 32 | return directive.locations 33 | .sortedBy { it } 34 | .joinToString(" | ") 35 | } 36 | 37 | private fun printSchema(response: IntrospectionResponse): String = 38 | if (isCustomQueryType(response) || isCustomMutationType(response) || isCustomSubscriptionType(response) 39 | ) { 40 | "schema {\n" + 41 | if (isCustomQueryType(response)) { 42 | "${margin}query: ${response.data.schema.queryType?.name}\n" 43 | } else { 44 | "" 45 | } + 46 | if (isCustomMutationType(response)) { 47 | "${margin}mutation: ${response.data.schema.mutationType?.name}\n" 48 | } else { 49 | "" 50 | } + 51 | if (isCustomSubscriptionType(response)) { 52 | "${margin}subscription: ${response.data.schema.subscriptionType?.name}\n" 53 | } else { 54 | "" 55 | } + 56 | "}\n\n" 57 | } else { 58 | "" 59 | } 60 | 61 | private fun isCustomQueryType(response: IntrospectionResponse) = 62 | response.data.schema.queryType != null && response.data.schema.queryType.name != "Query" 63 | 64 | private fun isCustomMutationType(response: IntrospectionResponse) = 65 | response.data.schema.mutationType != null && response.data.schema.mutationType.name != "Mutation" 66 | 67 | private fun isCustomSubscriptionType(response: IntrospectionResponse) = 68 | response.data.schema.subscriptionType != null && response.data.schema.subscriptionType.name != "Subscription" 69 | 70 | private fun printTypes(response: IntrospectionResponse, settings: GeneratorSettings): String { 71 | val types = response.data.schema.types!! 72 | .filter { !it.name.startsWith("__") } 73 | .filter { !primitiveScalars.contains(it.name) } 74 | 75 | var output = "" 76 | 77 | types.sortedBy { it.name }.forEach { 78 | val kind = when { 79 | it.kind == "OBJECT" -> "type" 80 | it.kind == "ENUM" -> "enum" 81 | it.kind == "INPUT_OBJECT" -> "input" 82 | it.kind == "INTERFACE" -> "interface" 83 | it.kind == "UNION" -> "union" 84 | it.kind == "SCALAR" -> "scalar" 85 | else -> "UNKNOWN_TYPE" 86 | } 87 | 88 | output += printDescription(it, settings, false) 89 | output += "$kind ${it.name}${printInterfaces(it.interfaces)}" 90 | output += printBody(it, settings) 91 | } 92 | return output 93 | } 94 | 95 | private fun printBody(type: GraphQLType, settings: GeneratorSettings): String { 96 | if (type.kind == "UNION") { 97 | return " = ${type.possibleTypes 98 | .sortedBy { it.name } 99 | .joinToString(" | ") { it.name }}\n\n" 100 | } 101 | if (type.kind == "SCALAR") { 102 | return "\n\n" 103 | } 104 | var output = " {\n" 105 | type.fields.sortedBy { it.name } 106 | .forEach { 107 | output += printField(it, settings) 108 | } 109 | type.inputFields.sortedBy { it.name } 110 | .forEach { 111 | output += printField(it, settings) 112 | } 113 | output += printEnumTypes(type.enumValues, settings) 114 | 115 | output += "}\n\n" 116 | return output 117 | } 118 | 119 | private fun printEnumTypes(enumValues: List, settings: GeneratorSettings): String = 120 | if (containsDescription(enumValues)) { 121 | val enums = enumValues 122 | .sortedBy { it.name } 123 | .map { "${printDescription(it, settings)}$margin${it.name}" } 124 | .joinToString("\n") 125 | "$enums\n" 126 | } else { 127 | val enumValuesText = enumValues.joinToString(", ") { it.name } 128 | if (enumValuesText.isNotBlank()) { 129 | "$margin$enumValuesText\n" 130 | } else { 131 | "" 132 | } 133 | } 134 | 135 | private fun printDescription(it: Descriptable, settings: GeneratorSettings, addMargin: Boolean = true): String { 136 | var output = "" 137 | if (it.description.isNotBlank()) { 138 | if (addMargin) { 139 | output += margin 140 | } 141 | var desc = if (settings.trimStartComments) it.description.trimStart() else it.description 142 | desc = if (settings.trimEndComments) desc.trimEnd() else desc 143 | output += "#${desc.replace("\n", "\n$margin#")}\n" 144 | } 145 | return output 146 | } 147 | 148 | private fun printType(type: GraphQLFieldType): String { 149 | if (type.kind == "NON_NULL") { 150 | return "${printType(type.ofType!!)}!" 151 | } 152 | if (type.kind == "LIST") { 153 | return "[${printType(type.ofType!!)}]" 154 | } 155 | return type.name 156 | } 157 | 158 | private fun printField(field: GraphQLField, settings: GeneratorSettings): String { 159 | val arguments = printArguments(field.args.sortedBy { it.name }, settings) 160 | return "${printDescription(field, settings)}$margin${field.name}$arguments: ${printType(field.type)}" + 161 | "${printDefaultValue(field)}\n" 162 | } 163 | 164 | private fun printDefaultValue(field: GraphQLField): String { 165 | if (field.defaultValue.isNotBlank()) { 166 | if (containsEnumType(field.type)) { 167 | return " = ${field.defaultValue.replace("\"", "")}" 168 | } 169 | return " = ${field.defaultValue}" 170 | } 171 | return "" 172 | } 173 | 174 | private fun containsEnumType(type: GraphQLFieldType): Boolean { 175 | return when { 176 | type.kind == "ENUM" -> return true 177 | type.ofType == null -> return false 178 | else -> containsEnumType(type.ofType) 179 | } 180 | } 181 | 182 | private fun printArguments(args: List, settings: GeneratorSettings): String { 183 | if (containsDescription(args)) { 184 | val arguments = args 185 | .map { 186 | "${printDescription(it, settings)}$margin${it.name}: ${printType(it.type)}${printDefaultValue(it)}" 187 | } 188 | .joinToString("\n") 189 | if (arguments.isNotBlank()) { 190 | return "(\n$arguments\n)" 191 | } 192 | } else { 193 | val arguments = args 194 | .map { "${it.name}: ${printType(it.type)}${printDefaultValue(it)}" } 195 | .joinToString(", ") 196 | if (arguments.isNotBlank()) { 197 | return "($arguments)" 198 | } 199 | } 200 | return "" 201 | } 202 | 203 | private fun containsDescription(args: List) = 204 | args.any { it.description.isNotBlank() } 205 | 206 | private fun printInterfaces(interfaces: List): String { 207 | val interfaceList = interfaces.sortedBy { it.name } 208 | .map { it.name } 209 | .joinToString(" & ") 210 | if (interfaceList.isNotBlank()) { 211 | return " implements $interfaceList" 212 | } 213 | return "" 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /core/src/main/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/internal/Schema.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator.internal 2 | 3 | import com.beust.klaxon.Json 4 | 5 | internal data class IntrospectionResponse(val data: DataNode) 6 | internal data class DataNode(@Json(name = "__schema") val schema: Schema) 7 | 8 | internal data class Schema( 9 | val queryType: QueryType?, 10 | val mutationType: MutationType? = null, 11 | val subscriptionType: SubscriptionType? = null, 12 | val types: List? = null, 13 | val directives: List? = null 14 | ) 15 | 16 | internal data class QueryType(val name: String) 17 | internal data class MutationType(val name: String) 18 | internal data class SubscriptionType(val name: String) 19 | internal data class GraphQLType( 20 | val kind: String, 21 | val name: String, 22 | override val description: String = "", 23 | val fields: List = listOf(), 24 | val enumValues: List = listOf(), 25 | val inputFields: List = listOf(), 26 | val interfaces: List = listOf(), 27 | val possibleTypes: List = listOf() 28 | ) : Descriptable 29 | 30 | internal data class GraphQLField( 31 | val name: String, 32 | override val description: String = "", 33 | val args: List = listOf(), 34 | val type: GraphQLFieldType, 35 | val defaultValue: String = "" 36 | ) : Descriptable 37 | 38 | internal data class GraphQLFieldType( 39 | val kind: String, 40 | val name: String = "", 41 | val ofType: GraphQLFieldType? = null 42 | ) 43 | 44 | internal data class GraphQLEnumType( 45 | val name: String, 46 | override val description: String = "" 47 | ) : Descriptable 48 | 49 | internal interface Descriptable { 50 | val description: String 51 | } 52 | 53 | internal data class GraphQLDirective( 54 | val name: String, 55 | override val description: String = "", 56 | val locations: List = listOf(), 57 | val args: List = listOf() 58 | ) : Descriptable 59 | -------------------------------------------------------------------------------- /core/src/test/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/GeneratorTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator 2 | 3 | import org.junit.jupiter.api.Assertions.assertEquals 4 | import org.junit.jupiter.api.Test 5 | import org.junit.jupiter.api.TestInstance 6 | import org.junit.jupiter.params.ParameterizedTest 7 | import org.junit.jupiter.params.provider.MethodSource 8 | import java.io.File 9 | import java.util.stream.Stream 10 | 11 | @TestInstance(TestInstance.Lifecycle.PER_CLASS) 12 | internal class GeneratorTest { 13 | 14 | @ParameterizedTest 15 | @MethodSource("sourceProvider") 16 | fun `should generate schema`(args: Pair) { 17 | val input = File(args.first).readText().trimIndent() 18 | val expected = File(args.second).readText().trimIndent() 19 | val gen = Generator() 20 | 21 | val result = gen.generate(input) 22 | 23 | assertEquals(expected, result) 24 | } 25 | 26 | fun sourceProvider(): Stream> { 27 | val path = System.getProperty("user.dir") + "/src/test/resources/testdata" 28 | val file = File(path) 29 | val list = file.list { _, name -> name.matches("input-(\\d*)\\.json$".toRegex()) } 30 | .map { name -> Pair("$path/$name", "$path/" + name.replace("input", "schema") 31 | .replace(".json", ".graphqls")) } 32 | return list.stream() 33 | } 34 | 35 | @Test 36 | fun `should trim space in comments`() { 37 | val path = System.getProperty("user.dir") + "/src/test/resources/testdata/input-6.json" 38 | val input = File(path).readText().trimIndent() 39 | val gen = Generator() 40 | 41 | val result = gen.generate(input, GeneratorSettings(true)) 42 | 43 | val expectedResult = """#description of customer 44 | type Customer { 45 | #unique id 46 | id: ID! 47 | #lastname comment with 5 leading spaces 48 | lastname: String 49 | #name comment without leading space 50 | name: String 51 | } 52 | 53 | type Query { 54 | customer(id: String): Customer 55 | }""" 56 | assertEquals(expectedResult, result) 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /core/src/test/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/GraphQLServer.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator 2 | 3 | import graphql.GraphQL 4 | import graphql.language.InterfaceTypeDefinition 5 | import graphql.language.UnionTypeDefinition 6 | import graphql.schema.Coercing 7 | import graphql.schema.GraphQLObjectType 8 | import graphql.schema.GraphQLScalarType 9 | import graphql.schema.TypeResolver 10 | import graphql.schema.idl.RuntimeWiring 11 | import graphql.schema.idl.SchemaGenerator 12 | import graphql.schema.idl.SchemaParser 13 | import graphql.schema.idl.TypeDefinitionRegistry 14 | import graphql.schema.idl.TypeRuntimeWiring 15 | import org.json.JSONObject 16 | 17 | class GraphQLServer { 18 | companion object { 19 | const val INTROSPECTION_QUERY = "query IntrospectionQuery {\n" + 20 | " __schema {\n" + 21 | " queryType { name }\n" + 22 | " mutationType { name }\n" + 23 | " subscriptionType { name }\n" + 24 | " types {\n" + 25 | " ...FullType\n" + 26 | " }\n" + 27 | " directives {\n" + 28 | " name\n" + 29 | " description\n" + 30 | " locations\n" + 31 | " args {\n" + 32 | " ...InputValue\n" + 33 | " }\n" + 34 | " }\n" + 35 | " }\n" + 36 | "}\n" + 37 | "\n" + 38 | "fragment FullType on __Type {\n" + 39 | " kind\n" + 40 | " name\n" + 41 | " description\n" + 42 | " fields(includeDeprecated: true) {\n" + 43 | " name\n" + 44 | " description\n" + 45 | " args {\n" + 46 | " ...InputValue\n" + 47 | " }\n" + 48 | " type {\n" + 49 | " ...TypeRef\n" + 50 | " }\n" + 51 | " isDeprecated\n" + 52 | " deprecationReason\n" + 53 | " }\n" + 54 | " inputFields {\n" + 55 | " ...InputValue\n" + 56 | " }\n" + 57 | " interfaces {\n" + 58 | " ...TypeRef\n" + 59 | " }\n" + 60 | " enumValues(includeDeprecated: true) {\n" + 61 | " name\n" + 62 | " description\n" + 63 | " isDeprecated\n" + 64 | " deprecationReason\n" + 65 | " }\n" + 66 | " possibleTypes {\n" + 67 | " ...TypeRef\n" + 68 | " }\n" + 69 | "}\n" + 70 | "\n" + 71 | "fragment InputValue on __InputValue {\n" + 72 | " name\n" + 73 | " description\n" + 74 | " type { ...TypeRef }\n" + 75 | " defaultValue\n" + 76 | "}\n" + 77 | "\n" + 78 | "fragment TypeRef on __Type {\n" + 79 | " kind\n" + 80 | " name\n" + 81 | " ofType {\n" + 82 | " kind\n" + 83 | " name\n" + 84 | " ofType {\n" + 85 | " kind\n" + 86 | " name\n" + 87 | " ofType {\n" + 88 | " kind\n" + 89 | " name\n" + 90 | " ofType {\n" + 91 | " kind\n" + 92 | " name\n" + 93 | " ofType {\n" + 94 | " kind\n" + 95 | " name\n" + 96 | " ofType {\n" + 97 | " kind\n" + 98 | " name\n" + 99 | " ofType {\n" + 100 | " kind\n" + 101 | " name\n" + 102 | " }\n" + 103 | " }\n" + 104 | " }\n" + 105 | " }\n" + 106 | " }\n" + 107 | " }\n" + 108 | " }\n" + 109 | "}" 110 | 111 | val defaultScalars = listOf("Int", "Float", "String", "Boolean", "ID", "Long", "BigInteger", "BigDecimal", 112 | "Short", "Char") 113 | 114 | fun createGraphQLServer(schemaText: String): GraphQLSerer { 115 | val schemaParser = SchemaParser() 116 | val registry = schemaParser.parse(schemaText) 117 | val schemaGenerator = SchemaGenerator() 118 | val runtimeWiring = createRuntimeWiring(registry) 119 | val schema = schemaGenerator.makeExecutableSchema(registry, runtimeWiring) 120 | val graphql = GraphQL.newGraphQL(schema).build() 121 | return GraphQLSerer(graphql) 122 | } 123 | 124 | private fun createRuntimeWiring(registry: TypeDefinitionRegistry): RuntimeWiring { 125 | val wiring = RuntimeWiring.newRuntimeWiring() 126 | registry.scalars() 127 | .filterKeys { key -> !defaultScalars.contains(key) } 128 | .forEach { wiring.scalar(dummyScalar(it.key)) } 129 | val interfaceTypes = registry.getTypes(InterfaceTypeDefinition::class.java) 130 | interfaceTypes.forEach { 131 | wiring.type(TypeRuntimeWiring.newTypeWiring(it.name).typeResolver(defaultTypeResolver())) 132 | } 133 | val unionTypes = registry.getTypes(UnionTypeDefinition::class.java) 134 | unionTypes.forEach { 135 | wiring.type(TypeRuntimeWiring.newTypeWiring(it.name).typeResolver(defaultTypeResolver())) 136 | } 137 | return wiring.build() 138 | } 139 | 140 | private fun defaultTypeResolver(): TypeResolver { 141 | return TypeResolver { GraphQLObjectType.newObject().build(); } 142 | } 143 | 144 | private fun dummyScalar(name: String): GraphQLScalarType { 145 | return GraphQLScalarType(name, null, object : Coercing { 146 | override fun parseValue(input: Any?): Any { 147 | return "" 148 | } 149 | 150 | override fun parseLiteral(input: Any?): Any { 151 | return "" 152 | } 153 | 154 | override fun serialize(dataFetcherResult: Any?): Any { 155 | return "" 156 | } 157 | }) 158 | } 159 | } 160 | 161 | class GraphQLSerer(val graphql: GraphQL) { 162 | fun runIntrospectionQuery(): String { 163 | val introspectionQueryResult = graphql.execute(INTROSPECTION_QUERY) 164 | return JSONObject(introspectionQueryResult).toString() 165 | } 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /core/src/test/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/IntroToIntroTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator 2 | 3 | import org.junit.jupiter.api.Test 4 | import org.skyscreamer.jsonassert.JSONAssert 5 | import java.io.File 6 | 7 | class IntroToIntroTest { 8 | 9 | /** 10 | * This test make this conversions: 11 | * Introspection Query result -> GraphQL Schema -> Introspection Query result 12 | * and compare first and last result. It should be the same - it's JSON format, the order of elements doesn't 13 | * matter. Sometimes result can be different because of another behaviour in case of null values - some 14 | * frameworks add e.g. `description: null` node, another not. 15 | * This test is slower then [GeneratorTest] and is considered for exploratory tests of Generator. 16 | */ 17 | @Test 18 | fun `should test from introspection result to introspection result`() { 19 | // given 20 | val path = System.getProperty("user.dir") + "/src/test/resources/testdata/intro2intro.json" 21 | val introspectionText = File(path).readText() 22 | val generator = Generator() 23 | 24 | // when 25 | val schemaText = generator.generate(introspectionText) 26 | // println(schemaText) 27 | val graphql = GraphQLServer.createGraphQLServer(schemaText) 28 | val jsonString = graphql.runIntrospectionQuery() 29 | // println(jsonString) 30 | 31 | // then 32 | JSONAssert.assertEquals(introspectionText, jsonString, false) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/test/kotlin/io/github/mstachniuk/graphqlschemafromintrospectiongenerator/SchemaToSchemaTest.kt: -------------------------------------------------------------------------------- 1 | package io.github.mstachniuk.graphqlschemafromintrospectiongenerator 2 | 3 | import org.junit.jupiter.api.Assertions.assertEquals 4 | import org.junit.jupiter.api.Test 5 | import java.io.File 6 | 7 | class SchemaToSchemaTest { 8 | 9 | /** 10 | * This test make those conversions: 11 | * GraphQL Schema -> Introspection Query result -> GraphQL Schema 12 | * and compare begin schema with end schema. It takes more time then [GeneratorTest] and should be used for 13 | * exploratory tests of Generator 14 | */ 15 | @Test 16 | fun `should test from schema to schema`() { 17 | // given 18 | val path = System.getProperty("user.dir") + "/src/test/resources/testdata/schema2schema.graphqls" 19 | val schemaText = File(path).readText() 20 | 21 | val graphql = GraphQLServer.createGraphQLServer(schemaText) 22 | val generator = Generator() 23 | 24 | // when 25 | val jsonString = graphql.runIntrospectionQuery() 26 | // println(jsonString) 27 | val generatedSchema = generator.generate(jsonString) 28 | 29 | // then 30 | assertEquals(schemaText, generatedSchema) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/input-10.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "__schema": { 4 | "types": [ 5 | { 6 | "name": "Query", 7 | "interfaces": [], 8 | "fields": [ 9 | { 10 | "name": "text", 11 | "args": [ 12 | { 13 | "name": "id", 14 | "type": { 15 | "name": "String", 16 | "kind": "SCALAR" 17 | } 18 | } 19 | ], 20 | "isDeprecated": false, 21 | "type": { 22 | "name": "String", 23 | "kind": "SCALAR" 24 | } 25 | } 26 | ], 27 | "kind": "OBJECT" 28 | }, 29 | { 30 | "name": "String", 31 | "description": "Built-in String", 32 | "kind": "SCALAR" 33 | }, 34 | { 35 | "name": "__Schema", 36 | "description": "A GraphQL Introspection defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, the entry points for query, mutation, and subscription operations.", 37 | "interfaces": [], 38 | "fields": [ 39 | { 40 | "name": "types", 41 | "args": [], 42 | "description": "A list of all types supported by this server.", 43 | "isDeprecated": false, 44 | "type": { 45 | "kind": "NON_NULL", 46 | "ofType": { 47 | "kind": "LIST", 48 | "ofType": { 49 | "kind": "NON_NULL", 50 | "ofType": { 51 | "name": "__Type", 52 | "kind": "OBJECT" 53 | } 54 | } 55 | } 56 | } 57 | }, 58 | { 59 | "name": "queryType", 60 | "args": [], 61 | "description": "The type that query operations will be rooted at.", 62 | "isDeprecated": false, 63 | "type": { 64 | "kind": "NON_NULL", 65 | "ofType": { 66 | "name": "__Type", 67 | "kind": "OBJECT" 68 | } 69 | } 70 | }, 71 | { 72 | "name": "mutationType", 73 | "args": [], 74 | "description": "If this server supports mutation, the type that mutation operations will be rooted at.", 75 | "isDeprecated": false, 76 | "type": { 77 | "name": "__Type", 78 | "kind": "OBJECT" 79 | } 80 | }, 81 | { 82 | "name": "directives", 83 | "args": [], 84 | "description": "'A list of all directives supported by this server.", 85 | "isDeprecated": false, 86 | "type": { 87 | "kind": "NON_NULL", 88 | "ofType": { 89 | "kind": "LIST", 90 | "ofType": { 91 | "kind": "NON_NULL", 92 | "ofType": { 93 | "name": "__Directive", 94 | "kind": "OBJECT" 95 | } 96 | } 97 | } 98 | } 99 | }, 100 | { 101 | "name": "subscriptionType", 102 | "args": [], 103 | "description": "'If this server support subscription, the type that subscription operations will be rooted at.", 104 | "isDeprecated": false, 105 | "type": { 106 | "name": "__Type", 107 | "kind": "OBJECT" 108 | } 109 | } 110 | ], 111 | "kind": "OBJECT" 112 | }, 113 | { 114 | "name": "__Type", 115 | "interfaces": [], 116 | "fields": [ 117 | { 118 | "name": "kind", 119 | "args": [], 120 | "isDeprecated": false, 121 | "type": { 122 | "kind": "NON_NULL", 123 | "ofType": { 124 | "name": "__TypeKind", 125 | "kind": "ENUM" 126 | } 127 | } 128 | }, 129 | { 130 | "name": "name", 131 | "args": [], 132 | "isDeprecated": false, 133 | "type": { 134 | "name": "String", 135 | "kind": "SCALAR" 136 | } 137 | }, 138 | { 139 | "name": "description", 140 | "args": [], 141 | "isDeprecated": false, 142 | "type": { 143 | "name": "String", 144 | "kind": "SCALAR" 145 | } 146 | }, 147 | { 148 | "name": "fields", 149 | "args": [ 150 | { 151 | "name": "includeDeprecated", 152 | "type": { 153 | "name": "Boolean", 154 | "kind": "SCALAR" 155 | }, 156 | "defaultValue": "false" 157 | } 158 | ], 159 | "isDeprecated": false, 160 | "type": { 161 | "kind": "LIST", 162 | "ofType": { 163 | "kind": "NON_NULL", 164 | "ofType": { 165 | "name": "__Field", 166 | "kind": "OBJECT" 167 | } 168 | } 169 | } 170 | }, 171 | { 172 | "name": "interfaces", 173 | "args": [], 174 | "isDeprecated": false, 175 | "type": { 176 | "kind": "LIST", 177 | "ofType": { 178 | "kind": "NON_NULL", 179 | "ofType": { 180 | "name": "__Type", 181 | "kind": "OBJECT" 182 | } 183 | } 184 | } 185 | }, 186 | { 187 | "name": "possibleTypes", 188 | "args": [], 189 | "isDeprecated": false, 190 | "type": { 191 | "kind": "LIST", 192 | "ofType": { 193 | "kind": "NON_NULL", 194 | "ofType": { 195 | "name": "__Type", 196 | "kind": "OBJECT" 197 | } 198 | } 199 | } 200 | }, 201 | { 202 | "name": "enumValues", 203 | "args": [ 204 | { 205 | "name": "includeDeprecated", 206 | "type": { 207 | "name": "Boolean", 208 | "kind": "SCALAR" 209 | }, 210 | "defaultValue": "false" 211 | } 212 | ], 213 | "isDeprecated": false, 214 | "type": { 215 | "kind": "LIST", 216 | "ofType": { 217 | "kind": "NON_NULL", 218 | "ofType": { 219 | "name": "__EnumValue", 220 | "kind": "OBJECT" 221 | } 222 | } 223 | } 224 | }, 225 | { 226 | "name": "inputFields", 227 | "args": [], 228 | "isDeprecated": false, 229 | "type": { 230 | "kind": "LIST", 231 | "ofType": { 232 | "kind": "NON_NULL", 233 | "ofType": { 234 | "name": "__InputValue", 235 | "kind": "OBJECT" 236 | } 237 | } 238 | } 239 | }, 240 | { 241 | "name": "ofType", 242 | "args": [], 243 | "isDeprecated": false, 244 | "type": { 245 | "name": "__Type", 246 | "kind": "OBJECT" 247 | } 248 | } 249 | ], 250 | "kind": "OBJECT" 251 | }, 252 | { 253 | "name": "__TypeKind", 254 | "description": "An enum describing what kind of type a given __Type is", 255 | "kind": "ENUM", 256 | "enumValues": [ 257 | { 258 | "name": "SCALAR", 259 | "description": "Indicates this type is a scalar.", 260 | "isDeprecated": false 261 | }, 262 | { 263 | "name": "OBJECT", 264 | "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", 265 | "isDeprecated": false 266 | }, 267 | { 268 | "name": "INTERFACE", 269 | "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", 270 | "isDeprecated": false 271 | }, 272 | { 273 | "name": "UNION", 274 | "description": "Indicates this type is a union. `possibleTypes` is a valid field.", 275 | "isDeprecated": false 276 | }, 277 | { 278 | "name": "ENUM", 279 | "description": "Indicates this type is an enum. `enumValues` is a valid field.", 280 | "isDeprecated": false 281 | }, 282 | { 283 | "name": "INPUT_OBJECT", 284 | "description": "Indicates this type is an input object. `inputFields` is a valid field.", 285 | "isDeprecated": false 286 | }, 287 | { 288 | "name": "LIST", 289 | "description": "Indicates this type is a list. `ofType` is a valid field.", 290 | "isDeprecated": false 291 | }, 292 | { 293 | "name": "NON_NULL", 294 | "description": "Indicates this type is a non-null. `ofType` is a valid field.", 295 | "isDeprecated": false 296 | } 297 | ] 298 | }, 299 | { 300 | "name": "__Field", 301 | "interfaces": [], 302 | "fields": [ 303 | { 304 | "name": "name", 305 | "args": [], 306 | "isDeprecated": false, 307 | "type": { 308 | "kind": "NON_NULL", 309 | "ofType": { 310 | "name": "String", 311 | "kind": "SCALAR" 312 | } 313 | } 314 | }, 315 | { 316 | "name": "description", 317 | "args": [], 318 | "isDeprecated": false, 319 | "type": { 320 | "name": "String", 321 | "kind": "SCALAR" 322 | } 323 | }, 324 | { 325 | "name": "args", 326 | "args": [], 327 | "isDeprecated": false, 328 | "type": { 329 | "kind": "NON_NULL", 330 | "ofType": { 331 | "kind": "LIST", 332 | "ofType": { 333 | "kind": "NON_NULL", 334 | "ofType": { 335 | "name": "__InputValue", 336 | "kind": "OBJECT" 337 | } 338 | } 339 | } 340 | } 341 | }, 342 | { 343 | "name": "type", 344 | "args": [], 345 | "isDeprecated": false, 346 | "type": { 347 | "kind": "NON_NULL", 348 | "ofType": { 349 | "name": "__Type", 350 | "kind": "OBJECT" 351 | } 352 | } 353 | }, 354 | { 355 | "name": "isDeprecated", 356 | "args": [], 357 | "isDeprecated": false, 358 | "type": { 359 | "kind": "NON_NULL", 360 | "ofType": { 361 | "name": "Boolean", 362 | "kind": "SCALAR" 363 | } 364 | } 365 | }, 366 | { 367 | "name": "deprecationReason", 368 | "args": [], 369 | "isDeprecated": false, 370 | "type": { 371 | "name": "String", 372 | "kind": "SCALAR" 373 | } 374 | } 375 | ], 376 | "kind": "OBJECT" 377 | }, 378 | { 379 | "name": "__InputValue", 380 | "interfaces": [], 381 | "fields": [ 382 | { 383 | "name": "name", 384 | "args": [], 385 | "isDeprecated": false, 386 | "type": { 387 | "kind": "NON_NULL", 388 | "ofType": { 389 | "name": "String", 390 | "kind": "SCALAR" 391 | } 392 | } 393 | }, 394 | { 395 | "name": "description", 396 | "args": [], 397 | "isDeprecated": false, 398 | "type": { 399 | "name": "String", 400 | "kind": "SCALAR" 401 | } 402 | }, 403 | { 404 | "name": "type", 405 | "args": [], 406 | "isDeprecated": false, 407 | "type": { 408 | "kind": "NON_NULL", 409 | "ofType": { 410 | "name": "__Type", 411 | "kind": "OBJECT" 412 | } 413 | } 414 | }, 415 | { 416 | "name": "defaultValue", 417 | "args": [], 418 | "isDeprecated": false, 419 | "type": { 420 | "name": "String", 421 | "kind": "SCALAR" 422 | } 423 | } 424 | ], 425 | "kind": "OBJECT" 426 | }, 427 | { 428 | "name": "Boolean", 429 | "description": "Built-in Boolean", 430 | "kind": "SCALAR" 431 | }, 432 | { 433 | "name": "__EnumValue", 434 | "interfaces": [], 435 | "fields": [ 436 | { 437 | "name": "name", 438 | "args": [], 439 | "isDeprecated": false, 440 | "type": { 441 | "kind": "NON_NULL", 442 | "ofType": { 443 | "name": "String", 444 | "kind": "SCALAR" 445 | } 446 | } 447 | }, 448 | { 449 | "name": "description", 450 | "args": [], 451 | "isDeprecated": false, 452 | "type": { 453 | "name": "String", 454 | "kind": "SCALAR" 455 | } 456 | }, 457 | { 458 | "name": "isDeprecated", 459 | "args": [], 460 | "isDeprecated": false, 461 | "type": { 462 | "kind": "NON_NULL", 463 | "ofType": { 464 | "name": "Boolean", 465 | "kind": "SCALAR" 466 | } 467 | } 468 | }, 469 | { 470 | "name": "deprecationReason", 471 | "args": [], 472 | "isDeprecated": false, 473 | "type": { 474 | "name": "String", 475 | "kind": "SCALAR" 476 | } 477 | } 478 | ], 479 | "kind": "OBJECT" 480 | }, 481 | { 482 | "name": "__Directive", 483 | "interfaces": [], 484 | "fields": [ 485 | { 486 | "name": "name", 487 | "args": [], 488 | "isDeprecated": false, 489 | "type": { 490 | "name": "String", 491 | "kind": "SCALAR" 492 | } 493 | }, 494 | { 495 | "name": "description", 496 | "args": [], 497 | "isDeprecated": false, 498 | "type": { 499 | "name": "String", 500 | "kind": "SCALAR" 501 | } 502 | }, 503 | { 504 | "name": "locations", 505 | "args": [], 506 | "isDeprecated": false, 507 | "type": { 508 | "kind": "LIST", 509 | "ofType": { 510 | "kind": "NON_NULL", 511 | "ofType": { 512 | "name": "__DirectiveLocation", 513 | "kind": "ENUM" 514 | } 515 | } 516 | } 517 | }, 518 | { 519 | "name": "args", 520 | "args": [], 521 | "isDeprecated": false, 522 | "type": { 523 | "kind": "NON_NULL", 524 | "ofType": { 525 | "kind": "LIST", 526 | "ofType": { 527 | "kind": "NON_NULL", 528 | "ofType": { 529 | "name": "__InputValue", 530 | "kind": "OBJECT" 531 | } 532 | } 533 | } 534 | } 535 | }, 536 | { 537 | "name": "onOperation", 538 | "args": [], 539 | "deprecationReason": "Use `locations`.", 540 | "isDeprecated": true, 541 | "type": { 542 | "name": "Boolean", 543 | "kind": "SCALAR" 544 | } 545 | }, 546 | { 547 | "name": "onFragment", 548 | "args": [], 549 | "deprecationReason": "Use `locations`.", 550 | "isDeprecated": true, 551 | "type": { 552 | "name": "Boolean", 553 | "kind": "SCALAR" 554 | } 555 | }, 556 | { 557 | "name": "onField", 558 | "args": [], 559 | "deprecationReason": "Use `locations`.", 560 | "isDeprecated": true, 561 | "type": { 562 | "name": "Boolean", 563 | "kind": "SCALAR" 564 | } 565 | } 566 | ], 567 | "kind": "OBJECT" 568 | }, 569 | { 570 | "name": "__DirectiveLocation", 571 | "description": "An enum describing valid locations where a directive can be placed", 572 | "kind": "ENUM", 573 | "enumValues": [ 574 | { 575 | "name": "QUERY", 576 | "description": "Indicates the directive is valid on queries.", 577 | "isDeprecated": false 578 | }, 579 | { 580 | "name": "MUTATION", 581 | "description": "Indicates the directive is valid on mutations.", 582 | "isDeprecated": false 583 | }, 584 | { 585 | "name": "FIELD", 586 | "description": "Indicates the directive is valid on fields.", 587 | "isDeprecated": false 588 | }, 589 | { 590 | "name": "FRAGMENT_DEFINITION", 591 | "description": "Indicates the directive is valid on fragment definitions.", 592 | "isDeprecated": false 593 | }, 594 | { 595 | "name": "FRAGMENT_SPREAD", 596 | "description": "Indicates the directive is valid on fragment spreads.", 597 | "isDeprecated": false 598 | }, 599 | { 600 | "name": "INLINE_FRAGMENT", 601 | "description": "Indicates the directive is valid on inline fragments.", 602 | "isDeprecated": false 603 | }, 604 | { 605 | "name": "SCHEMA", 606 | "description": "Indicates the directive is valid on a schema SDL definition.", 607 | "isDeprecated": false 608 | }, 609 | { 610 | "name": "SCALAR", 611 | "description": "Indicates the directive is valid on a scalar SDL definition.", 612 | "isDeprecated": false 613 | }, 614 | { 615 | "name": "OBJECT", 616 | "description": "Indicates the directive is valid on an object SDL definition.", 617 | "isDeprecated": false 618 | }, 619 | { 620 | "name": "FIELD_DEFINITION", 621 | "description": "Indicates the directive is valid on a field SDL definition.", 622 | "isDeprecated": false 623 | }, 624 | { 625 | "name": "ARGUMENT_DEFINITION", 626 | "description": "Indicates the directive is valid on a field argument SDL definition.", 627 | "isDeprecated": false 628 | }, 629 | { 630 | "name": "INTERFACE", 631 | "description": "Indicates the directive is valid on an interface SDL definition.", 632 | "isDeprecated": false 633 | }, 634 | { 635 | "name": "UNION", 636 | "description": "Indicates the directive is valid on an union SDL definition.", 637 | "isDeprecated": false 638 | }, 639 | { 640 | "name": "ENUM", 641 | "description": "Indicates the directive is valid on an enum SDL definition.", 642 | "isDeprecated": false 643 | }, 644 | { 645 | "name": "ENUM_VALUE", 646 | "description": "Indicates the directive is valid on an enum value SDL definition.", 647 | "isDeprecated": false 648 | }, 649 | { 650 | "name": "INPUT_OBJECT", 651 | "description": "Indicates the directive is valid on an input object SDL definition.", 652 | "isDeprecated": false 653 | }, 654 | { 655 | "name": "INPUT_FIELD_DEFINITION", 656 | "description": "Indicates the directive is valid on an input object field SDL definition.", 657 | "isDeprecated": false 658 | } 659 | ] 660 | } 661 | ], 662 | "directives": [ 663 | { 664 | "name": "include", 665 | "args": [ 666 | { 667 | "name": "if", 668 | "type": { 669 | "kind": "NON_NULL", 670 | "ofType": { 671 | "name": "Boolean", 672 | "kind": "SCALAR" 673 | } 674 | }, 675 | "description": "Included when true." 676 | } 677 | ], 678 | "description": "Directs the executor to include this field or fragment only when the `if` argument is true", 679 | "locations": [ 680 | "FIELD", 681 | "FRAGMENT_SPREAD", 682 | "INLINE_FRAGMENT" 683 | ] 684 | }, 685 | { 686 | "name": "skip", 687 | "args": [ 688 | { 689 | "name": "if", 690 | "type": { 691 | "kind": "NON_NULL", 692 | "ofType": { 693 | "name": "Boolean", 694 | "kind": "SCALAR" 695 | } 696 | }, 697 | "description": "Skipped when true." 698 | } 699 | ], 700 | "description": "Directs the executor to skip this field or fragment when the `if`'argument is true.", 701 | "locations": [ 702 | "FIELD", 703 | "FRAGMENT_SPREAD", 704 | "INLINE_FRAGMENT" 705 | ] 706 | }, 707 | { 708 | "name": "defer", 709 | "args": [], 710 | "description": "This directive allows results to be deferred during execution", 711 | "locations": [ 712 | "FIELD" 713 | ] 714 | }, 715 | { 716 | "name": "scalardirective", 717 | "args": [], 718 | "description": " Custom Scalar Directive", 719 | "locations": [ 720 | "SCALAR" 721 | ] 722 | }, 723 | { 724 | "name": "inputFieldDefinitionDirective", 725 | "args": [], 726 | "locations": [ 727 | "INPUT_FIELD_DEFINITION" 728 | ] 729 | }, 730 | { 731 | "name": "fieldDefinitionDirective", 732 | "args": [], 733 | "description": " Directive comment", 734 | "locations": [ 735 | "FIELD_DEFINITION" 736 | ] 737 | }, 738 | { 739 | "name": "enumDirective", 740 | "args": [], 741 | "locations": [ 742 | "ENUM" 743 | ] 744 | }, 745 | { 746 | "name": "fragmentSpread", 747 | "args": [], 748 | "locations": [ 749 | "FRAGMENT_SPREAD" 750 | ] 751 | }, 752 | { 753 | "name": "multiDirective", 754 | "args": [], 755 | "locations": [ 756 | "QUERY", 757 | "FIELD", 758 | "OBJECT", 759 | "UNION", 760 | "ENUM_VALUE" 761 | ] 762 | }, 763 | { 764 | "name": "interfaceDirective", 765 | "args": [], 766 | "locations": [ 767 | "INTERFACE" 768 | ] 769 | }, 770 | { 771 | "name": "inputObjectDirective", 772 | "args": [], 773 | "locations": [ 774 | "INPUT_OBJECT" 775 | ] 776 | }, 777 | { 778 | "name": "mutationDirective", 779 | "args": [], 780 | "locations": [ 781 | "MUTATION" 782 | ] 783 | }, 784 | { 785 | "name": "schemaDirective", 786 | "args": [], 787 | "locations": [ 788 | "SCHEMA" 789 | ] 790 | }, 791 | { 792 | "name": "deprecated", 793 | "args": [ 794 | { 795 | "name": "reason", 796 | "type": { 797 | "name": "String", 798 | "kind": "SCALAR" 799 | }, 800 | "defaultValue": "\"No longer supported\"" 801 | } 802 | ], 803 | "locations": [ 804 | "FIELD_DEFINITION", 805 | "ENUM_VALUE" 806 | ] 807 | }, 808 | { 809 | "name": "objectDirective", 810 | "args": [ 811 | { 812 | "name": "role", 813 | "type": { 814 | "kind": "NON_NULL", 815 | "ofType": { 816 | "name": "String", 817 | "kind": "SCALAR" 818 | } 819 | } 820 | } 821 | ], 822 | "locations": [ 823 | "OBJECT" 824 | ] 825 | }, 826 | { 827 | "name": "unionDirective", 828 | "args": [], 829 | "locations": [ 830 | "UNION" 831 | ] 832 | }, 833 | { 834 | "name": "queryDirective", 835 | "args": [], 836 | "locations": [ 837 | "QUERY" 838 | ] 839 | }, 840 | { 841 | "name": "fieldDirective", 842 | "args": [], 843 | "locations": [ 844 | "FIELD" 845 | ] 846 | }, 847 | { 848 | "name": "fragmentDirective", 849 | "args": [], 850 | "locations": [ 851 | "FRAGMENT_DEFINITION" 852 | ] 853 | }, 854 | { 855 | "name": "argumentDirective", 856 | "args": [], 857 | "locations": [ 858 | "ARGUMENT_DEFINITION" 859 | ] 860 | }, 861 | { 862 | "name": "inlineFragmentDirective", 863 | "args": [], 864 | "locations": [ 865 | "INLINE_FRAGMENT" 866 | ] 867 | }, 868 | { 869 | "name": "enumValDirective", 870 | "args": [], 871 | "locations": [ 872 | "ENUM_VALUE" 873 | ] 874 | } 875 | ], 876 | "queryType": { 877 | "name": "Query" 878 | } 879 | } 880 | }, 881 | "errors": [], 882 | "dataPresent": true 883 | } -------------------------------------------------------------------------------- /core/src/test/resources/testdata/input-5.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "__schema": { 4 | "types": [ 5 | { 6 | "name": "QueryType", 7 | "interfaces": [], 8 | "fields": [ 9 | { 10 | "name": "hero", 11 | "args": [ 12 | { 13 | "name": "episode", 14 | "type": { 15 | "name": "String", 16 | "kind": "SCALAR" 17 | } 18 | } 19 | ], 20 | "isDeprecated": false, 21 | "type": { 22 | "name": "String", 23 | "kind": "SCALAR" 24 | } 25 | } 26 | ], 27 | "kind": "OBJECT" 28 | }, 29 | { 30 | "name": "String", 31 | "description": "Built-in String", 32 | "kind": "SCALAR" 33 | }, 34 | { 35 | "name": "MutationType", 36 | "interfaces": [], 37 | "fields": [ 38 | { 39 | "name": "createHero", 40 | "args": [ 41 | { 42 | "name": "name", 43 | "type": { 44 | "name": "String", 45 | "kind": "SCALAR" 46 | } 47 | } 48 | ], 49 | "isDeprecated": false, 50 | "type": { 51 | "name": "String", 52 | "kind": "SCALAR" 53 | } 54 | } 55 | ], 56 | "kind": "OBJECT" 57 | }, 58 | { 59 | "name": "SubscriptionType", 60 | "interfaces": [], 61 | "fields": [ 62 | { 63 | "name": "subHero", 64 | "args": [ 65 | { 66 | "name": "name", 67 | "type": { 68 | "name": "String", 69 | "kind": "SCALAR" 70 | } 71 | } 72 | ], 73 | "isDeprecated": false, 74 | "type": { 75 | "name": "String", 76 | "kind": "SCALAR" 77 | } 78 | } 79 | ], 80 | "kind": "OBJECT" 81 | }, 82 | { 83 | "name": "__Schema", 84 | "description": "A GraphQL Introspection defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, the entry points for query, mutation, and subscription operations.", 85 | "interfaces": [], 86 | "fields": [ 87 | { 88 | "name": "types", 89 | "args": [], 90 | "description": "A list of all types supported by this server.", 91 | "isDeprecated": false, 92 | "type": { 93 | "kind": "NON_NULL", 94 | "ofType": { 95 | "kind": "LIST", 96 | "ofType": { 97 | "kind": "NON_NULL", 98 | "ofType": { 99 | "name": "__Type", 100 | "kind": "OBJECT" 101 | } 102 | } 103 | } 104 | } 105 | }, 106 | { 107 | "name": "queryType", 108 | "args": [], 109 | "description": "The type that query operations will be rooted at.", 110 | "isDeprecated": false, 111 | "type": { 112 | "kind": "NON_NULL", 113 | "ofType": { 114 | "name": "__Type", 115 | "kind": "OBJECT" 116 | } 117 | } 118 | }, 119 | { 120 | "name": "mutationType", 121 | "args": [], 122 | "description": "If this server supports mutation, the type that mutation operations will be rooted at.", 123 | "isDeprecated": false, 124 | "type": { 125 | "name": "__Type", 126 | "kind": "OBJECT" 127 | } 128 | }, 129 | { 130 | "name": "directives", 131 | "args": [], 132 | "description": "'A list of all directives supported by this server.", 133 | "isDeprecated": false, 134 | "type": { 135 | "kind": "NON_NULL", 136 | "ofType": { 137 | "kind": "LIST", 138 | "ofType": { 139 | "kind": "NON_NULL", 140 | "ofType": { 141 | "name": "__Directive", 142 | "kind": "OBJECT" 143 | } 144 | } 145 | } 146 | } 147 | }, 148 | { 149 | "name": "subscriptionType", 150 | "args": [], 151 | "description": "'If this server support subscription, the type that subscription operations will be rooted at.", 152 | "isDeprecated": false, 153 | "type": { 154 | "name": "__Type", 155 | "kind": "OBJECT" 156 | } 157 | } 158 | ], 159 | "kind": "OBJECT" 160 | }, 161 | { 162 | "name": "__Type", 163 | "interfaces": [], 164 | "fields": [ 165 | { 166 | "name": "kind", 167 | "args": [], 168 | "isDeprecated": false, 169 | "type": { 170 | "kind": "NON_NULL", 171 | "ofType": { 172 | "name": "__TypeKind", 173 | "kind": "ENUM" 174 | } 175 | } 176 | }, 177 | { 178 | "name": "name", 179 | "args": [], 180 | "isDeprecated": false, 181 | "type": { 182 | "name": "String", 183 | "kind": "SCALAR" 184 | } 185 | }, 186 | { 187 | "name": "description", 188 | "args": [], 189 | "isDeprecated": false, 190 | "type": { 191 | "name": "String", 192 | "kind": "SCALAR" 193 | } 194 | }, 195 | { 196 | "name": "fields", 197 | "args": [ 198 | { 199 | "name": "includeDeprecated", 200 | "type": { 201 | "name": "Boolean", 202 | "kind": "SCALAR" 203 | }, 204 | "defaultValue": "false" 205 | } 206 | ], 207 | "isDeprecated": false, 208 | "type": { 209 | "kind": "LIST", 210 | "ofType": { 211 | "kind": "NON_NULL", 212 | "ofType": { 213 | "name": "__Field", 214 | "kind": "OBJECT" 215 | } 216 | } 217 | } 218 | }, 219 | { 220 | "name": "interfaces", 221 | "args": [], 222 | "isDeprecated": false, 223 | "type": { 224 | "kind": "LIST", 225 | "ofType": { 226 | "kind": "NON_NULL", 227 | "ofType": { 228 | "name": "__Type", 229 | "kind": "OBJECT" 230 | } 231 | } 232 | } 233 | }, 234 | { 235 | "name": "possibleTypes", 236 | "args": [], 237 | "isDeprecated": false, 238 | "type": { 239 | "kind": "LIST", 240 | "ofType": { 241 | "kind": "NON_NULL", 242 | "ofType": { 243 | "name": "__Type", 244 | "kind": "OBJECT" 245 | } 246 | } 247 | } 248 | }, 249 | { 250 | "name": "enumValues", 251 | "args": [ 252 | { 253 | "name": "includeDeprecated", 254 | "type": { 255 | "name": "Boolean", 256 | "kind": "SCALAR" 257 | }, 258 | "defaultValue": "false" 259 | } 260 | ], 261 | "isDeprecated": false, 262 | "type": { 263 | "kind": "LIST", 264 | "ofType": { 265 | "kind": "NON_NULL", 266 | "ofType": { 267 | "name": "__EnumValue", 268 | "kind": "OBJECT" 269 | } 270 | } 271 | } 272 | }, 273 | { 274 | "name": "inputFields", 275 | "args": [], 276 | "isDeprecated": false, 277 | "type": { 278 | "kind": "LIST", 279 | "ofType": { 280 | "kind": "NON_NULL", 281 | "ofType": { 282 | "name": "__InputValue", 283 | "kind": "OBJECT" 284 | } 285 | } 286 | } 287 | }, 288 | { 289 | "name": "ofType", 290 | "args": [], 291 | "isDeprecated": false, 292 | "type": { 293 | "name": "__Type", 294 | "kind": "OBJECT" 295 | } 296 | } 297 | ], 298 | "kind": "OBJECT" 299 | }, 300 | { 301 | "name": "__TypeKind", 302 | "description": "An enum describing what kind of type a given __Type is", 303 | "kind": "ENUM", 304 | "enumValues": [ 305 | { 306 | "name": "SCALAR", 307 | "description": "Indicates this type is a scalar.", 308 | "isDeprecated": false 309 | }, 310 | { 311 | "name": "OBJECT", 312 | "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", 313 | "isDeprecated": false 314 | }, 315 | { 316 | "name": "INTERFACE", 317 | "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", 318 | "isDeprecated": false 319 | }, 320 | { 321 | "name": "UNION", 322 | "description": "Indicates this type is a union. `possibleTypes` is a valid field.", 323 | "isDeprecated": false 324 | }, 325 | { 326 | "name": "ENUM", 327 | "description": "Indicates this type is an enum. `enumValues` is a valid field.", 328 | "isDeprecated": false 329 | }, 330 | { 331 | "name": "INPUT_OBJECT", 332 | "description": "Indicates this type is an input object. `inputFields` is a valid field.", 333 | "isDeprecated": false 334 | }, 335 | { 336 | "name": "LIST", 337 | "description": "Indicates this type is a list. `ofType` is a valid field.", 338 | "isDeprecated": false 339 | }, 340 | { 341 | "name": "NON_NULL", 342 | "description": "Indicates this type is a non-null. `ofType` is a valid field.", 343 | "isDeprecated": false 344 | } 345 | ] 346 | }, 347 | { 348 | "name": "__Field", 349 | "interfaces": [], 350 | "fields": [ 351 | { 352 | "name": "name", 353 | "args": [], 354 | "isDeprecated": false, 355 | "type": { 356 | "kind": "NON_NULL", 357 | "ofType": { 358 | "name": "String", 359 | "kind": "SCALAR" 360 | } 361 | } 362 | }, 363 | { 364 | "name": "description", 365 | "args": [], 366 | "isDeprecated": false, 367 | "type": { 368 | "name": "String", 369 | "kind": "SCALAR" 370 | } 371 | }, 372 | { 373 | "name": "args", 374 | "args": [], 375 | "isDeprecated": false, 376 | "type": { 377 | "kind": "NON_NULL", 378 | "ofType": { 379 | "kind": "LIST", 380 | "ofType": { 381 | "kind": "NON_NULL", 382 | "ofType": { 383 | "name": "__InputValue", 384 | "kind": "OBJECT" 385 | } 386 | } 387 | } 388 | } 389 | }, 390 | { 391 | "name": "type", 392 | "args": [], 393 | "isDeprecated": false, 394 | "type": { 395 | "kind": "NON_NULL", 396 | "ofType": { 397 | "name": "__Type", 398 | "kind": "OBJECT" 399 | } 400 | } 401 | }, 402 | { 403 | "name": "isDeprecated", 404 | "args": [], 405 | "isDeprecated": false, 406 | "type": { 407 | "kind": "NON_NULL", 408 | "ofType": { 409 | "name": "Boolean", 410 | "kind": "SCALAR" 411 | } 412 | } 413 | }, 414 | { 415 | "name": "deprecationReason", 416 | "args": [], 417 | "isDeprecated": false, 418 | "type": { 419 | "name": "String", 420 | "kind": "SCALAR" 421 | } 422 | } 423 | ], 424 | "kind": "OBJECT" 425 | }, 426 | { 427 | "name": "__InputValue", 428 | "interfaces": [], 429 | "fields": [ 430 | { 431 | "name": "name", 432 | "args": [], 433 | "isDeprecated": false, 434 | "type": { 435 | "kind": "NON_NULL", 436 | "ofType": { 437 | "name": "String", 438 | "kind": "SCALAR" 439 | } 440 | } 441 | }, 442 | { 443 | "name": "description", 444 | "args": [], 445 | "isDeprecated": false, 446 | "type": { 447 | "name": "String", 448 | "kind": "SCALAR" 449 | } 450 | }, 451 | { 452 | "name": "type", 453 | "args": [], 454 | "isDeprecated": false, 455 | "type": { 456 | "kind": "NON_NULL", 457 | "ofType": { 458 | "name": "__Type", 459 | "kind": "OBJECT" 460 | } 461 | } 462 | }, 463 | { 464 | "name": "defaultValue", 465 | "args": [], 466 | "isDeprecated": false, 467 | "type": { 468 | "name": "String", 469 | "kind": "SCALAR" 470 | } 471 | } 472 | ], 473 | "kind": "OBJECT" 474 | }, 475 | { 476 | "name": "Boolean", 477 | "description": "Built-in Boolean", 478 | "kind": "SCALAR" 479 | }, 480 | { 481 | "name": "__EnumValue", 482 | "interfaces": [], 483 | "fields": [ 484 | { 485 | "name": "name", 486 | "args": [], 487 | "isDeprecated": false, 488 | "type": { 489 | "kind": "NON_NULL", 490 | "ofType": { 491 | "name": "String", 492 | "kind": "SCALAR" 493 | } 494 | } 495 | }, 496 | { 497 | "name": "description", 498 | "args": [], 499 | "isDeprecated": false, 500 | "type": { 501 | "name": "String", 502 | "kind": "SCALAR" 503 | } 504 | }, 505 | { 506 | "name": "isDeprecated", 507 | "args": [], 508 | "isDeprecated": false, 509 | "type": { 510 | "kind": "NON_NULL", 511 | "ofType": { 512 | "name": "Boolean", 513 | "kind": "SCALAR" 514 | } 515 | } 516 | }, 517 | { 518 | "name": "deprecationReason", 519 | "args": [], 520 | "isDeprecated": false, 521 | "type": { 522 | "name": "String", 523 | "kind": "SCALAR" 524 | } 525 | } 526 | ], 527 | "kind": "OBJECT" 528 | }, 529 | { 530 | "name": "__Directive", 531 | "interfaces": [], 532 | "fields": [ 533 | { 534 | "name": "name", 535 | "args": [], 536 | "isDeprecated": false, 537 | "type": { 538 | "name": "String", 539 | "kind": "SCALAR" 540 | } 541 | }, 542 | { 543 | "name": "description", 544 | "args": [], 545 | "isDeprecated": false, 546 | "type": { 547 | "name": "String", 548 | "kind": "SCALAR" 549 | } 550 | }, 551 | { 552 | "name": "locations", 553 | "args": [], 554 | "isDeprecated": false, 555 | "type": { 556 | "kind": "LIST", 557 | "ofType": { 558 | "kind": "NON_NULL", 559 | "ofType": { 560 | "name": "__DirectiveLocation", 561 | "kind": "ENUM" 562 | } 563 | } 564 | } 565 | }, 566 | { 567 | "name": "args", 568 | "args": [], 569 | "isDeprecated": false, 570 | "type": { 571 | "kind": "NON_NULL", 572 | "ofType": { 573 | "kind": "LIST", 574 | "ofType": { 575 | "kind": "NON_NULL", 576 | "ofType": { 577 | "name": "__InputValue", 578 | "kind": "OBJECT" 579 | } 580 | } 581 | } 582 | } 583 | }, 584 | { 585 | "name": "onOperation", 586 | "args": [], 587 | "deprecationReason": "Use `locations`.", 588 | "isDeprecated": true, 589 | "type": { 590 | "name": "Boolean", 591 | "kind": "SCALAR" 592 | } 593 | }, 594 | { 595 | "name": "onFragment", 596 | "args": [], 597 | "deprecationReason": "Use `locations`.", 598 | "isDeprecated": true, 599 | "type": { 600 | "name": "Boolean", 601 | "kind": "SCALAR" 602 | } 603 | }, 604 | { 605 | "name": "onField", 606 | "args": [], 607 | "deprecationReason": "Use `locations`.", 608 | "isDeprecated": true, 609 | "type": { 610 | "name": "Boolean", 611 | "kind": "SCALAR" 612 | } 613 | } 614 | ], 615 | "kind": "OBJECT" 616 | }, 617 | { 618 | "name": "__DirectiveLocation", 619 | "description": "An enum describing valid locations where a directive can be placed", 620 | "kind": "ENUM", 621 | "enumValues": [ 622 | { 623 | "name": "QUERY", 624 | "description": "Indicates the directive is valid on queries.", 625 | "isDeprecated": false 626 | }, 627 | { 628 | "name": "MUTATION", 629 | "description": "Indicates the directive is valid on mutations.", 630 | "isDeprecated": false 631 | }, 632 | { 633 | "name": "FIELD", 634 | "description": "Indicates the directive is valid on fields.", 635 | "isDeprecated": false 636 | }, 637 | { 638 | "name": "FRAGMENT_DEFINITION", 639 | "description": "Indicates the directive is valid on fragment definitions.", 640 | "isDeprecated": false 641 | }, 642 | { 643 | "name": "FRAGMENT_SPREAD", 644 | "description": "Indicates the directive is valid on fragment spreads.", 645 | "isDeprecated": false 646 | }, 647 | { 648 | "name": "INLINE_FRAGMENT", 649 | "description": "Indicates the directive is valid on inline fragments.", 650 | "isDeprecated": false 651 | }, 652 | { 653 | "name": "SCHEMA", 654 | "description": "Indicates the directive is valid on a schema SDL definition.", 655 | "isDeprecated": false 656 | }, 657 | { 658 | "name": "SCALAR", 659 | "description": "Indicates the directive is valid on a scalar SDL definition.", 660 | "isDeprecated": false 661 | }, 662 | { 663 | "name": "OBJECT", 664 | "description": "Indicates the directive is valid on an object SDL definition.", 665 | "isDeprecated": false 666 | }, 667 | { 668 | "name": "FIELD_DEFINITION", 669 | "description": "Indicates the directive is valid on a field SDL definition.", 670 | "isDeprecated": false 671 | }, 672 | { 673 | "name": "ARGUMENT_DEFINITION", 674 | "description": "Indicates the directive is valid on a field argument SDL definition.", 675 | "isDeprecated": false 676 | }, 677 | { 678 | "name": "INTERFACE", 679 | "description": "Indicates the directive is valid on an interface SDL definition.", 680 | "isDeprecated": false 681 | }, 682 | { 683 | "name": "UNION", 684 | "description": "Indicates the directive is valid on an union SDL definition.", 685 | "isDeprecated": false 686 | }, 687 | { 688 | "name": "ENUM", 689 | "description": "Indicates the directive is valid on an enum SDL definition.", 690 | "isDeprecated": false 691 | }, 692 | { 693 | "name": "ENUM_VALUE", 694 | "description": "Indicates the directive is valid on an enum value SDL definition.", 695 | "isDeprecated": false 696 | }, 697 | { 698 | "name": "INPUT_OBJECT", 699 | "description": "Indicates the directive is valid on an input object SDL definition.", 700 | "isDeprecated": false 701 | }, 702 | { 703 | "name": "INPUT_FIELD_DEFINITION", 704 | "description": "Indicates the directive is valid on an input object field SDL definition.", 705 | "isDeprecated": false 706 | } 707 | ] 708 | } 709 | ], 710 | "subscriptionType": { 711 | "name": "SubscriptionType" 712 | }, 713 | "directives": [ 714 | { 715 | "name": "include", 716 | "args": [ 717 | { 718 | "name": "if", 719 | "type": { 720 | "kind": "NON_NULL", 721 | "ofType": { 722 | "name": "Boolean", 723 | "kind": "SCALAR" 724 | } 725 | }, 726 | "description": "Included when true." 727 | } 728 | ], 729 | "description": "Directs the executor to include this field or fragment only when the `if` argument is true", 730 | "locations": [ 731 | "FIELD", 732 | "FRAGMENT_SPREAD", 733 | "INLINE_FRAGMENT" 734 | ] 735 | }, 736 | { 737 | "name": "skip", 738 | "args": [ 739 | { 740 | "name": "if", 741 | "type": { 742 | "kind": "NON_NULL", 743 | "ofType": { 744 | "name": "Boolean", 745 | "kind": "SCALAR" 746 | } 747 | }, 748 | "description": "Skipped when true." 749 | } 750 | ], 751 | "description": "Directs the executor to skip this field or fragment when the `if`'argument is true.", 752 | "locations": [ 753 | "FIELD", 754 | "FRAGMENT_SPREAD", 755 | "INLINE_FRAGMENT" 756 | ] 757 | }, 758 | { 759 | "name": "defer", 760 | "args": [], 761 | "description": "This directive allows results to be deferred during execution", 762 | "locations": [ 763 | "FIELD" 764 | ] 765 | }, 766 | { 767 | "name": "deprecated", 768 | "args": [ 769 | { 770 | "name": "reason", 771 | "type": { 772 | "name": "String", 773 | "kind": "SCALAR" 774 | }, 775 | "defaultValue": "\"No longer supported\"" 776 | } 777 | ], 778 | "locations": [ 779 | "FIELD_DEFINITION", 780 | "ENUM_VALUE" 781 | ] 782 | } 783 | ], 784 | "mutationType": { 785 | "name": "MutationType" 786 | }, 787 | "queryType": { 788 | "name": "QueryType" 789 | } 790 | } 791 | }, 792 | "errors": [], 793 | "dataPresent": true 794 | } 795 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/input-6.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "__schema": { 4 | "types": [ 5 | { 6 | "name": "Query", 7 | "interfaces": [], 8 | "fields": [ 9 | { 10 | "name": "customer", 11 | "args": [ 12 | { 13 | "name": "id", 14 | "type": { 15 | "name": "String", 16 | "kind": "SCALAR" 17 | } 18 | } 19 | ], 20 | "isDeprecated": false, 21 | "type": { 22 | "name": "Customer", 23 | "kind": "OBJECT" 24 | } 25 | } 26 | ], 27 | "kind": "OBJECT" 28 | }, 29 | { 30 | "name": "Customer", 31 | "description": " description of customer", 32 | "interfaces": [], 33 | "fields": [ 34 | { 35 | "name": "id", 36 | "args": [], 37 | "description": " unique id", 38 | "isDeprecated": false, 39 | "type": { 40 | "kind": "NON_NULL", 41 | "ofType": { 42 | "name": "ID", 43 | "kind": "SCALAR" 44 | } 45 | } 46 | }, 47 | { 48 | "name": "lastname", 49 | "args": [], 50 | "description": " lastname comment with 5 leading spaces", 51 | "isDeprecated": false, 52 | "type": { 53 | "name": "String", 54 | "kind": "SCALAR" 55 | } 56 | }, 57 | { 58 | "name": "name", 59 | "args": [], 60 | "description": "name comment without leading space", 61 | "isDeprecated": false, 62 | "type": { 63 | "name": "String", 64 | "kind": "SCALAR" 65 | } 66 | } 67 | ], 68 | "kind": "OBJECT" 69 | }, 70 | { 71 | "name": "ID", 72 | "description": "Built-in ID", 73 | "kind": "SCALAR" 74 | }, 75 | { 76 | "name": "String", 77 | "description": "Built-in String", 78 | "kind": "SCALAR" 79 | }, 80 | { 81 | "name": "__Schema", 82 | "description": "A GraphQL Introspection defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, the entry points for query, mutation, and subscription operations.", 83 | "interfaces": [], 84 | "fields": [ 85 | { 86 | "name": "types", 87 | "args": [], 88 | "description": "A list of all types supported by this server.", 89 | "isDeprecated": false, 90 | "type": { 91 | "kind": "NON_NULL", 92 | "ofType": { 93 | "kind": "LIST", 94 | "ofType": { 95 | "kind": "NON_NULL", 96 | "ofType": { 97 | "name": "__Type", 98 | "kind": "OBJECT" 99 | } 100 | } 101 | } 102 | } 103 | }, 104 | { 105 | "name": "queryType", 106 | "args": [], 107 | "description": "The type that query operations will be rooted at.", 108 | "isDeprecated": false, 109 | "type": { 110 | "kind": "NON_NULL", 111 | "ofType": { 112 | "name": "__Type", 113 | "kind": "OBJECT" 114 | } 115 | } 116 | }, 117 | { 118 | "name": "mutationType", 119 | "args": [], 120 | "description": "If this server supports mutation, the type that mutation operations will be rooted at.", 121 | "isDeprecated": false, 122 | "type": { 123 | "name": "__Type", 124 | "kind": "OBJECT" 125 | } 126 | }, 127 | { 128 | "name": "directives", 129 | "args": [], 130 | "description": "'A list of all directives supported by this server.", 131 | "isDeprecated": false, 132 | "type": { 133 | "kind": "NON_NULL", 134 | "ofType": { 135 | "kind": "LIST", 136 | "ofType": { 137 | "kind": "NON_NULL", 138 | "ofType": { 139 | "name": "__Directive", 140 | "kind": "OBJECT" 141 | } 142 | } 143 | } 144 | } 145 | }, 146 | { 147 | "name": "subscriptionType", 148 | "args": [], 149 | "description": "'If this server support subscription, the type that subscription operations will be rooted at.", 150 | "isDeprecated": false, 151 | "type": { 152 | "name": "__Type", 153 | "kind": "OBJECT" 154 | } 155 | } 156 | ], 157 | "kind": "OBJECT" 158 | }, 159 | { 160 | "name": "__Type", 161 | "interfaces": [], 162 | "fields": [ 163 | { 164 | "name": "kind", 165 | "args": [], 166 | "isDeprecated": false, 167 | "type": { 168 | "kind": "NON_NULL", 169 | "ofType": { 170 | "name": "__TypeKind", 171 | "kind": "ENUM" 172 | } 173 | } 174 | }, 175 | { 176 | "name": "name", 177 | "args": [], 178 | "isDeprecated": false, 179 | "type": { 180 | "name": "String", 181 | "kind": "SCALAR" 182 | } 183 | }, 184 | { 185 | "name": "description", 186 | "args": [], 187 | "isDeprecated": false, 188 | "type": { 189 | "name": "String", 190 | "kind": "SCALAR" 191 | } 192 | }, 193 | { 194 | "name": "fields", 195 | "args": [ 196 | { 197 | "name": "includeDeprecated", 198 | "type": { 199 | "name": "Boolean", 200 | "kind": "SCALAR" 201 | }, 202 | "defaultValue": "false" 203 | } 204 | ], 205 | "isDeprecated": false, 206 | "type": { 207 | "kind": "LIST", 208 | "ofType": { 209 | "kind": "NON_NULL", 210 | "ofType": { 211 | "name": "__Field", 212 | "kind": "OBJECT" 213 | } 214 | } 215 | } 216 | }, 217 | { 218 | "name": "interfaces", 219 | "args": [], 220 | "isDeprecated": false, 221 | "type": { 222 | "kind": "LIST", 223 | "ofType": { 224 | "kind": "NON_NULL", 225 | "ofType": { 226 | "name": "__Type", 227 | "kind": "OBJECT" 228 | } 229 | } 230 | } 231 | }, 232 | { 233 | "name": "possibleTypes", 234 | "args": [], 235 | "isDeprecated": false, 236 | "type": { 237 | "kind": "LIST", 238 | "ofType": { 239 | "kind": "NON_NULL", 240 | "ofType": { 241 | "name": "__Type", 242 | "kind": "OBJECT" 243 | } 244 | } 245 | } 246 | }, 247 | { 248 | "name": "enumValues", 249 | "args": [ 250 | { 251 | "name": "includeDeprecated", 252 | "type": { 253 | "name": "Boolean", 254 | "kind": "SCALAR" 255 | }, 256 | "defaultValue": "false" 257 | } 258 | ], 259 | "isDeprecated": false, 260 | "type": { 261 | "kind": "LIST", 262 | "ofType": { 263 | "kind": "NON_NULL", 264 | "ofType": { 265 | "name": "__EnumValue", 266 | "kind": "OBJECT" 267 | } 268 | } 269 | } 270 | }, 271 | { 272 | "name": "inputFields", 273 | "args": [], 274 | "isDeprecated": false, 275 | "type": { 276 | "kind": "LIST", 277 | "ofType": { 278 | "kind": "NON_NULL", 279 | "ofType": { 280 | "name": "__InputValue", 281 | "kind": "OBJECT" 282 | } 283 | } 284 | } 285 | }, 286 | { 287 | "name": "ofType", 288 | "args": [], 289 | "isDeprecated": false, 290 | "type": { 291 | "name": "__Type", 292 | "kind": "OBJECT" 293 | } 294 | } 295 | ], 296 | "kind": "OBJECT" 297 | }, 298 | { 299 | "name": "__TypeKind", 300 | "description": "An enum describing what kind of type a given __Type is", 301 | "kind": "ENUM", 302 | "enumValues": [ 303 | { 304 | "name": "SCALAR", 305 | "description": "Indicates this type is a scalar.", 306 | "isDeprecated": false 307 | }, 308 | { 309 | "name": "OBJECT", 310 | "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", 311 | "isDeprecated": false 312 | }, 313 | { 314 | "name": "INTERFACE", 315 | "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", 316 | "isDeprecated": false 317 | }, 318 | { 319 | "name": "UNION", 320 | "description": "Indicates this type is a union. `possibleTypes` is a valid field.", 321 | "isDeprecated": false 322 | }, 323 | { 324 | "name": "ENUM", 325 | "description": "Indicates this type is an enum. `enumValues` is a valid field.", 326 | "isDeprecated": false 327 | }, 328 | { 329 | "name": "INPUT_OBJECT", 330 | "description": "Indicates this type is an input object. `inputFields` is a valid field.", 331 | "isDeprecated": false 332 | }, 333 | { 334 | "name": "LIST", 335 | "description": "Indicates this type is a list. `ofType` is a valid field.", 336 | "isDeprecated": false 337 | }, 338 | { 339 | "name": "NON_NULL", 340 | "description": "Indicates this type is a non-null. `ofType` is a valid field.", 341 | "isDeprecated": false 342 | } 343 | ] 344 | }, 345 | { 346 | "name": "__Field", 347 | "interfaces": [], 348 | "fields": [ 349 | { 350 | "name": "name", 351 | "args": [], 352 | "isDeprecated": false, 353 | "type": { 354 | "kind": "NON_NULL", 355 | "ofType": { 356 | "name": "String", 357 | "kind": "SCALAR" 358 | } 359 | } 360 | }, 361 | { 362 | "name": "description", 363 | "args": [], 364 | "isDeprecated": false, 365 | "type": { 366 | "name": "String", 367 | "kind": "SCALAR" 368 | } 369 | }, 370 | { 371 | "name": "args", 372 | "args": [], 373 | "isDeprecated": false, 374 | "type": { 375 | "kind": "NON_NULL", 376 | "ofType": { 377 | "kind": "LIST", 378 | "ofType": { 379 | "kind": "NON_NULL", 380 | "ofType": { 381 | "name": "__InputValue", 382 | "kind": "OBJECT" 383 | } 384 | } 385 | } 386 | } 387 | }, 388 | { 389 | "name": "type", 390 | "args": [], 391 | "isDeprecated": false, 392 | "type": { 393 | "kind": "NON_NULL", 394 | "ofType": { 395 | "name": "__Type", 396 | "kind": "OBJECT" 397 | } 398 | } 399 | }, 400 | { 401 | "name": "isDeprecated", 402 | "args": [], 403 | "isDeprecated": false, 404 | "type": { 405 | "kind": "NON_NULL", 406 | "ofType": { 407 | "name": "Boolean", 408 | "kind": "SCALAR" 409 | } 410 | } 411 | }, 412 | { 413 | "name": "deprecationReason", 414 | "args": [], 415 | "isDeprecated": false, 416 | "type": { 417 | "name": "String", 418 | "kind": "SCALAR" 419 | } 420 | } 421 | ], 422 | "kind": "OBJECT" 423 | }, 424 | { 425 | "name": "__InputValue", 426 | "interfaces": [], 427 | "fields": [ 428 | { 429 | "name": "name", 430 | "args": [], 431 | "isDeprecated": false, 432 | "type": { 433 | "kind": "NON_NULL", 434 | "ofType": { 435 | "name": "String", 436 | "kind": "SCALAR" 437 | } 438 | } 439 | }, 440 | { 441 | "name": "description", 442 | "args": [], 443 | "isDeprecated": false, 444 | "type": { 445 | "name": "String", 446 | "kind": "SCALAR" 447 | } 448 | }, 449 | { 450 | "name": "type", 451 | "args": [], 452 | "isDeprecated": false, 453 | "type": { 454 | "kind": "NON_NULL", 455 | "ofType": { 456 | "name": "__Type", 457 | "kind": "OBJECT" 458 | } 459 | } 460 | }, 461 | { 462 | "name": "defaultValue", 463 | "args": [], 464 | "isDeprecated": false, 465 | "type": { 466 | "name": "String", 467 | "kind": "SCALAR" 468 | } 469 | } 470 | ], 471 | "kind": "OBJECT" 472 | }, 473 | { 474 | "name": "Boolean", 475 | "description": "Built-in Boolean", 476 | "kind": "SCALAR" 477 | }, 478 | { 479 | "name": "__EnumValue", 480 | "interfaces": [], 481 | "fields": [ 482 | { 483 | "name": "name", 484 | "args": [], 485 | "isDeprecated": false, 486 | "type": { 487 | "kind": "NON_NULL", 488 | "ofType": { 489 | "name": "String", 490 | "kind": "SCALAR" 491 | } 492 | } 493 | }, 494 | { 495 | "name": "description", 496 | "args": [], 497 | "isDeprecated": false, 498 | "type": { 499 | "name": "String", 500 | "kind": "SCALAR" 501 | } 502 | }, 503 | { 504 | "name": "isDeprecated", 505 | "args": [], 506 | "isDeprecated": false, 507 | "type": { 508 | "kind": "NON_NULL", 509 | "ofType": { 510 | "name": "Boolean", 511 | "kind": "SCALAR" 512 | } 513 | } 514 | }, 515 | { 516 | "name": "deprecationReason", 517 | "args": [], 518 | "isDeprecated": false, 519 | "type": { 520 | "name": "String", 521 | "kind": "SCALAR" 522 | } 523 | } 524 | ], 525 | "kind": "OBJECT" 526 | }, 527 | { 528 | "name": "__Directive", 529 | "interfaces": [], 530 | "fields": [ 531 | { 532 | "name": "name", 533 | "args": [], 534 | "isDeprecated": false, 535 | "type": { 536 | "name": "String", 537 | "kind": "SCALAR" 538 | } 539 | }, 540 | { 541 | "name": "description", 542 | "args": [], 543 | "isDeprecated": false, 544 | "type": { 545 | "name": "String", 546 | "kind": "SCALAR" 547 | } 548 | }, 549 | { 550 | "name": "locations", 551 | "args": [], 552 | "isDeprecated": false, 553 | "type": { 554 | "kind": "LIST", 555 | "ofType": { 556 | "kind": "NON_NULL", 557 | "ofType": { 558 | "name": "__DirectiveLocation", 559 | "kind": "ENUM" 560 | } 561 | } 562 | } 563 | }, 564 | { 565 | "name": "args", 566 | "args": [], 567 | "isDeprecated": false, 568 | "type": { 569 | "kind": "NON_NULL", 570 | "ofType": { 571 | "kind": "LIST", 572 | "ofType": { 573 | "kind": "NON_NULL", 574 | "ofType": { 575 | "name": "__InputValue", 576 | "kind": "OBJECT" 577 | } 578 | } 579 | } 580 | } 581 | }, 582 | { 583 | "name": "onOperation", 584 | "args": [], 585 | "deprecationReason": "Use `locations`.", 586 | "isDeprecated": true, 587 | "type": { 588 | "name": "Boolean", 589 | "kind": "SCALAR" 590 | } 591 | }, 592 | { 593 | "name": "onFragment", 594 | "args": [], 595 | "deprecationReason": "Use `locations`.", 596 | "isDeprecated": true, 597 | "type": { 598 | "name": "Boolean", 599 | "kind": "SCALAR" 600 | } 601 | }, 602 | { 603 | "name": "onField", 604 | "args": [], 605 | "deprecationReason": "Use `locations`.", 606 | "isDeprecated": true, 607 | "type": { 608 | "name": "Boolean", 609 | "kind": "SCALAR" 610 | } 611 | } 612 | ], 613 | "kind": "OBJECT" 614 | }, 615 | { 616 | "name": "__DirectiveLocation", 617 | "description": "An enum describing valid locations where a directive can be placed", 618 | "kind": "ENUM", 619 | "enumValues": [ 620 | { 621 | "name": "QUERY", 622 | "description": "Indicates the directive is valid on queries.", 623 | "isDeprecated": false 624 | }, 625 | { 626 | "name": "MUTATION", 627 | "description": "Indicates the directive is valid on mutations.", 628 | "isDeprecated": false 629 | }, 630 | { 631 | "name": "FIELD", 632 | "description": "Indicates the directive is valid on fields.", 633 | "isDeprecated": false 634 | }, 635 | { 636 | "name": "FRAGMENT_DEFINITION", 637 | "description": "Indicates the directive is valid on fragment definitions.", 638 | "isDeprecated": false 639 | }, 640 | { 641 | "name": "FRAGMENT_SPREAD", 642 | "description": "Indicates the directive is valid on fragment spreads.", 643 | "isDeprecated": false 644 | }, 645 | { 646 | "name": "INLINE_FRAGMENT", 647 | "description": "Indicates the directive is valid on inline fragments.", 648 | "isDeprecated": false 649 | }, 650 | { 651 | "name": "SCHEMA", 652 | "description": "Indicates the directive is valid on a schema SDL definition.", 653 | "isDeprecated": false 654 | }, 655 | { 656 | "name": "SCALAR", 657 | "description": "Indicates the directive is valid on a scalar SDL definition.", 658 | "isDeprecated": false 659 | }, 660 | { 661 | "name": "OBJECT", 662 | "description": "Indicates the directive is valid on an object SDL definition.", 663 | "isDeprecated": false 664 | }, 665 | { 666 | "name": "FIELD_DEFINITION", 667 | "description": "Indicates the directive is valid on a field SDL definition.", 668 | "isDeprecated": false 669 | }, 670 | { 671 | "name": "ARGUMENT_DEFINITION", 672 | "description": "Indicates the directive is valid on a field argument SDL definition.", 673 | "isDeprecated": false 674 | }, 675 | { 676 | "name": "INTERFACE", 677 | "description": "Indicates the directive is valid on an interface SDL definition.", 678 | "isDeprecated": false 679 | }, 680 | { 681 | "name": "UNION", 682 | "description": "Indicates the directive is valid on an union SDL definition.", 683 | "isDeprecated": false 684 | }, 685 | { 686 | "name": "ENUM", 687 | "description": "Indicates the directive is valid on an enum SDL definition.", 688 | "isDeprecated": false 689 | }, 690 | { 691 | "name": "ENUM_VALUE", 692 | "description": "Indicates the directive is valid on an enum value SDL definition.", 693 | "isDeprecated": false 694 | }, 695 | { 696 | "name": "INPUT_OBJECT", 697 | "description": "Indicates the directive is valid on an input object SDL definition.", 698 | "isDeprecated": false 699 | }, 700 | { 701 | "name": "INPUT_FIELD_DEFINITION", 702 | "description": "Indicates the directive is valid on an input object field SDL definition.", 703 | "isDeprecated": false 704 | } 705 | ] 706 | } 707 | ], 708 | "directives": [ 709 | { 710 | "name": "include", 711 | "args": [ 712 | { 713 | "name": "if", 714 | "type": { 715 | "kind": "NON_NULL", 716 | "ofType": { 717 | "name": "Boolean", 718 | "kind": "SCALAR" 719 | } 720 | }, 721 | "description": "Included when true." 722 | } 723 | ], 724 | "description": "Directs the executor to include this field or fragment only when the `if` argument is true", 725 | "locations": [ 726 | "FIELD", 727 | "FRAGMENT_SPREAD", 728 | "INLINE_FRAGMENT" 729 | ] 730 | }, 731 | { 732 | "name": "skip", 733 | "args": [ 734 | { 735 | "name": "if", 736 | "type": { 737 | "kind": "NON_NULL", 738 | "ofType": { 739 | "name": "Boolean", 740 | "kind": "SCALAR" 741 | } 742 | }, 743 | "description": "Skipped when true." 744 | } 745 | ], 746 | "description": "Directs the executor to skip this field or fragment when the `if`'argument is true.", 747 | "locations": [ 748 | "FIELD", 749 | "FRAGMENT_SPREAD", 750 | "INLINE_FRAGMENT" 751 | ] 752 | }, 753 | { 754 | "name": "defer", 755 | "args": [], 756 | "description": "This directive allows results to be deferred during execution", 757 | "locations": [ 758 | "FIELD" 759 | ] 760 | }, 761 | { 762 | "name": "deprecated", 763 | "args": [ 764 | { 765 | "name": "reason", 766 | "type": { 767 | "name": "String", 768 | "kind": "SCALAR" 769 | }, 770 | "defaultValue": "\"No longer supported\"" 771 | } 772 | ], 773 | "locations": [ 774 | "FIELD_DEFINITION", 775 | "ENUM_VALUE" 776 | ] 777 | } 778 | ], 779 | "queryType": { 780 | "name": "Query" 781 | } 782 | } 783 | }, 784 | "errors": [], 785 | "dataPresent": true 786 | } 787 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/input-8.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "__schema": { 4 | "types": [ 5 | { 6 | "name": "Query", 7 | "interfaces": [], 8 | "fields": [ 9 | { 10 | "name": "customer", 11 | "args": [ 12 | { 13 | "name": "id", 14 | "type": { 15 | "kind": "NON_NULL", 16 | "ofType": { 17 | "name": "String", 18 | "kind": "SCALAR" 19 | } 20 | } 21 | } 22 | ], 23 | "isDeprecated": false, 24 | "type": { 25 | "kind": "NON_NULL", 26 | "ofType": { 27 | "name": "Customer", 28 | "kind": "OBJECT" 29 | } 30 | } 31 | } 32 | ], 33 | "kind": "OBJECT" 34 | }, 35 | { 36 | "name": "Customer", 37 | "description": "comment with one space at end ", 38 | "interfaces": [], 39 | "fields": [ 40 | { 41 | "name": "id", 42 | "args": [], 43 | "description": "comment with 3 spaces at end ", 44 | "isDeprecated": false, 45 | "type": { 46 | "kind": "NON_NULL", 47 | "ofType": { 48 | "name": "ID", 49 | "kind": "SCALAR" 50 | } 51 | } 52 | }, 53 | { 54 | "name": "name", 55 | "args": [], 56 | "isDeprecated": false, 57 | "type": { 58 | "name": "String", 59 | "kind": "SCALAR" 60 | } 61 | } 62 | ], 63 | "kind": "OBJECT" 64 | }, 65 | { 66 | "name": "ID", 67 | "description": "Built-in ID", 68 | "kind": "SCALAR" 69 | }, 70 | { 71 | "name": "String", 72 | "description": "Built-in String", 73 | "kind": "SCALAR" 74 | }, 75 | { 76 | "name": "__Schema", 77 | "description": "A GraphQL Introspection defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, the entry points for query, mutation, and subscription operations.", 78 | "interfaces": [], 79 | "fields": [ 80 | { 81 | "name": "types", 82 | "args": [], 83 | "description": "A list of all types supported by this server.", 84 | "isDeprecated": false, 85 | "type": { 86 | "kind": "NON_NULL", 87 | "ofType": { 88 | "kind": "LIST", 89 | "ofType": { 90 | "kind": "NON_NULL", 91 | "ofType": { 92 | "name": "__Type", 93 | "kind": "OBJECT" 94 | } 95 | } 96 | } 97 | } 98 | }, 99 | { 100 | "name": "queryType", 101 | "args": [], 102 | "description": "The type that query operations will be rooted at.", 103 | "isDeprecated": false, 104 | "type": { 105 | "kind": "NON_NULL", 106 | "ofType": { 107 | "name": "__Type", 108 | "kind": "OBJECT" 109 | } 110 | } 111 | }, 112 | { 113 | "name": "mutationType", 114 | "args": [], 115 | "description": "If this server supports mutation, the type that mutation operations will be rooted at.", 116 | "isDeprecated": false, 117 | "type": { 118 | "name": "__Type", 119 | "kind": "OBJECT" 120 | } 121 | }, 122 | { 123 | "name": "directives", 124 | "args": [], 125 | "description": "'A list of all directives supported by this server.", 126 | "isDeprecated": false, 127 | "type": { 128 | "kind": "NON_NULL", 129 | "ofType": { 130 | "kind": "LIST", 131 | "ofType": { 132 | "kind": "NON_NULL", 133 | "ofType": { 134 | "name": "__Directive", 135 | "kind": "OBJECT" 136 | } 137 | } 138 | } 139 | } 140 | }, 141 | { 142 | "name": "subscriptionType", 143 | "args": [], 144 | "description": "'If this server support subscription, the type that subscription operations will be rooted at.", 145 | "isDeprecated": false, 146 | "type": { 147 | "name": "__Type", 148 | "kind": "OBJECT" 149 | } 150 | } 151 | ], 152 | "kind": "OBJECT" 153 | }, 154 | { 155 | "name": "__Type", 156 | "interfaces": [], 157 | "fields": [ 158 | { 159 | "name": "kind", 160 | "args": [], 161 | "isDeprecated": false, 162 | "type": { 163 | "kind": "NON_NULL", 164 | "ofType": { 165 | "name": "__TypeKind", 166 | "kind": "ENUM" 167 | } 168 | } 169 | }, 170 | { 171 | "name": "name", 172 | "args": [], 173 | "isDeprecated": false, 174 | "type": { 175 | "name": "String", 176 | "kind": "SCALAR" 177 | } 178 | }, 179 | { 180 | "name": "description", 181 | "args": [], 182 | "isDeprecated": false, 183 | "type": { 184 | "name": "String", 185 | "kind": "SCALAR" 186 | } 187 | }, 188 | { 189 | "name": "fields", 190 | "args": [ 191 | { 192 | "name": "includeDeprecated", 193 | "type": { 194 | "name": "Boolean", 195 | "kind": "SCALAR" 196 | }, 197 | "defaultValue": "false" 198 | } 199 | ], 200 | "isDeprecated": false, 201 | "type": { 202 | "kind": "LIST", 203 | "ofType": { 204 | "kind": "NON_NULL", 205 | "ofType": { 206 | "name": "__Field", 207 | "kind": "OBJECT" 208 | } 209 | } 210 | } 211 | }, 212 | { 213 | "name": "interfaces", 214 | "args": [], 215 | "isDeprecated": false, 216 | "type": { 217 | "kind": "LIST", 218 | "ofType": { 219 | "kind": "NON_NULL", 220 | "ofType": { 221 | "name": "__Type", 222 | "kind": "OBJECT" 223 | } 224 | } 225 | } 226 | }, 227 | { 228 | "name": "possibleTypes", 229 | "args": [], 230 | "isDeprecated": false, 231 | "type": { 232 | "kind": "LIST", 233 | "ofType": { 234 | "kind": "NON_NULL", 235 | "ofType": { 236 | "name": "__Type", 237 | "kind": "OBJECT" 238 | } 239 | } 240 | } 241 | }, 242 | { 243 | "name": "enumValues", 244 | "args": [ 245 | { 246 | "name": "includeDeprecated", 247 | "type": { 248 | "name": "Boolean", 249 | "kind": "SCALAR" 250 | }, 251 | "defaultValue": "false" 252 | } 253 | ], 254 | "isDeprecated": false, 255 | "type": { 256 | "kind": "LIST", 257 | "ofType": { 258 | "kind": "NON_NULL", 259 | "ofType": { 260 | "name": "__EnumValue", 261 | "kind": "OBJECT" 262 | } 263 | } 264 | } 265 | }, 266 | { 267 | "name": "inputFields", 268 | "args": [], 269 | "isDeprecated": false, 270 | "type": { 271 | "kind": "LIST", 272 | "ofType": { 273 | "kind": "NON_NULL", 274 | "ofType": { 275 | "name": "__InputValue", 276 | "kind": "OBJECT" 277 | } 278 | } 279 | } 280 | }, 281 | { 282 | "name": "ofType", 283 | "args": [], 284 | "isDeprecated": false, 285 | "type": { 286 | "name": "__Type", 287 | "kind": "OBJECT" 288 | } 289 | } 290 | ], 291 | "kind": "OBJECT" 292 | }, 293 | { 294 | "name": "__TypeKind", 295 | "description": "An enum describing what kind of type a given __Type is", 296 | "kind": "ENUM", 297 | "enumValues": [ 298 | { 299 | "name": "SCALAR", 300 | "description": "Indicates this type is a scalar.", 301 | "isDeprecated": false 302 | }, 303 | { 304 | "name": "OBJECT", 305 | "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", 306 | "isDeprecated": false 307 | }, 308 | { 309 | "name": "INTERFACE", 310 | "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", 311 | "isDeprecated": false 312 | }, 313 | { 314 | "name": "UNION", 315 | "description": "Indicates this type is a union. `possibleTypes` is a valid field.", 316 | "isDeprecated": false 317 | }, 318 | { 319 | "name": "ENUM", 320 | "description": "Indicates this type is an enum. `enumValues` is a valid field.", 321 | "isDeprecated": false 322 | }, 323 | { 324 | "name": "INPUT_OBJECT", 325 | "description": "Indicates this type is an input object. `inputFields` is a valid field.", 326 | "isDeprecated": false 327 | }, 328 | { 329 | "name": "LIST", 330 | "description": "Indicates this type is a list. `ofType` is a valid field.", 331 | "isDeprecated": false 332 | }, 333 | { 334 | "name": "NON_NULL", 335 | "description": "Indicates this type is a non-null. `ofType` is a valid field.", 336 | "isDeprecated": false 337 | } 338 | ] 339 | }, 340 | { 341 | "name": "__Field", 342 | "interfaces": [], 343 | "fields": [ 344 | { 345 | "name": "name", 346 | "args": [], 347 | "isDeprecated": false, 348 | "type": { 349 | "kind": "NON_NULL", 350 | "ofType": { 351 | "name": "String", 352 | "kind": "SCALAR" 353 | } 354 | } 355 | }, 356 | { 357 | "name": "description", 358 | "args": [], 359 | "isDeprecated": false, 360 | "type": { 361 | "name": "String", 362 | "kind": "SCALAR" 363 | } 364 | }, 365 | { 366 | "name": "args", 367 | "args": [], 368 | "isDeprecated": false, 369 | "type": { 370 | "kind": "NON_NULL", 371 | "ofType": { 372 | "kind": "LIST", 373 | "ofType": { 374 | "kind": "NON_NULL", 375 | "ofType": { 376 | "name": "__InputValue", 377 | "kind": "OBJECT" 378 | } 379 | } 380 | } 381 | } 382 | }, 383 | { 384 | "name": "type", 385 | "args": [], 386 | "isDeprecated": false, 387 | "type": { 388 | "kind": "NON_NULL", 389 | "ofType": { 390 | "name": "__Type", 391 | "kind": "OBJECT" 392 | } 393 | } 394 | }, 395 | { 396 | "name": "isDeprecated", 397 | "args": [], 398 | "isDeprecated": false, 399 | "type": { 400 | "kind": "NON_NULL", 401 | "ofType": { 402 | "name": "Boolean", 403 | "kind": "SCALAR" 404 | } 405 | } 406 | }, 407 | { 408 | "name": "deprecationReason", 409 | "args": [], 410 | "isDeprecated": false, 411 | "type": { 412 | "name": "String", 413 | "kind": "SCALAR" 414 | } 415 | } 416 | ], 417 | "kind": "OBJECT" 418 | }, 419 | { 420 | "name": "__InputValue", 421 | "interfaces": [], 422 | "fields": [ 423 | { 424 | "name": "name", 425 | "args": [], 426 | "isDeprecated": false, 427 | "type": { 428 | "kind": "NON_NULL", 429 | "ofType": { 430 | "name": "String", 431 | "kind": "SCALAR" 432 | } 433 | } 434 | }, 435 | { 436 | "name": "description", 437 | "args": [], 438 | "isDeprecated": false, 439 | "type": { 440 | "name": "String", 441 | "kind": "SCALAR" 442 | } 443 | }, 444 | { 445 | "name": "type", 446 | "args": [], 447 | "isDeprecated": false, 448 | "type": { 449 | "kind": "NON_NULL", 450 | "ofType": { 451 | "name": "__Type", 452 | "kind": "OBJECT" 453 | } 454 | } 455 | }, 456 | { 457 | "name": "defaultValue", 458 | "args": [], 459 | "isDeprecated": false, 460 | "type": { 461 | "name": "String", 462 | "kind": "SCALAR" 463 | } 464 | } 465 | ], 466 | "kind": "OBJECT" 467 | }, 468 | { 469 | "name": "Boolean", 470 | "description": "Built-in Boolean", 471 | "kind": "SCALAR" 472 | }, 473 | { 474 | "name": "__EnumValue", 475 | "interfaces": [], 476 | "fields": [ 477 | { 478 | "name": "name", 479 | "args": [], 480 | "isDeprecated": false, 481 | "type": { 482 | "kind": "NON_NULL", 483 | "ofType": { 484 | "name": "String", 485 | "kind": "SCALAR" 486 | } 487 | } 488 | }, 489 | { 490 | "name": "description", 491 | "args": [], 492 | "isDeprecated": false, 493 | "type": { 494 | "name": "String", 495 | "kind": "SCALAR" 496 | } 497 | }, 498 | { 499 | "name": "isDeprecated", 500 | "args": [], 501 | "isDeprecated": false, 502 | "type": { 503 | "kind": "NON_NULL", 504 | "ofType": { 505 | "name": "Boolean", 506 | "kind": "SCALAR" 507 | } 508 | } 509 | }, 510 | { 511 | "name": "deprecationReason", 512 | "args": [], 513 | "isDeprecated": false, 514 | "type": { 515 | "name": "String", 516 | "kind": "SCALAR" 517 | } 518 | } 519 | ], 520 | "kind": "OBJECT" 521 | }, 522 | { 523 | "name": "__Directive", 524 | "interfaces": [], 525 | "fields": [ 526 | { 527 | "name": "name", 528 | "args": [], 529 | "isDeprecated": false, 530 | "type": { 531 | "name": "String", 532 | "kind": "SCALAR" 533 | } 534 | }, 535 | { 536 | "name": "description", 537 | "args": [], 538 | "isDeprecated": false, 539 | "type": { 540 | "name": "String", 541 | "kind": "SCALAR" 542 | } 543 | }, 544 | { 545 | "name": "locations", 546 | "args": [], 547 | "isDeprecated": false, 548 | "type": { 549 | "kind": "LIST", 550 | "ofType": { 551 | "kind": "NON_NULL", 552 | "ofType": { 553 | "name": "__DirectiveLocation", 554 | "kind": "ENUM" 555 | } 556 | } 557 | } 558 | }, 559 | { 560 | "name": "args", 561 | "args": [], 562 | "isDeprecated": false, 563 | "type": { 564 | "kind": "NON_NULL", 565 | "ofType": { 566 | "kind": "LIST", 567 | "ofType": { 568 | "kind": "NON_NULL", 569 | "ofType": { 570 | "name": "__InputValue", 571 | "kind": "OBJECT" 572 | } 573 | } 574 | } 575 | } 576 | }, 577 | { 578 | "name": "onOperation", 579 | "args": [], 580 | "deprecationReason": "Use `locations`.", 581 | "isDeprecated": true, 582 | "type": { 583 | "name": "Boolean", 584 | "kind": "SCALAR" 585 | } 586 | }, 587 | { 588 | "name": "onFragment", 589 | "args": [], 590 | "deprecationReason": "Use `locations`.", 591 | "isDeprecated": true, 592 | "type": { 593 | "name": "Boolean", 594 | "kind": "SCALAR" 595 | } 596 | }, 597 | { 598 | "name": "onField", 599 | "args": [], 600 | "deprecationReason": "Use `locations`.", 601 | "isDeprecated": true, 602 | "type": { 603 | "name": "Boolean", 604 | "kind": "SCALAR" 605 | } 606 | } 607 | ], 608 | "kind": "OBJECT" 609 | }, 610 | { 611 | "name": "__DirectiveLocation", 612 | "description": "An enum describing valid locations where a directive can be placed", 613 | "kind": "ENUM", 614 | "enumValues": [ 615 | { 616 | "name": "QUERY", 617 | "description": "Indicates the directive is valid on queries.", 618 | "isDeprecated": false 619 | }, 620 | { 621 | "name": "MUTATION", 622 | "description": "Indicates the directive is valid on mutations.", 623 | "isDeprecated": false 624 | }, 625 | { 626 | "name": "FIELD", 627 | "description": "Indicates the directive is valid on fields.", 628 | "isDeprecated": false 629 | }, 630 | { 631 | "name": "FRAGMENT_DEFINITION", 632 | "description": "Indicates the directive is valid on fragment definitions.", 633 | "isDeprecated": false 634 | }, 635 | { 636 | "name": "FRAGMENT_SPREAD", 637 | "description": "Indicates the directive is valid on fragment spreads.", 638 | "isDeprecated": false 639 | }, 640 | { 641 | "name": "INLINE_FRAGMENT", 642 | "description": "Indicates the directive is valid on inline fragments.", 643 | "isDeprecated": false 644 | }, 645 | { 646 | "name": "SCHEMA", 647 | "description": "Indicates the directive is valid on a schema SDL definition.", 648 | "isDeprecated": false 649 | }, 650 | { 651 | "name": "SCALAR", 652 | "description": "Indicates the directive is valid on a scalar SDL definition.", 653 | "isDeprecated": false 654 | }, 655 | { 656 | "name": "OBJECT", 657 | "description": "Indicates the directive is valid on an object SDL definition.", 658 | "isDeprecated": false 659 | }, 660 | { 661 | "name": "FIELD_DEFINITION", 662 | "description": "Indicates the directive is valid on a field SDL definition.", 663 | "isDeprecated": false 664 | }, 665 | { 666 | "name": "ARGUMENT_DEFINITION", 667 | "description": "Indicates the directive is valid on a field argument SDL definition.", 668 | "isDeprecated": false 669 | }, 670 | { 671 | "name": "INTERFACE", 672 | "description": "Indicates the directive is valid on an interface SDL definition.", 673 | "isDeprecated": false 674 | }, 675 | { 676 | "name": "UNION", 677 | "description": "Indicates the directive is valid on an union SDL definition.", 678 | "isDeprecated": false 679 | }, 680 | { 681 | "name": "ENUM", 682 | "description": "Indicates the directive is valid on an enum SDL definition.", 683 | "isDeprecated": false 684 | }, 685 | { 686 | "name": "ENUM_VALUE", 687 | "description": "Indicates the directive is valid on an enum value SDL definition.", 688 | "isDeprecated": false 689 | }, 690 | { 691 | "name": "INPUT_OBJECT", 692 | "description": "Indicates the directive is valid on an input object SDL definition.", 693 | "isDeprecated": false 694 | }, 695 | { 696 | "name": "INPUT_FIELD_DEFINITION", 697 | "description": "Indicates the directive is valid on an input object field SDL definition.", 698 | "isDeprecated": false 699 | } 700 | ] 701 | } 702 | ], 703 | "directives": [ 704 | { 705 | "name": "include", 706 | "args": [ 707 | { 708 | "name": "if", 709 | "type": { 710 | "kind": "NON_NULL", 711 | "ofType": { 712 | "name": "Boolean", 713 | "kind": "SCALAR" 714 | } 715 | }, 716 | "description": "Included when true." 717 | } 718 | ], 719 | "description": "Directs the executor to include this field or fragment only when the `if` argument is true", 720 | "locations": [ 721 | "FIELD", 722 | "FRAGMENT_SPREAD", 723 | "INLINE_FRAGMENT" 724 | ] 725 | }, 726 | { 727 | "name": "skip", 728 | "args": [ 729 | { 730 | "name": "if", 731 | "type": { 732 | "kind": "NON_NULL", 733 | "ofType": { 734 | "name": "Boolean", 735 | "kind": "SCALAR" 736 | } 737 | }, 738 | "description": "Skipped when true." 739 | } 740 | ], 741 | "description": "Directs the executor to skip this field or fragment when the `if`'argument is true.", 742 | "locations": [ 743 | "FIELD", 744 | "FRAGMENT_SPREAD", 745 | "INLINE_FRAGMENT" 746 | ] 747 | }, 748 | { 749 | "name": "defer", 750 | "args": [], 751 | "description": "This directive allows results to be deferred during execution", 752 | "locations": [ 753 | "FIELD" 754 | ] 755 | }, 756 | { 757 | "name": "deprecated", 758 | "args": [ 759 | { 760 | "name": "reason", 761 | "type": { 762 | "name": "String", 763 | "kind": "SCALAR" 764 | }, 765 | "defaultValue": "\"No longer supported\"" 766 | } 767 | ], 768 | "locations": [ 769 | "FIELD_DEFINITION", 770 | "ENUM_VALUE" 771 | ] 772 | } 773 | ], 774 | "queryType": { 775 | "name": "Query" 776 | } 777 | } 778 | }, 779 | "errors": [], 780 | "dataPresent": true 781 | } 782 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/input-9.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "__schema": { 4 | "types": [ 5 | { 6 | "name": "Query", 7 | "interfaces": [], 8 | "fields": [ 9 | { 10 | "name": "something", 11 | "args": [ 12 | { 13 | "name": "id", 14 | "type": { 15 | "kind": "NON_NULL", 16 | "ofType": { 17 | "name": "String", 18 | "kind": "SCALAR" 19 | } 20 | } 21 | } 22 | ], 23 | "isDeprecated": false, 24 | "type": { 25 | "name": "MyMap", 26 | "kind": "SCALAR" 27 | } 28 | } 29 | ], 30 | "kind": "OBJECT" 31 | }, 32 | { 33 | "name": "MyMap", 34 | "kind": "SCALAR" 35 | }, 36 | { 37 | "name": "String", 38 | "description": "Built-in String", 39 | "kind": "SCALAR" 40 | }, 41 | { 42 | "name": "__Schema", 43 | "description": "A GraphQL Introspection defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, the entry points for query, mutation, and subscription operations.", 44 | "interfaces": [], 45 | "fields": [ 46 | { 47 | "name": "types", 48 | "args": [], 49 | "description": "A list of all types supported by this server.", 50 | "isDeprecated": false, 51 | "type": { 52 | "kind": "NON_NULL", 53 | "ofType": { 54 | "kind": "LIST", 55 | "ofType": { 56 | "kind": "NON_NULL", 57 | "ofType": { 58 | "name": "__Type", 59 | "kind": "OBJECT" 60 | } 61 | } 62 | } 63 | } 64 | }, 65 | { 66 | "name": "queryType", 67 | "args": [], 68 | "description": "The type that query operations will be rooted at.", 69 | "isDeprecated": false, 70 | "type": { 71 | "kind": "NON_NULL", 72 | "ofType": { 73 | "name": "__Type", 74 | "kind": "OBJECT" 75 | } 76 | } 77 | }, 78 | { 79 | "name": "mutationType", 80 | "args": [], 81 | "description": "If this server supports mutation, the type that mutation operations will be rooted at.", 82 | "isDeprecated": false, 83 | "type": { 84 | "name": "__Type", 85 | "kind": "OBJECT" 86 | } 87 | }, 88 | { 89 | "name": "directives", 90 | "args": [], 91 | "description": "'A list of all directives supported by this server.", 92 | "isDeprecated": false, 93 | "type": { 94 | "kind": "NON_NULL", 95 | "ofType": { 96 | "kind": "LIST", 97 | "ofType": { 98 | "kind": "NON_NULL", 99 | "ofType": { 100 | "name": "__Directive", 101 | "kind": "OBJECT" 102 | } 103 | } 104 | } 105 | } 106 | }, 107 | { 108 | "name": "subscriptionType", 109 | "args": [], 110 | "description": "'If this server support subscription, the type that subscription operations will be rooted at.", 111 | "isDeprecated": false, 112 | "type": { 113 | "name": "__Type", 114 | "kind": "OBJECT" 115 | } 116 | } 117 | ], 118 | "kind": "OBJECT" 119 | }, 120 | { 121 | "name": "__Type", 122 | "interfaces": [], 123 | "fields": [ 124 | { 125 | "name": "kind", 126 | "args": [], 127 | "isDeprecated": false, 128 | "type": { 129 | "kind": "NON_NULL", 130 | "ofType": { 131 | "name": "__TypeKind", 132 | "kind": "ENUM" 133 | } 134 | } 135 | }, 136 | { 137 | "name": "name", 138 | "args": [], 139 | "isDeprecated": false, 140 | "type": { 141 | "name": "String", 142 | "kind": "SCALAR" 143 | } 144 | }, 145 | { 146 | "name": "description", 147 | "args": [], 148 | "isDeprecated": false, 149 | "type": { 150 | "name": "String", 151 | "kind": "SCALAR" 152 | } 153 | }, 154 | { 155 | "name": "fields", 156 | "args": [ 157 | { 158 | "name": "includeDeprecated", 159 | "type": { 160 | "name": "Boolean", 161 | "kind": "SCALAR" 162 | }, 163 | "defaultValue": "false" 164 | } 165 | ], 166 | "isDeprecated": false, 167 | "type": { 168 | "kind": "LIST", 169 | "ofType": { 170 | "kind": "NON_NULL", 171 | "ofType": { 172 | "name": "__Field", 173 | "kind": "OBJECT" 174 | } 175 | } 176 | } 177 | }, 178 | { 179 | "name": "interfaces", 180 | "args": [], 181 | "isDeprecated": false, 182 | "type": { 183 | "kind": "LIST", 184 | "ofType": { 185 | "kind": "NON_NULL", 186 | "ofType": { 187 | "name": "__Type", 188 | "kind": "OBJECT" 189 | } 190 | } 191 | } 192 | }, 193 | { 194 | "name": "possibleTypes", 195 | "args": [], 196 | "isDeprecated": false, 197 | "type": { 198 | "kind": "LIST", 199 | "ofType": { 200 | "kind": "NON_NULL", 201 | "ofType": { 202 | "name": "__Type", 203 | "kind": "OBJECT" 204 | } 205 | } 206 | } 207 | }, 208 | { 209 | "name": "enumValues", 210 | "args": [ 211 | { 212 | "name": "includeDeprecated", 213 | "type": { 214 | "name": "Boolean", 215 | "kind": "SCALAR" 216 | }, 217 | "defaultValue": "false" 218 | } 219 | ], 220 | "isDeprecated": false, 221 | "type": { 222 | "kind": "LIST", 223 | "ofType": { 224 | "kind": "NON_NULL", 225 | "ofType": { 226 | "name": "__EnumValue", 227 | "kind": "OBJECT" 228 | } 229 | } 230 | } 231 | }, 232 | { 233 | "name": "inputFields", 234 | "args": [], 235 | "isDeprecated": false, 236 | "type": { 237 | "kind": "LIST", 238 | "ofType": { 239 | "kind": "NON_NULL", 240 | "ofType": { 241 | "name": "__InputValue", 242 | "kind": "OBJECT" 243 | } 244 | } 245 | } 246 | }, 247 | { 248 | "name": "ofType", 249 | "args": [], 250 | "isDeprecated": false, 251 | "type": { 252 | "name": "__Type", 253 | "kind": "OBJECT" 254 | } 255 | } 256 | ], 257 | "kind": "OBJECT" 258 | }, 259 | { 260 | "name": "__TypeKind", 261 | "description": "An enum describing what kind of type a given __Type is", 262 | "kind": "ENUM", 263 | "enumValues": [ 264 | { 265 | "name": "SCALAR", 266 | "description": "Indicates this type is a scalar.", 267 | "isDeprecated": false 268 | }, 269 | { 270 | "name": "OBJECT", 271 | "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", 272 | "isDeprecated": false 273 | }, 274 | { 275 | "name": "INTERFACE", 276 | "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", 277 | "isDeprecated": false 278 | }, 279 | { 280 | "name": "UNION", 281 | "description": "Indicates this type is a union. `possibleTypes` is a valid field.", 282 | "isDeprecated": false 283 | }, 284 | { 285 | "name": "ENUM", 286 | "description": "Indicates this type is an enum. `enumValues` is a valid field.", 287 | "isDeprecated": false 288 | }, 289 | { 290 | "name": "INPUT_OBJECT", 291 | "description": "Indicates this type is an input object. `inputFields` is a valid field.", 292 | "isDeprecated": false 293 | }, 294 | { 295 | "name": "LIST", 296 | "description": "Indicates this type is a list. `ofType` is a valid field.", 297 | "isDeprecated": false 298 | }, 299 | { 300 | "name": "NON_NULL", 301 | "description": "Indicates this type is a non-null. `ofType` is a valid field.", 302 | "isDeprecated": false 303 | } 304 | ] 305 | }, 306 | { 307 | "name": "__Field", 308 | "interfaces": [], 309 | "fields": [ 310 | { 311 | "name": "name", 312 | "args": [], 313 | "isDeprecated": false, 314 | "type": { 315 | "kind": "NON_NULL", 316 | "ofType": { 317 | "name": "String", 318 | "kind": "SCALAR" 319 | } 320 | } 321 | }, 322 | { 323 | "name": "description", 324 | "args": [], 325 | "isDeprecated": false, 326 | "type": { 327 | "name": "String", 328 | "kind": "SCALAR" 329 | } 330 | }, 331 | { 332 | "name": "args", 333 | "args": [], 334 | "isDeprecated": false, 335 | "type": { 336 | "kind": "NON_NULL", 337 | "ofType": { 338 | "kind": "LIST", 339 | "ofType": { 340 | "kind": "NON_NULL", 341 | "ofType": { 342 | "name": "__InputValue", 343 | "kind": "OBJECT" 344 | } 345 | } 346 | } 347 | } 348 | }, 349 | { 350 | "name": "type", 351 | "args": [], 352 | "isDeprecated": false, 353 | "type": { 354 | "kind": "NON_NULL", 355 | "ofType": { 356 | "name": "__Type", 357 | "kind": "OBJECT" 358 | } 359 | } 360 | }, 361 | { 362 | "name": "isDeprecated", 363 | "args": [], 364 | "isDeprecated": false, 365 | "type": { 366 | "kind": "NON_NULL", 367 | "ofType": { 368 | "name": "Boolean", 369 | "kind": "SCALAR" 370 | } 371 | } 372 | }, 373 | { 374 | "name": "deprecationReason", 375 | "args": [], 376 | "isDeprecated": false, 377 | "type": { 378 | "name": "String", 379 | "kind": "SCALAR" 380 | } 381 | } 382 | ], 383 | "kind": "OBJECT" 384 | }, 385 | { 386 | "name": "__InputValue", 387 | "interfaces": [], 388 | "fields": [ 389 | { 390 | "name": "name", 391 | "args": [], 392 | "isDeprecated": false, 393 | "type": { 394 | "kind": "NON_NULL", 395 | "ofType": { 396 | "name": "String", 397 | "kind": "SCALAR" 398 | } 399 | } 400 | }, 401 | { 402 | "name": "description", 403 | "args": [], 404 | "isDeprecated": false, 405 | "type": { 406 | "name": "String", 407 | "kind": "SCALAR" 408 | } 409 | }, 410 | { 411 | "name": "type", 412 | "args": [], 413 | "isDeprecated": false, 414 | "type": { 415 | "kind": "NON_NULL", 416 | "ofType": { 417 | "name": "__Type", 418 | "kind": "OBJECT" 419 | } 420 | } 421 | }, 422 | { 423 | "name": "defaultValue", 424 | "args": [], 425 | "isDeprecated": false, 426 | "type": { 427 | "name": "String", 428 | "kind": "SCALAR" 429 | } 430 | } 431 | ], 432 | "kind": "OBJECT" 433 | }, 434 | { 435 | "name": "Boolean", 436 | "description": "Built-in Boolean", 437 | "kind": "SCALAR" 438 | }, 439 | { 440 | "name": "__EnumValue", 441 | "interfaces": [], 442 | "fields": [ 443 | { 444 | "name": "name", 445 | "args": [], 446 | "isDeprecated": false, 447 | "type": { 448 | "kind": "NON_NULL", 449 | "ofType": { 450 | "name": "String", 451 | "kind": "SCALAR" 452 | } 453 | } 454 | }, 455 | { 456 | "name": "description", 457 | "args": [], 458 | "isDeprecated": false, 459 | "type": { 460 | "name": "String", 461 | "kind": "SCALAR" 462 | } 463 | }, 464 | { 465 | "name": "isDeprecated", 466 | "args": [], 467 | "isDeprecated": false, 468 | "type": { 469 | "kind": "NON_NULL", 470 | "ofType": { 471 | "name": "Boolean", 472 | "kind": "SCALAR" 473 | } 474 | } 475 | }, 476 | { 477 | "name": "deprecationReason", 478 | "args": [], 479 | "isDeprecated": false, 480 | "type": { 481 | "name": "String", 482 | "kind": "SCALAR" 483 | } 484 | } 485 | ], 486 | "kind": "OBJECT" 487 | }, 488 | { 489 | "name": "__Directive", 490 | "interfaces": [], 491 | "fields": [ 492 | { 493 | "name": "name", 494 | "args": [], 495 | "isDeprecated": false, 496 | "type": { 497 | "name": "String", 498 | "kind": "SCALAR" 499 | } 500 | }, 501 | { 502 | "name": "description", 503 | "args": [], 504 | "isDeprecated": false, 505 | "type": { 506 | "name": "String", 507 | "kind": "SCALAR" 508 | } 509 | }, 510 | { 511 | "name": "locations", 512 | "args": [], 513 | "isDeprecated": false, 514 | "type": { 515 | "kind": "LIST", 516 | "ofType": { 517 | "kind": "NON_NULL", 518 | "ofType": { 519 | "name": "__DirectiveLocation", 520 | "kind": "ENUM" 521 | } 522 | } 523 | } 524 | }, 525 | { 526 | "name": "args", 527 | "args": [], 528 | "isDeprecated": false, 529 | "type": { 530 | "kind": "NON_NULL", 531 | "ofType": { 532 | "kind": "LIST", 533 | "ofType": { 534 | "kind": "NON_NULL", 535 | "ofType": { 536 | "name": "__InputValue", 537 | "kind": "OBJECT" 538 | } 539 | } 540 | } 541 | } 542 | }, 543 | { 544 | "name": "onOperation", 545 | "args": [], 546 | "deprecationReason": "Use `locations`.", 547 | "isDeprecated": true, 548 | "type": { 549 | "name": "Boolean", 550 | "kind": "SCALAR" 551 | } 552 | }, 553 | { 554 | "name": "onFragment", 555 | "args": [], 556 | "deprecationReason": "Use `locations`.", 557 | "isDeprecated": true, 558 | "type": { 559 | "name": "Boolean", 560 | "kind": "SCALAR" 561 | } 562 | }, 563 | { 564 | "name": "onField", 565 | "args": [], 566 | "deprecationReason": "Use `locations`.", 567 | "isDeprecated": true, 568 | "type": { 569 | "name": "Boolean", 570 | "kind": "SCALAR" 571 | } 572 | } 573 | ], 574 | "kind": "OBJECT" 575 | }, 576 | { 577 | "name": "__DirectiveLocation", 578 | "description": "An enum describing valid locations where a directive can be placed", 579 | "kind": "ENUM", 580 | "enumValues": [ 581 | { 582 | "name": "QUERY", 583 | "description": "Indicates the directive is valid on queries.", 584 | "isDeprecated": false 585 | }, 586 | { 587 | "name": "MUTATION", 588 | "description": "Indicates the directive is valid on mutations.", 589 | "isDeprecated": false 590 | }, 591 | { 592 | "name": "FIELD", 593 | "description": "Indicates the directive is valid on fields.", 594 | "isDeprecated": false 595 | }, 596 | { 597 | "name": "FRAGMENT_DEFINITION", 598 | "description": "Indicates the directive is valid on fragment definitions.", 599 | "isDeprecated": false 600 | }, 601 | { 602 | "name": "FRAGMENT_SPREAD", 603 | "description": "Indicates the directive is valid on fragment spreads.", 604 | "isDeprecated": false 605 | }, 606 | { 607 | "name": "INLINE_FRAGMENT", 608 | "description": "Indicates the directive is valid on inline fragments.", 609 | "isDeprecated": false 610 | }, 611 | { 612 | "name": "SCHEMA", 613 | "description": "Indicates the directive is valid on a schema SDL definition.", 614 | "isDeprecated": false 615 | }, 616 | { 617 | "name": "SCALAR", 618 | "description": "Indicates the directive is valid on a scalar SDL definition.", 619 | "isDeprecated": false 620 | }, 621 | { 622 | "name": "OBJECT", 623 | "description": "Indicates the directive is valid on an object SDL definition.", 624 | "isDeprecated": false 625 | }, 626 | { 627 | "name": "FIELD_DEFINITION", 628 | "description": "Indicates the directive is valid on a field SDL definition.", 629 | "isDeprecated": false 630 | }, 631 | { 632 | "name": "ARGUMENT_DEFINITION", 633 | "description": "Indicates the directive is valid on a field argument SDL definition.", 634 | "isDeprecated": false 635 | }, 636 | { 637 | "name": "INTERFACE", 638 | "description": "Indicates the directive is valid on an interface SDL definition.", 639 | "isDeprecated": false 640 | }, 641 | { 642 | "name": "UNION", 643 | "description": "Indicates the directive is valid on an union SDL definition.", 644 | "isDeprecated": false 645 | }, 646 | { 647 | "name": "ENUM", 648 | "description": "Indicates the directive is valid on an enum SDL definition.", 649 | "isDeprecated": false 650 | }, 651 | { 652 | "name": "ENUM_VALUE", 653 | "description": "Indicates the directive is valid on an enum value SDL definition.", 654 | "isDeprecated": false 655 | }, 656 | { 657 | "name": "INPUT_OBJECT", 658 | "description": "Indicates the directive is valid on an input object SDL definition.", 659 | "isDeprecated": false 660 | }, 661 | { 662 | "name": "INPUT_FIELD_DEFINITION", 663 | "description": "Indicates the directive is valid on an input object field SDL definition.", 664 | "isDeprecated": false 665 | } 666 | ] 667 | } 668 | ], 669 | "directives": [ 670 | { 671 | "name": "include", 672 | "args": [ 673 | { 674 | "name": "if", 675 | "type": { 676 | "kind": "NON_NULL", 677 | "ofType": { 678 | "name": "Boolean", 679 | "kind": "SCALAR" 680 | } 681 | }, 682 | "description": "Included when true." 683 | } 684 | ], 685 | "description": "Directs the executor to include this field or fragment only when the `if` argument is true", 686 | "locations": [ 687 | "FIELD", 688 | "FRAGMENT_SPREAD", 689 | "INLINE_FRAGMENT" 690 | ] 691 | }, 692 | { 693 | "name": "skip", 694 | "args": [ 695 | { 696 | "name": "if", 697 | "type": { 698 | "kind": "NON_NULL", 699 | "ofType": { 700 | "name": "Boolean", 701 | "kind": "SCALAR" 702 | } 703 | }, 704 | "description": "Skipped when true." 705 | } 706 | ], 707 | "description": "Directs the executor to skip this field or fragment when the `if`'argument is true.", 708 | "locations": [ 709 | "FIELD", 710 | "FRAGMENT_SPREAD", 711 | "INLINE_FRAGMENT" 712 | ] 713 | }, 714 | { 715 | "name": "defer", 716 | "args": [], 717 | "description": "This directive allows results to be deferred during execution", 718 | "locations": [ 719 | "FIELD" 720 | ] 721 | }, 722 | { 723 | "name": "deprecated", 724 | "args": [ 725 | { 726 | "name": "reason", 727 | "type": { 728 | "name": "String", 729 | "kind": "SCALAR" 730 | }, 731 | "defaultValue": "\"No longer supported\"" 732 | } 733 | ], 734 | "locations": [ 735 | "FIELD_DEFINITION", 736 | "ENUM_VALUE" 737 | ] 738 | } 739 | ], 740 | "queryType": { 741 | "name": "Query" 742 | } 743 | } 744 | }, 745 | "errors": [], 746 | "dataPresent": true 747 | } 748 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/intro2intro.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": { 3 | "__schema": { 4 | "types": [ 5 | { 6 | "name": "Query", 7 | "interfaces": [], 8 | "fields": [ 9 | { 10 | "name": "customer", 11 | "args": [ 12 | { 13 | "name": "id", 14 | "type": { 15 | "kind": "NON_NULL", 16 | "ofType": { 17 | "name": "String", 18 | "kind": "SCALAR" 19 | } 20 | } 21 | } 22 | ], 23 | "isDeprecated": false, 24 | "type": { 25 | "kind": "NON_NULL", 26 | "ofType": { 27 | "name": "Customer", 28 | "kind": "OBJECT" 29 | } 30 | } 31 | } 32 | ], 33 | "kind": "OBJECT" 34 | }, 35 | { 36 | "name": "Customer", 37 | "interfaces": [], 38 | "fields": [ 39 | { 40 | "name": "id", 41 | "args": [], 42 | "description": " fields with ! are required", 43 | "isDeprecated": false, 44 | "type": { 45 | "kind": "NON_NULL", 46 | "ofType": { 47 | "name": "ID", 48 | "kind": "SCALAR" 49 | } 50 | } 51 | }, 52 | { 53 | "name": "name", 54 | "args": [], 55 | "isDeprecated": false, 56 | "type": { 57 | "name": "String", 58 | "kind": "SCALAR" 59 | } 60 | } 61 | ], 62 | "kind": "OBJECT" 63 | }, 64 | { 65 | "name": "ID", 66 | "description": "Built-in ID", 67 | "kind": "SCALAR" 68 | }, 69 | { 70 | "name": "String", 71 | "description": "Built-in String", 72 | "kind": "SCALAR" 73 | }, 74 | { 75 | "name": "__Schema", 76 | "description": "A GraphQL Introspection defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, the entry points for query, mutation, and subscription operations.", 77 | "interfaces": [], 78 | "fields": [ 79 | { 80 | "name": "types", 81 | "args": [], 82 | "description": "A list of all types supported by this server.", 83 | "isDeprecated": false, 84 | "type": { 85 | "kind": "NON_NULL", 86 | "ofType": { 87 | "kind": "LIST", 88 | "ofType": { 89 | "kind": "NON_NULL", 90 | "ofType": { 91 | "name": "__Type", 92 | "kind": "OBJECT" 93 | } 94 | } 95 | } 96 | } 97 | }, 98 | { 99 | "name": "queryType", 100 | "args": [], 101 | "description": "The type that query operations will be rooted at.", 102 | "isDeprecated": false, 103 | "type": { 104 | "kind": "NON_NULL", 105 | "ofType": { 106 | "name": "__Type", 107 | "kind": "OBJECT" 108 | } 109 | } 110 | }, 111 | { 112 | "name": "mutationType", 113 | "args": [], 114 | "description": "If this server supports mutation, the type that mutation operations will be rooted at.", 115 | "isDeprecated": false, 116 | "type": { 117 | "name": "__Type", 118 | "kind": "OBJECT" 119 | } 120 | }, 121 | { 122 | "name": "directives", 123 | "args": [], 124 | "description": "'A list of all directives supported by this server.", 125 | "isDeprecated": false, 126 | "type": { 127 | "kind": "NON_NULL", 128 | "ofType": { 129 | "kind": "LIST", 130 | "ofType": { 131 | "kind": "NON_NULL", 132 | "ofType": { 133 | "name": "__Directive", 134 | "kind": "OBJECT" 135 | } 136 | } 137 | } 138 | } 139 | }, 140 | { 141 | "name": "subscriptionType", 142 | "args": [], 143 | "description": "'If this server support subscription, the type that subscription operations will be rooted at.", 144 | "isDeprecated": false, 145 | "type": { 146 | "name": "__Type", 147 | "kind": "OBJECT" 148 | } 149 | } 150 | ], 151 | "kind": "OBJECT" 152 | }, 153 | { 154 | "name": "__Type", 155 | "interfaces": [], 156 | "fields": [ 157 | { 158 | "name": "kind", 159 | "args": [], 160 | "isDeprecated": false, 161 | "type": { 162 | "kind": "NON_NULL", 163 | "ofType": { 164 | "name": "__TypeKind", 165 | "kind": "ENUM" 166 | } 167 | } 168 | }, 169 | { 170 | "name": "name", 171 | "args": [], 172 | "isDeprecated": false, 173 | "type": { 174 | "name": "String", 175 | "kind": "SCALAR" 176 | } 177 | }, 178 | { 179 | "name": "description", 180 | "args": [], 181 | "isDeprecated": false, 182 | "type": { 183 | "name": "String", 184 | "kind": "SCALAR" 185 | } 186 | }, 187 | { 188 | "name": "fields", 189 | "args": [ 190 | { 191 | "name": "includeDeprecated", 192 | "type": { 193 | "name": "Boolean", 194 | "kind": "SCALAR" 195 | }, 196 | "defaultValue": "false" 197 | } 198 | ], 199 | "isDeprecated": false, 200 | "type": { 201 | "kind": "LIST", 202 | "ofType": { 203 | "kind": "NON_NULL", 204 | "ofType": { 205 | "name": "__Field", 206 | "kind": "OBJECT" 207 | } 208 | } 209 | } 210 | }, 211 | { 212 | "name": "interfaces", 213 | "args": [], 214 | "isDeprecated": false, 215 | "type": { 216 | "kind": "LIST", 217 | "ofType": { 218 | "kind": "NON_NULL", 219 | "ofType": { 220 | "name": "__Type", 221 | "kind": "OBJECT" 222 | } 223 | } 224 | } 225 | }, 226 | { 227 | "name": "possibleTypes", 228 | "args": [], 229 | "isDeprecated": false, 230 | "type": { 231 | "kind": "LIST", 232 | "ofType": { 233 | "kind": "NON_NULL", 234 | "ofType": { 235 | "name": "__Type", 236 | "kind": "OBJECT" 237 | } 238 | } 239 | } 240 | }, 241 | { 242 | "name": "enumValues", 243 | "args": [ 244 | { 245 | "name": "includeDeprecated", 246 | "type": { 247 | "name": "Boolean", 248 | "kind": "SCALAR" 249 | }, 250 | "defaultValue": "false" 251 | } 252 | ], 253 | "isDeprecated": false, 254 | "type": { 255 | "kind": "LIST", 256 | "ofType": { 257 | "kind": "NON_NULL", 258 | "ofType": { 259 | "name": "__EnumValue", 260 | "kind": "OBJECT" 261 | } 262 | } 263 | } 264 | }, 265 | { 266 | "name": "inputFields", 267 | "args": [], 268 | "isDeprecated": false, 269 | "type": { 270 | "kind": "LIST", 271 | "ofType": { 272 | "kind": "NON_NULL", 273 | "ofType": { 274 | "name": "__InputValue", 275 | "kind": "OBJECT" 276 | } 277 | } 278 | } 279 | }, 280 | { 281 | "name": "ofType", 282 | "args": [], 283 | "isDeprecated": false, 284 | "type": { 285 | "name": "__Type", 286 | "kind": "OBJECT" 287 | } 288 | } 289 | ], 290 | "kind": "OBJECT" 291 | }, 292 | { 293 | "name": "__TypeKind", 294 | "description": "An enum describing what kind of type a given __Type is", 295 | "kind": "ENUM", 296 | "enumValues": [ 297 | { 298 | "name": "SCALAR", 299 | "description": "Indicates this type is a scalar.", 300 | "isDeprecated": false 301 | }, 302 | { 303 | "name": "OBJECT", 304 | "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", 305 | "isDeprecated": false 306 | }, 307 | { 308 | "name": "INTERFACE", 309 | "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", 310 | "isDeprecated": false 311 | }, 312 | { 313 | "name": "UNION", 314 | "description": "Indicates this type is a union. `possibleTypes` is a valid field.", 315 | "isDeprecated": false 316 | }, 317 | { 318 | "name": "ENUM", 319 | "description": "Indicates this type is an enum. `enumValues` is a valid field.", 320 | "isDeprecated": false 321 | }, 322 | { 323 | "name": "INPUT_OBJECT", 324 | "description": "Indicates this type is an input object. `inputFields` is a valid field.", 325 | "isDeprecated": false 326 | }, 327 | { 328 | "name": "LIST", 329 | "description": "Indicates this type is a list. `ofType` is a valid field.", 330 | "isDeprecated": false 331 | }, 332 | { 333 | "name": "NON_NULL", 334 | "description": "Indicates this type is a non-null. `ofType` is a valid field.", 335 | "isDeprecated": false 336 | } 337 | ] 338 | }, 339 | { 340 | "name": "__Field", 341 | "interfaces": [], 342 | "fields": [ 343 | { 344 | "name": "name", 345 | "args": [], 346 | "isDeprecated": false, 347 | "type": { 348 | "kind": "NON_NULL", 349 | "ofType": { 350 | "name": "String", 351 | "kind": "SCALAR" 352 | } 353 | } 354 | }, 355 | { 356 | "name": "description", 357 | "args": [], 358 | "isDeprecated": false, 359 | "type": { 360 | "name": "String", 361 | "kind": "SCALAR" 362 | } 363 | }, 364 | { 365 | "name": "args", 366 | "args": [], 367 | "isDeprecated": false, 368 | "type": { 369 | "kind": "NON_NULL", 370 | "ofType": { 371 | "kind": "LIST", 372 | "ofType": { 373 | "kind": "NON_NULL", 374 | "ofType": { 375 | "name": "__InputValue", 376 | "kind": "OBJECT" 377 | } 378 | } 379 | } 380 | } 381 | }, 382 | { 383 | "name": "type", 384 | "args": [], 385 | "isDeprecated": false, 386 | "type": { 387 | "kind": "NON_NULL", 388 | "ofType": { 389 | "name": "__Type", 390 | "kind": "OBJECT" 391 | } 392 | } 393 | }, 394 | { 395 | "name": "isDeprecated", 396 | "args": [], 397 | "isDeprecated": false, 398 | "type": { 399 | "kind": "NON_NULL", 400 | "ofType": { 401 | "name": "Boolean", 402 | "kind": "SCALAR" 403 | } 404 | } 405 | }, 406 | { 407 | "name": "deprecationReason", 408 | "args": [], 409 | "isDeprecated": false, 410 | "type": { 411 | "name": "String", 412 | "kind": "SCALAR" 413 | } 414 | } 415 | ], 416 | "kind": "OBJECT" 417 | }, 418 | { 419 | "name": "__InputValue", 420 | "interfaces": [], 421 | "fields": [ 422 | { 423 | "name": "name", 424 | "args": [], 425 | "isDeprecated": false, 426 | "type": { 427 | "kind": "NON_NULL", 428 | "ofType": { 429 | "name": "String", 430 | "kind": "SCALAR" 431 | } 432 | } 433 | }, 434 | { 435 | "name": "description", 436 | "args": [], 437 | "isDeprecated": false, 438 | "type": { 439 | "name": "String", 440 | "kind": "SCALAR" 441 | } 442 | }, 443 | { 444 | "name": "type", 445 | "args": [], 446 | "isDeprecated": false, 447 | "type": { 448 | "kind": "NON_NULL", 449 | "ofType": { 450 | "name": "__Type", 451 | "kind": "OBJECT" 452 | } 453 | } 454 | }, 455 | { 456 | "name": "defaultValue", 457 | "args": [], 458 | "isDeprecated": false, 459 | "type": { 460 | "name": "String", 461 | "kind": "SCALAR" 462 | } 463 | } 464 | ], 465 | "kind": "OBJECT" 466 | }, 467 | { 468 | "name": "Boolean", 469 | "description": "Built-in Boolean", 470 | "kind": "SCALAR" 471 | }, 472 | { 473 | "name": "__EnumValue", 474 | "interfaces": [], 475 | "fields": [ 476 | { 477 | "name": "name", 478 | "args": [], 479 | "isDeprecated": false, 480 | "type": { 481 | "kind": "NON_NULL", 482 | "ofType": { 483 | "name": "String", 484 | "kind": "SCALAR" 485 | } 486 | } 487 | }, 488 | { 489 | "name": "description", 490 | "args": [], 491 | "isDeprecated": false, 492 | "type": { 493 | "name": "String", 494 | "kind": "SCALAR" 495 | } 496 | }, 497 | { 498 | "name": "isDeprecated", 499 | "args": [], 500 | "isDeprecated": false, 501 | "type": { 502 | "kind": "NON_NULL", 503 | "ofType": { 504 | "name": "Boolean", 505 | "kind": "SCALAR" 506 | } 507 | } 508 | }, 509 | { 510 | "name": "deprecationReason", 511 | "args": [], 512 | "isDeprecated": false, 513 | "type": { 514 | "name": "String", 515 | "kind": "SCALAR" 516 | } 517 | } 518 | ], 519 | "kind": "OBJECT" 520 | }, 521 | { 522 | "name": "__Directive", 523 | "interfaces": [], 524 | "fields": [ 525 | { 526 | "name": "name", 527 | "args": [], 528 | "isDeprecated": false, 529 | "type": { 530 | "name": "String", 531 | "kind": "SCALAR" 532 | } 533 | }, 534 | { 535 | "name": "description", 536 | "args": [], 537 | "isDeprecated": false, 538 | "type": { 539 | "name": "String", 540 | "kind": "SCALAR" 541 | } 542 | }, 543 | { 544 | "name": "locations", 545 | "args": [], 546 | "isDeprecated": false, 547 | "type": { 548 | "kind": "LIST", 549 | "ofType": { 550 | "kind": "NON_NULL", 551 | "ofType": { 552 | "name": "__DirectiveLocation", 553 | "kind": "ENUM" 554 | } 555 | } 556 | } 557 | }, 558 | { 559 | "name": "args", 560 | "args": [], 561 | "isDeprecated": false, 562 | "type": { 563 | "kind": "NON_NULL", 564 | "ofType": { 565 | "kind": "LIST", 566 | "ofType": { 567 | "kind": "NON_NULL", 568 | "ofType": { 569 | "name": "__InputValue", 570 | "kind": "OBJECT" 571 | } 572 | } 573 | } 574 | } 575 | }, 576 | { 577 | "name": "onOperation", 578 | "args": [], 579 | "deprecationReason": "Use `locations`.", 580 | "isDeprecated": true, 581 | "type": { 582 | "name": "Boolean", 583 | "kind": "SCALAR" 584 | } 585 | }, 586 | { 587 | "name": "onFragment", 588 | "args": [], 589 | "deprecationReason": "Use `locations`.", 590 | "isDeprecated": true, 591 | "type": { 592 | "name": "Boolean", 593 | "kind": "SCALAR" 594 | } 595 | }, 596 | { 597 | "name": "onField", 598 | "args": [], 599 | "deprecationReason": "Use `locations`.", 600 | "isDeprecated": true, 601 | "type": { 602 | "name": "Boolean", 603 | "kind": "SCALAR" 604 | } 605 | } 606 | ], 607 | "kind": "OBJECT" 608 | }, 609 | { 610 | "name": "__DirectiveLocation", 611 | "description": "An enum describing valid locations where a directive can be placed", 612 | "kind": "ENUM", 613 | "enumValues": [ 614 | { 615 | "name": "QUERY", 616 | "description": "Indicates the directive is valid on queries.", 617 | "isDeprecated": false 618 | }, 619 | { 620 | "name": "MUTATION", 621 | "description": "Indicates the directive is valid on mutations.", 622 | "isDeprecated": false 623 | }, 624 | { 625 | "name": "FIELD", 626 | "description": "Indicates the directive is valid on fields.", 627 | "isDeprecated": false 628 | }, 629 | { 630 | "name": "FRAGMENT_DEFINITION", 631 | "description": "Indicates the directive is valid on fragment definitions.", 632 | "isDeprecated": false 633 | }, 634 | { 635 | "name": "FRAGMENT_SPREAD", 636 | "description": "Indicates the directive is valid on fragment spreads.", 637 | "isDeprecated": false 638 | }, 639 | { 640 | "name": "INLINE_FRAGMENT", 641 | "description": "Indicates the directive is valid on inline fragments.", 642 | "isDeprecated": false 643 | }, 644 | { 645 | "name": "SCHEMA", 646 | "description": "Indicates the directive is valid on a schema SDL definition.", 647 | "isDeprecated": false 648 | }, 649 | { 650 | "name": "SCALAR", 651 | "description": "Indicates the directive is valid on a scalar SDL definition.", 652 | "isDeprecated": false 653 | }, 654 | { 655 | "name": "OBJECT", 656 | "description": "Indicates the directive is valid on an object SDL definition.", 657 | "isDeprecated": false 658 | }, 659 | { 660 | "name": "FIELD_DEFINITION", 661 | "description": "Indicates the directive is valid on a field SDL definition.", 662 | "isDeprecated": false 663 | }, 664 | { 665 | "name": "ARGUMENT_DEFINITION", 666 | "description": "Indicates the directive is valid on a field argument SDL definition.", 667 | "isDeprecated": false 668 | }, 669 | { 670 | "name": "INTERFACE", 671 | "description": "Indicates the directive is valid on an interface SDL definition.", 672 | "isDeprecated": false 673 | }, 674 | { 675 | "name": "UNION", 676 | "description": "Indicates the directive is valid on an union SDL definition.", 677 | "isDeprecated": false 678 | }, 679 | { 680 | "name": "ENUM", 681 | "description": "Indicates the directive is valid on an enum SDL definition.", 682 | "isDeprecated": false 683 | }, 684 | { 685 | "name": "ENUM_VALUE", 686 | "description": "Indicates the directive is valid on an enum value SDL definition.", 687 | "isDeprecated": false 688 | }, 689 | { 690 | "name": "INPUT_OBJECT", 691 | "description": "Indicates the directive is valid on an input object SDL definition.", 692 | "isDeprecated": false 693 | }, 694 | { 695 | "name": "INPUT_FIELD_DEFINITION", 696 | "description": "Indicates the directive is valid on an input object field SDL definition.", 697 | "isDeprecated": false 698 | } 699 | ] 700 | } 701 | ], 702 | "directives": [ 703 | { 704 | "name": "include", 705 | "args": [ 706 | { 707 | "name": "if", 708 | "type": { 709 | "kind": "NON_NULL", 710 | "ofType": { 711 | "name": "Boolean", 712 | "kind": "SCALAR" 713 | } 714 | }, 715 | "description": "Included when true." 716 | } 717 | ], 718 | "description": "Directs the executor to include this field or fragment only when the `if` argument is true", 719 | "locations": [ 720 | "FIELD", 721 | "FRAGMENT_SPREAD", 722 | "INLINE_FRAGMENT" 723 | ] 724 | }, 725 | { 726 | "name": "skip", 727 | "args": [ 728 | { 729 | "name": "if", 730 | "type": { 731 | "kind": "NON_NULL", 732 | "ofType": { 733 | "name": "Boolean", 734 | "kind": "SCALAR" 735 | } 736 | }, 737 | "description": "Skipped when true." 738 | } 739 | ], 740 | "description": "Directs the executor to skip this field or fragment when the `if`'argument is true.", 741 | "locations": [ 742 | "FIELD", 743 | "FRAGMENT_SPREAD", 744 | "INLINE_FRAGMENT" 745 | ] 746 | }, 747 | { 748 | "name": "defer", 749 | "args": [], 750 | "description": "This directive allows results to be deferred during execution", 751 | "locations": [ 752 | "FIELD" 753 | ] 754 | }, 755 | { 756 | "name": "deprecated", 757 | "args": [ 758 | { 759 | "name": "reason", 760 | "type": { 761 | "name": "String", 762 | "kind": "SCALAR" 763 | }, 764 | "defaultValue": "\"No longer supported\"" 765 | } 766 | ], 767 | "locations": [ 768 | "FIELD_DEFINITION", 769 | "ENUM_VALUE" 770 | ] 771 | } 772 | ], 773 | "queryType": { 774 | "name": "Query" 775 | } 776 | } 777 | }, 778 | "errors": [], 779 | "dataPresent": true 780 | } 781 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-1.graphqls: -------------------------------------------------------------------------------- 1 | type Customer { 2 | #fields with ! are required 3 | id: ID! 4 | name: String 5 | } 6 | 7 | type Query { 8 | customer(id: String!): Customer! 9 | } 10 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-10.graphqls: -------------------------------------------------------------------------------- 1 | type Query { 2 | text(id: String): String 3 | } 4 | 5 | directive @argumentDirective on ARGUMENT_DEFINITION 6 | 7 | directive @enumDirective on ENUM 8 | 9 | directive @enumValDirective on ENUM_VALUE 10 | 11 | # Directive comment 12 | directive @fieldDefinitionDirective on FIELD_DEFINITION 13 | 14 | directive @fieldDirective on FIELD 15 | 16 | directive @fragmentDirective on FRAGMENT_DEFINITION 17 | 18 | directive @fragmentSpread on FRAGMENT_SPREAD 19 | 20 | directive @inlineFragmentDirective on INLINE_FRAGMENT 21 | 22 | directive @inputFieldDefinitionDirective on INPUT_FIELD_DEFINITION 23 | 24 | directive @inputObjectDirective on INPUT_OBJECT 25 | 26 | directive @interfaceDirective on INTERFACE 27 | 28 | directive @multiDirective on ENUM_VALUE | FIELD | OBJECT | QUERY | UNION 29 | 30 | directive @mutationDirective on MUTATION 31 | 32 | directive @objectDirective(role: String!) on OBJECT 33 | 34 | directive @queryDirective on QUERY 35 | 36 | # Custom Scalar Directive 37 | directive @scalardirective on SCALAR 38 | 39 | directive @schemaDirective on SCHEMA 40 | 41 | directive @unionDirective on UNION 42 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-2.graphqls: -------------------------------------------------------------------------------- 1 | type Company { 2 | id: ID! 3 | name: String! 4 | website: String! 5 | } 6 | 7 | input CreateCustomerInput { 8 | clientMutationId: String! 9 | email: String 10 | name: String 11 | } 12 | 13 | type CreateCustomerPayload { 14 | clientMutationId: String! 15 | customer: Customer 16 | } 17 | 18 | type Customer { 19 | company: Company 20 | email: String! 21 | #fields with ! are required 22 | id: ID! 23 | name: String! 24 | orders: [Order] 25 | } 26 | 27 | type Item { 28 | amount: Int 29 | currency: String 30 | id: ID! 31 | name: String! 32 | price: String 33 | producer: Company 34 | } 35 | 36 | type Mutation { 37 | createCustomer(input: CreateCustomerInput): CreateCustomerPayload! 38 | } 39 | 40 | type Order { 41 | id: ID! 42 | items: [Item] 43 | status: Status 44 | } 45 | 46 | type Query { 47 | customer(id: String!): Customer! 48 | customers: [Customer]! 49 | } 50 | 51 | enum Status { 52 | NEW, CANCELED, DONE 53 | } 54 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-4.graphqls: -------------------------------------------------------------------------------- 1 | type Circle { 2 | latitude: Float! 3 | longitude: Float! 4 | radius: Int 5 | } 6 | 7 | type Hotel { 8 | city: String! 9 | name: String! 10 | street: String! 11 | zipcode: String! 12 | } 13 | 14 | type Mutation { 15 | createCircle(latitude: Float!, longitude: Float!, radius: Int = 10000): Circle 16 | } 17 | 18 | type Query { 19 | findHotel(latitude: Float!, longitude: Float!, radius: Int = 10000): [Hotel] 20 | } 21 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-5.graphqls: -------------------------------------------------------------------------------- 1 | schema { 2 | query: QueryType 3 | mutation: MutationType 4 | subscription: SubscriptionType 5 | } 6 | 7 | type MutationType { 8 | createHero(name: String): String 9 | } 10 | 11 | type QueryType { 12 | hero(episode: String): String 13 | } 14 | 15 | type SubscriptionType { 16 | subHero(name: String): String 17 | } 18 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-6.graphqls: -------------------------------------------------------------------------------- 1 | # description of customer 2 | type Customer { 3 | # unique id 4 | id: ID! 5 | # lastname comment with 5 leading spaces 6 | lastname: String 7 | #name comment without leading space 8 | name: String 9 | } 10 | 11 | type Query { 12 | customer(id: String): Customer 13 | } 14 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-7.graphqls: -------------------------------------------------------------------------------- 1 | #desc 2 | scalar Map 3 | 4 | type Query { 5 | userOrGroup(id: String!): UserOrUserGroup! 6 | } 7 | 8 | interface SomeInterface { 9 | # The unique identifier 10 | id: ID 11 | map: Map 12 | max: Int 13 | min: Int 14 | } 15 | 16 | type User { 17 | id: ID 18 | name: String 19 | } 20 | 21 | type UserGroup { 22 | groupName: String 23 | id: ID 24 | } 25 | 26 | union UserOrUserGroup = User | UserGroup 27 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-8.graphqls: -------------------------------------------------------------------------------- 1 | #comment with one space at end 2 | type Customer { 3 | #comment with 3 spaces at end 4 | id: ID! 5 | name: String 6 | } 7 | 8 | type Query { 9 | customer(id: String!): Customer! 10 | } 11 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema-9.graphqls: -------------------------------------------------------------------------------- 1 | scalar MyMap 2 | 3 | type Query { 4 | something(id: String!): MyMap 5 | } 6 | -------------------------------------------------------------------------------- /core/src/test/resources/testdata/schema2schema.graphqls: -------------------------------------------------------------------------------- 1 | type Customer { 2 | # fields with ! are required 3 | id: ID! 4 | name: String 5 | } 6 | 7 | type Query { 8 | customer(id: String!): Customer! 9 | } -------------------------------------------------------------------------------- /docs/release-notes.md: -------------------------------------------------------------------------------- 1 | *Release notes were automatically generated by [Shipkit](http://shipkit.org/)* 2 | 3 | #### 0.2.3 4 | - 2020-10-27 - [10 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.2.2...v0.2.3) by [Marcin Stachniuk](https://github.com/mstachniuk) (4), jarek ratajski (3), shipkit-org (3) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.2.3-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.2.3) 5 | - Minor changes for kotlinization [(#26)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/26) 6 | - Improve Readme, add graphql-js alternative [(#25)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/25) 7 | - Bump Shipkit version [(#24)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/24) 8 | 9 | #### 0.2.2 10 | - 2018-11-22 - [10 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.2.1...v0.2.2) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.2.2-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.2.2) 11 | - #20 Add support for directives in schema [(#21)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/21) 12 | - Fix typos in Readme, add codecov badge [(#19)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/19) 13 | - Add Jacoco Test coverage [(#18)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/18) 14 | - Add test with scalar without comment in schema [(#17)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/17) 15 | - Fix description in scalar [(#16)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/16) 16 | 17 | #### 0.2.1 18 | - 2018-09-13 - [5 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.2.0...v0.2.1) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.2.1-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.2.1) 19 | - #13 Comments shouldn't be trimmed at end by default [(#15)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/15) 20 | - #10 Auto mocking scalars interfaces and unions in tests [(#14)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/14) 21 | 22 | #### 0.2.0 23 | - 2018-09-06 - [2 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.1.7...v0.2.0) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.2.0-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.2.0) 24 | - #11 Comments shouldn't start from space (by default) [(#12)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/12) 25 | 26 | #### 0.1.7 27 | - 2018-09-06 - [2 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.1.6...v0.1.7) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.1.7-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.1.7) 28 | - #8 Support custom schema query [(#9)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/9) 29 | 30 | #### 0.1.6 31 | - 2018-08-26 - [6 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.1.5...v0.1.6) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.1.6-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.1.6) 32 | - #3 Add support for default values in arguments of operations [(#7)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/7) 33 | - Add Introspection to Introspection Test [(#6)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/6) 34 | - #4 Add test for easier discovery if schema generation works [(#5)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/5) 35 | - Add test for easier discovery if schema generation works [(#4)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/issues/4) 36 | 37 | #### 0.1.5 38 | - 2018-08-25 - [10 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.1.4...v0.1.5) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.1.5-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.1.5) 39 | - Update readme [(#2)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/2) 40 | 41 | #### 0.1.4 42 | - 2018-08-14 - [2 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.1.3...v0.1.4) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.1.4-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.1.4) 43 | - No pull requests referenced in commit messages. 44 | 45 | #### 0.1.3 46 | - 2018-08-12 - [3 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.1.2...v0.1.3) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.1.3-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.1.3) 47 | - No pull requests referenced in commit messages. 48 | 49 | #### 0.1.2 50 | - 2018-08-10 - [4 commits](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/compare/v0.1.1...v0.1.2) by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.1.2-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.1.2) 51 | - No pull requests referenced in commit messages. 52 | 53 | #### 0.1.1 54 | - 2018-08-10 - 22 commits by [Marcin Stachniuk](https://github.com/mstachniuk) - published to [![Bintray](https://img.shields.io/badge/Bintray-0.1.1-green.svg)](https://bintray.com/mstachniuk/mstachniuk-maven-repo/maven/0.1.1) 55 | - Add shipkit and introduce multi module project [(#1)](https://github.com/mstachniuk/graphql-schema-from-introspection-generator/pull/1) 56 | 57 | -------------------------------------------------------------------------------- /gradle/shipkit.gradle: -------------------------------------------------------------------------------- 1 | shipkit { 2 | gitHub.repository = "mstachniuk/graphql-schema-from-introspection-generator" 3 | 4 | gitHub.readOnlyAuthToken = System.getenv("GH_WRITE_TOKEN") 5 | 6 | gitHub.writeAuthToken = System.getenv("GH_WRITE_TOKEN") 7 | 8 | team.developers = ['mstachniuk:Marcin Stachniuk'] 9 | } 10 | 11 | allprojects { 12 | plugins.withId("org.shipkit.bintray") { 13 | bintray { 14 | key = System.getenv("BINTRAY_API_KEY") 15 | pkg { 16 | repo = 'mstachniuk-maven-repo' 17 | user = 'mstachniuk' 18 | name = 'maven' 19 | licenses = ['MIT'] 20 | labels = ['graphql', 'kotlin', 'java', 'schema'] 21 | version { 22 | gpg { 23 | sign = true 24 | } 25 | mavenCentralSync { 26 | sync = true 27 | user = System.env.NEXUS_TOKEN_USER 28 | password = System.env.NEXUS_TOKEN_PWD 29 | } 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mstachniuk/graphql-schema-from-introspection-generator/79d42d22c4506733233f09861bb473e4f1dfadac/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jul 09 09:28:58 CEST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'graphql-schema-from-introspection-generator' 2 | 3 | include 'core', 'cli' 4 | 5 | rootProject.children.each { project -> 6 | project.name = rootProject.name + '-' + project.name 7 | } 8 | -------------------------------------------------------------------------------- /version.properties: -------------------------------------------------------------------------------- 1 | #Version of the produced binaries. This file is intended to be checked-in. 2 | #It will be automatically bumped by release automation. 3 | version=0.2.4 4 | previousVersion=0.2.3 5 | --------------------------------------------------------------------------------