Skip to content

Commit 5105c5d

Browse files
committed
Remove kotlin-labs-0.1
1 parent 5b6da34 commit 5105c5d

File tree

14 files changed

+21
-75
lines changed

14 files changed

+21
-75
lines changed

libraries/apollo-ast/api/apollo-ast.api

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,8 @@ public final class com/apollographql/apollo3/ast/GqldirectiveKt {
768768
}
769769

770770
public final class com/apollographql/apollo3/ast/GqldocumentKt {
771-
public static final fun apolloDefinitions ()Ljava/util/List;
772-
public static final fun apolloDefinitions (Ljava/lang/String;)Ljava/util/List;
773771
public static final fun builtinDefinitions ()Ljava/util/List;
772+
public static final fun kotlinLabsDefinitions (Ljava/lang/String;)Ljava/util/List;
774773
public static final fun linkDefinitions ()Ljava/util/List;
775774
public static final fun toSchema (Lcom/apollographql/apollo3/ast/GQLDocument;)Lcom/apollographql/apollo3/ast/Schema;
776775
public static final fun withBuiltinDefinitions (Lcom/apollographql/apollo3/ast/GQLDocument;)Lcom/apollographql/apollo3/ast/GQLDocument;

libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/gqldocument.kt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ package com.apollographql.apollo3.ast
33
import com.apollographql.apollo3.annotations.ApolloDeprecatedSince
44
import com.apollographql.apollo3.annotations.ApolloExperimental
55
import com.apollographql.apollo3.ast.internal.ExtensionsMerger
6-
import com.apollographql.apollo3.ast.internal.apollo_v0_1_definitionsStr
7-
import com.apollographql.apollo3.ast.internal.apollo_v0_2_definitionsStr
6+
import com.apollographql.apollo3.ast.internal.apolloDefinitionsStr
87
import com.apollographql.apollo3.ast.internal.builtinsDefinitionsStr
98
import com.apollographql.apollo3.ast.internal.ensureSchemaDefinition
109
import com.apollographql.apollo3.ast.internal.linkDefinitionsStr
@@ -79,18 +78,13 @@ fun builtinDefinitions() = definitionsFromString(builtinsDefinitionsStr)
7978
*/
8079
fun linkDefinitions() = definitionsFromString(linkDefinitionsStr)
8180

82-
@Deprecated("Use apolloDefinitions(version) instead", ReplaceWith("apolloDefinitions(\"v0.1\")"))
83-
@ApolloDeprecatedSince(ApolloDeprecatedSince.Version.v3_5_1)
84-
fun apolloDefinitions() = definitionsFromString(apollo_v0_1_definitionsStr)
85-
8681
/**
8782
* Extra apollo specific definitions from https://specs.apollo.dev/kotlin_labs/<[version]>
8883
*/
89-
fun apolloDefinitions(version: String): List<GQLDefinition> {
84+
fun kotlinLabsDefinitions(version: String): List<GQLDefinition> {
9085
return definitionsFromString(when (version) {
91-
"v0.1" -> apollo_v0_1_definitionsStr
92-
"v0.2" -> apollo_v0_2_definitionsStr
93-
else -> error("Apollo definitions $version are not supported")
86+
"v0.2" -> apolloDefinitionsStr
87+
else -> error("kotlin_labs/$version definitions are not supported, please use v0.2")
9488
})
9589
}
9690

libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/SchemaValidationScope.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import com.apollographql.apollo3.ast.OtherValidationIssue
3535
import com.apollographql.apollo3.ast.Schema
3636
import com.apollographql.apollo3.ast.Schema.Companion.TYPE_POLICY
3737
import com.apollographql.apollo3.ast.IncompatibleDirectiveDefinition
38-
import com.apollographql.apollo3.ast.apolloDefinitions
38+
import com.apollographql.apollo3.ast.kotlinLabsDefinitions
3939
import com.apollographql.apollo3.ast.builtinDefinitions
4040
import com.apollographql.apollo3.ast.canHaveKeyFields
4141
import com.apollographql.apollo3.ast.combineDefinitions
@@ -61,7 +61,7 @@ internal fun validateSchema(definitions: List<GQLDefinition>, requiresApolloDefi
6161

6262
var directivesToStrip = foreignSchemas.flatMap { it.directivesToStrip }
6363

64-
val apolloDefinitions = apolloDefinitions("v0.2")
64+
val apolloDefinitions = kotlinLabsDefinitions("v0.2")
6565

6666
if (requiresApolloDefinitions && foreignSchemas.none { it.name == "kotlin_labs" }) {
6767
/**
@@ -246,7 +246,7 @@ private class ForeignSchema(
246246
/**
247247
* Parses the schema extensions
248248
*
249-
* Example: extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1", import: ["@nonnull"])
249+
* Example: extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.2", import: ["@nonnull"])
250250
*/
251251
private fun List<GQLSchemaExtension>.getForeignSchemas(
252252
issues: MutableList<Issue>,
@@ -330,7 +330,7 @@ private fun List<GQLSchemaExtension>.getForeignSchemas(
330330

331331

332332
if (foreignName == "kotlin_labs") {
333-
val (definitions, renames) = apolloDefinitions(version).rename(mappings, prefix)
333+
val (definitions, renames) = kotlinLabsDefinitions(version).rename(mappings, prefix)
334334
foreignSchemas.add(
335335
ForeignSchema(
336336
name = foreignName,

libraries/apollo-ast/src/commonMain/kotlin/com/apollographql/apollo3/ast/internal/definitions.kt

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,7 @@ package com.apollographql.apollo3.ast.internal
77
* - link.graphqls: the [core schemas](https://specs.apollo.dev/link/v1.0/) definitions.
88
* - apollo-${version}.graphqls: the client directives supported by Apollo Kotlin. Changes are versioned at https://github.com/apollographql/specs. Changing them requires a new version and a PR.
99
*/
10-
11-
internal val apollo_v0_1_definitionsStr = """
12-
# Marks a field or variable definition as optional or required
13-
# By default Apollo Kotlin generates all variables of nullable types as optional, in compliance with the GraphQL specification,
14-
# but this can be configured with this directive, because if the variable was added in the first place, it's usually to pass a value
15-
directive @optional(if: Boolean = true) on FIELD | VARIABLE_DEFINITION
16-
17-
# Marks a field as non-null. The corresponding Kotlin property will be made non-nullable even if the GraphQL type is nullable.
18-
# When used on an object definition in a schema document, `fields` must be non-empty and contain a selection set of fields that should be non-null
19-
# When used on a field from an executable document, `fields` must always be empty
20-
#
21-
# Setting the directive at the schema level is usually easier as there is little reason that a field would be non-null in one place
22-
# and null in the other
23-
directive @nonnull(fields: String! = "") on OBJECT | FIELD
24-
25-
# Attach extra information to a given type
26-
# `keyFields`: a selection set containing fields used to compute the cache key of an object. Order is important.
27-
# `embeddedFields`: a selection set containing fields that shouldn't create a new cache Record and should be
28-
# embedded in their parent instead. Order is unimportant.
29-
directive @typePolicy(keyFields: String! = "", embeddedFields: String! = "") on OBJECT | INTERFACE | UNION
30-
31-
# Attach extra information to a given field
32-
# `keyArgs`: a list of arguments used to compute the cache key of the object this field is pointing to.
33-
# The list is parsed as a selection set: both spaces and comas are valid separators.
34-
# `paginationArgs` (experimental): a list of arguments that vary when requesting different pages.
35-
# These arguments are omitted when computing the cache key of this field.
36-
# The list is parsed as a selection set: both spaces and comas are valid separators.
37-
directive @fieldPolicy(forField: String!, keyArgs: String! = "", paginationArgs: String! = "") repeatable on OBJECT
38-
39-
""${'"'}
40-
Indicates that the given field, argument, input field or enum value requires
41-
giving explicit consent before being used.
42-
""${'"'}
43-
directive @requiresOptIn(feature: String!) repeatable
44-
on FIELD_DEFINITION
45-
| ARGUMENT_DEFINITION
46-
| INPUT_FIELD_DEFINITION
47-
| ENUM_VALUE
48-
49-
# Use the specified name in the generated code instead of the GraphQL name.
50-
# Use this for instance when the name would clash with a reserved keyword or field in the generated code.
51-
# This directive is experimental.
52-
directive @targetName(name: String!)
53-
on OBJECT
54-
| ENUM_VALUE
55-
""".trimIndent()
56-
57-
internal val apollo_v0_2_definitionsStr = """
10+
internal val apolloDefinitionsStr = """
5811
""${'"'}
5912
Marks a field or variable definition as optional or required
6013
By default Apollo Kotlin generates all variables of nullable types as optional, in compliance with the GraphQL specification,

libraries/apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ApolloCompiler.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import com.apollographql.apollo3.ast.Schema
2020
import com.apollographql.apollo3.ast.UnknownDirective
2121
import com.apollographql.apollo3.ast.UnusedFragment
2222
import com.apollographql.apollo3.ast.UnusedVariable
23-
import com.apollographql.apollo3.ast.apolloDefinitions
2423
import com.apollographql.apollo3.ast.checkEmpty
24+
import com.apollographql.apollo3.ast.kotlinLabsDefinitions
2525
import com.apollographql.apollo3.ast.parseAsGQLDocument
2626
import com.apollographql.apollo3.ast.pretty
2727
import com.apollographql.apollo3.ast.toGQLDocument
@@ -563,7 +563,7 @@ internal fun List<Issue>.group(
563563
val ignored = mutableListOf<Issue>()
564564
val warnings = mutableListOf<Issue>()
565565
val errors = mutableListOf<Issue>()
566-
val apolloDirectives = apolloDefinitions("v0.1").mapNotNull { (it as? GQLDirectiveDefinition)?.name }.toSet()
566+
val apolloDirectives = kotlinLabsDefinitions("v0.2").mapNotNull { (it as? GQLDirectiveDefinition)?.name }.toSet()
567567

568568
forEach {
569569
val severity = when (it) {

libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/keyfields/extendsSchema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1/", import: ["@typePolicy"])
1+
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.2/", import: ["@typePolicy"])
22

33
type Query {
44
node: Node

libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/keyfields/interfacesWithoutKeyFields.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1/", import: ["@typePolicy"])
1+
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.2/", import: ["@typePolicy"])
22

33
type Query {
44
book: Book!

libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/keyfields/nonexistentKeyField.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1/", import: ["@typePolicy"])
1+
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.2/", import: ["@typePolicy"])
22

33
type Query {
44
animal: Animal

libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/keyfields/objectAndInterfaceTypePolicySchema.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1/", import: ["@typePolicy", "@keyFields"])
1+
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.2/", import: ["@typePolicy", "@keyFields"])
22

33
type Query {
44
node: Node

libraries/apollo-compiler/src/test/kotlin/com/apollographql/apollo3/compiler/keyfields/objectInheritingTwoInterfaces.graphqls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.1/", import: ["@typePolicy"])
1+
extend schema @link(url: "https://specs.apollo.dev/kotlin_labs/v0.2/", import: ["@typePolicy"])
22

33
type Query {
44
book: Book!

0 commit comments

Comments
 (0)