diff --git a/__index__.md b/__index__.md index 8c41f84..75f5f92 100644 --- a/__index__.md +++ b/__index__.md @@ -31,6 +31,7 @@ - **[kotlin_labs/v0.4](/kotlin_labs/v0.4)** ([📄 graphql](kotlin_labs/v0.4/kotlin_labs-v0.4.graphql)) - **[kotlin_labs/v0.5](/kotlin_labs/v0.5)** ([📄 graphql](kotlin_labs/v0.5/kotlin_labs-v0.5.graphql)) - **[kotlin_labs/v0.6](/kotlin_labs/v0.6)** ([📄 graphql](kotlin_labs/v0.6/kotlin_labs-v0.6.graphql)) +- **[kotlin_labs/v0.7](/kotlin_labs/v0.7)** ([📄 graphql](kotlin_labs/v0.7/kotlin_labs-v0.7.graphql)) - **[link/v1.0](/link/v1.0)** ([📄 graphql](link/v1.0/link-v1.0.graphql)) - **[nullability/v0.1](/nullability/v0.1)** ([📄 graphql](nullability/v0.1/nullability-v0.1.graphql)) - **[nullability/v0.2](/nullability/v0.2)** ([📄 graphql](nullability/v0.2/nullability-v0.2.graphql)) diff --git a/index.md b/index.md index 9b8937d..79260c5 100644 --- a/index.md +++ b/index.md @@ -35,9 +35,9 @@ [inaccessible v0.2](inaccessible/v0.2) masks fields and types from a graph's public API -## kotlin_labs v0.6 +## kotlin_labs v0.7 -[kotlin_labs v0.6](kotlin_labs/v0.6) incubating directives supported by the Apollo Kotlin client +[kotlin_labs v0.7](kotlin_labs/v0.7) incubating directives supported by the Apollo Kotlin client ## nullability v0.4 diff --git a/kotlin_labs/v0.7/kotlin_labs-v0.7.graphql b/kotlin_labs/v0.7/kotlin_labs-v0.7.graphql new file mode 100644 index 0000000..c3cf318 --- /dev/null +++ b/kotlin_labs/v0.7/kotlin_labs-v0.7.graphql @@ -0,0 +1,90 @@ +""" +Marks a field or variable definition as optional or required +By default Apollo Kotlin generates all variables of nullable types as optional, in compliance with the GraphQL specification, +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 +Since: 3.0.0 +""" +directive @optional(if: Boolean = true) on FIELD | VARIABLE_DEFINITION + +""" +Indicates that the given field, argument, input field or enum value requires +giving explicit consent before being used. +Since: 3.3.1 +""" +directive @requiresOptIn(feature: String!) repeatable +on FIELD_DEFINITION + | ARGUMENT_DEFINITION + | INPUT_FIELD_DEFINITION + | ENUM_VALUE + +""" +Use the specified name in the generated code instead of the GraphQL name. +Use this for instance when the name would clash with a reserved keyword or field in the generated code. +This directive is experimental. +Since: 3.3.1 +""" +directive @targetName(name: String!) +on OBJECT + | INTERFACE + | ENUM + | ENUM_VALUE + | UNION + | SCALAR + | INPUT_OBJECT + +""" +Configure the Apollo compiler to map the given scalar to the given class. +""" +directive @map( + """ + The fully qualified type name to map the scalar to. + Simple generic types without variance or wildcards are also supported. + + Examples: + - `java.util.Date` + - `kotlin.collections.Map` + """ + to: String!, + + """ + A fully qualified expression referencing the adapter used to adapt to/from the type + or inline property type, or `null` to specify the adapter at runtime. + + Examples: + - `com.apollographql.adapter.datetime.KotlinxInstantAdapter` + - `com.example.MyAdapter()` + """ + with: String = null, + + """ + If non null, contains the name of the property used to wrap/unwrap the inline class. + [to] must be an inline class. + + Only used in Kotlin codegen. + """ + inlineProperty: String = null +) on SCALAR + +""" +Built-in types known at compile time. Apollo Kotlin knows the adapters for those types. +""" +enum BuiltIn { String, Boolean, Int, Long, Float, Double } + +""" +Use the given builtin type for this scalar. +""" +directive @mapTo( + """ + The built-in type to use for this scalar. + """ + builtIn: BuiltIn!, + """ + Whether to generate a wrapper inline class for this scalar. + """ + inline: Boolean! = true +) on SCALAR + +""" +Tells the Apollo compiler to generate Data Builders +""" +directive @generateDataBuilders on SCHEMA diff --git a/kotlin_labs/v0.7/kotlin_labs-v0.7.md b/kotlin_labs/v0.7/kotlin_labs-v0.7.md new file mode 100644 index 0000000..4d074d9 --- /dev/null +++ b/kotlin_labs/v0.7/kotlin_labs-v0.7.md @@ -0,0 +1,42 @@ +# kotlin_labs v0.7 + +

Experimental directives supported by Apollo Kotlin

+ +```raw html + + + +
StatusDraft
Version0.7
+ + +``` + +This specification provides a list of directives supported by the [Apollo Kotlin client](https://github.com/apollographql/apollo-kotlin). This specification is meant to be used as an incubator for new directives that are still being working on. As the directives mature and can be used by other clients/tools they will be moved to a separate feature-focused specification. + +#! @requiresOptIn + +:::[definition](kotlin_labs-v0.7.graphql#@requiresOptIn) + +#! @targetName + +:::[definition](kotlin_labs-v0.7.graphql#@targetName) + +#! @map + +:::[definition](kotlin_labs-v0.7.graphql#@map) + +#! @mapTo + +:::[definition](kotlin_labs-v0.7.graphql#@mapTo) + +#! BuiltIn + +:::[definition](kotlin_labs-v0.7.graphql#BuiltIn) + +#! @generateDataBuilders + +:::[definition](kotlin_labs-v0.7.graphql#@generateDataBuilders) + +#! @optional + +:::[definition](kotlin_labs-v0.7.graphql#@optional)