Skip to content

Commit 4b0fafd

Browse files
committed
Apollo 4.0.0-beta.2.
1 parent 8e62073 commit 4b0fafd

File tree

10 files changed

+481
-128
lines changed

10 files changed

+481
-128
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ksp = "1.9.20-1.0.14"
44
androidGradlePlugin = "8.3.0-alpha13"
55
gradle-toolchainsResolverPlugin = "0.7.0"
66
appVersioning = "1.3.1"
7-
apollo = "3.8.2"
7+
apollo = "4.0.0-beta.2"
88
googleServices = "4.4.0"
99
wire = "4.9.1"
1010
detekt = "1.23.3"

kmp/data-runtime-cloud/build.gradle.kts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1+
import io.github.reactivecircus.kstreamlined.buildlogic.envOrProp
2+
13
plugins {
24
id("kstreamlined.kmp.common")
35
id("kstreamlined.kmp.test")
46
id("com.apollographql.apollo3")
57
}
68

79
apollo {
10+
@Suppress("OPT_IN_USAGE")
811
service("kstreamlined") {
912
packageName.set("io.github.reactivecircus.kstreamlined.graphql")
10-
codegenModels.set("responseBased")
11-
flattenModels.set(true)
13+
codegenModels.set("experimental_operationBasedWithInterfaces")
14+
generateMethods.set(listOf("equalsHashCode", "toString"))
15+
generateInputBuilders.set(true)
1216
generateDataBuilders.set(true)
17+
introspection {
18+
endpointUrl.set(envOrProp("KSTREAMLINED_API_ENDPOINT"))
19+
}
1320
}
1421
}
1522

kmp/data-runtime-cloud/src/commonMain/graphql/io/github/reactivecircus/kstreamlined/graphql/schema.graphqls

Lines changed: 319 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ type Query {
418418
"""
419419
feedSources: [FeedSource!]!
420420

421-
_service: _Service
421+
_service: _Service!
422422
}
423423

424424
type TalkingKotlin implements FeedEntry {
@@ -459,6 +459,324 @@ type _Service {
459459
sdl: String!
460460
}
461461

462+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
463+
# noinspection GraphQLTypeRedefinition
464+
type __Directive {
465+
"""
466+
The __Directive type represents a Directive that a server supports.
467+
"""
468+
name: String!
469+
470+
description: String
471+
472+
isRepeatable: Boolean!
473+
474+
locations: [__DirectiveLocation!]!
475+
476+
args(includeDeprecated: Boolean = false): [__InputValue!]!
477+
}
478+
479+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
480+
# noinspection GraphQLTypeRedefinition
481+
"""
482+
An enum describing valid locations where a directive can be placed
483+
"""
484+
enum __DirectiveLocation {
485+
"""
486+
Indicates the directive is valid on queries.
487+
"""
488+
QUERY
489+
490+
"""
491+
Indicates the directive is valid on mutations.
492+
"""
493+
MUTATION
494+
495+
"""
496+
Indicates the directive is valid on subscriptions.
497+
"""
498+
SUBSCRIPTION
499+
500+
"""
501+
Indicates the directive is valid on fields.
502+
"""
503+
FIELD
504+
505+
"""
506+
Indicates the directive is valid on fragment definitions.
507+
"""
508+
FRAGMENT_DEFINITION
509+
510+
"""
511+
Indicates the directive is valid on fragment spreads.
512+
"""
513+
FRAGMENT_SPREAD
514+
515+
"""
516+
Indicates the directive is valid on inline fragments.
517+
"""
518+
INLINE_FRAGMENT
519+
520+
"""
521+
Indicates the directive is valid on variable definitions.
522+
"""
523+
VARIABLE_DEFINITION
524+
525+
"""
526+
Indicates the directive is valid on a schema SDL definition.
527+
"""
528+
SCHEMA
529+
530+
"""
531+
Indicates the directive is valid on a scalar SDL definition.
532+
"""
533+
SCALAR
534+
535+
"""
536+
Indicates the directive is valid on an object SDL definition.
537+
"""
538+
OBJECT
539+
540+
"""
541+
Indicates the directive is valid on a field SDL definition.
542+
"""
543+
FIELD_DEFINITION
544+
545+
"""
546+
Indicates the directive is valid on a field argument SDL definition.
547+
"""
548+
ARGUMENT_DEFINITION
549+
550+
"""
551+
Indicates the directive is valid on an interface SDL definition.
552+
"""
553+
INTERFACE
554+
555+
"""
556+
Indicates the directive is valid on an union SDL definition.
557+
"""
558+
UNION
559+
560+
"""
561+
Indicates the directive is valid on an enum SDL definition.
562+
"""
563+
ENUM
564+
565+
"""
566+
Indicates the directive is valid on an enum value SDL definition.
567+
"""
568+
ENUM_VALUE
569+
570+
"""
571+
Indicates the directive is valid on an input object SDL definition.
572+
"""
573+
INPUT_OBJECT
574+
575+
"""
576+
Indicates the directive is valid on an input object field SDL definition.
577+
"""
578+
INPUT_FIELD_DEFINITION
579+
}
580+
581+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
582+
# noinspection GraphQLTypeRedefinition
583+
type __EnumValue {
584+
name: String!
585+
586+
description: String
587+
588+
isDeprecated: Boolean!
589+
590+
deprecationReason: String
591+
}
592+
593+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
594+
# noinspection GraphQLTypeRedefinition
595+
type __Field {
596+
name: String!
597+
598+
description: String
599+
600+
args(includeDeprecated: Boolean = false): [__InputValue!]!
601+
602+
type: __Type!
603+
604+
isDeprecated: Boolean!
605+
606+
deprecationReason: String
607+
}
608+
609+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
610+
# noinspection GraphQLTypeRedefinition
611+
type __InputValue {
612+
name: String!
613+
614+
description: String
615+
616+
type: __Type!
617+
618+
defaultValue: String
619+
620+
isDeprecated: Boolean
621+
622+
deprecationReason: String
623+
}
624+
625+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
626+
# noinspection GraphQLTypeRedefinition
627+
"""
628+
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.
629+
"""
630+
type __Schema {
631+
description: String
632+
633+
"""
634+
A list of all types supported by this server.
635+
"""
636+
types: [__Type!]!
637+
638+
"""
639+
The type that query operations will be rooted at.
640+
"""
641+
queryType: __Type!
642+
643+
"""
644+
If this server supports mutation, the type that mutation operations will be rooted at.
645+
"""
646+
mutationType: __Type
647+
648+
"""
649+
'A list of all directives supported by this server.
650+
"""
651+
directives: [__Directive!]!
652+
653+
"""
654+
'If this server support subscription, the type that subscription operations will be rooted at.
655+
"""
656+
subscriptionType: __Type
657+
}
658+
659+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
660+
# noinspection GraphQLTypeRedefinition
661+
type __Type {
662+
kind: __TypeKind!
663+
664+
name: String
665+
666+
description: String
667+
668+
fields(includeDeprecated: Boolean = false): [__Field!]
669+
670+
interfaces: [__Type!]
671+
672+
possibleTypes: [__Type!]
673+
674+
enumValues(includeDeprecated: Boolean = false): [__EnumValue!]
675+
676+
inputFields(includeDeprecated: Boolean = false): [__InputValue!]
677+
678+
ofType: __Type
679+
680+
"""
681+
This field is considered experimental because it has not yet been ratified in the graphql specification
682+
"""
683+
isOneOf: Boolean
684+
685+
specifiedByURL: String
686+
687+
specifiedByUrl: String @deprecated(reason: "This legacy name has been replaced by `specifiedByURL`")
688+
}
689+
690+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
691+
# noinspection GraphQLTypeRedefinition
692+
"""
693+
An enum describing what kind of type a given __Type is
694+
"""
695+
enum __TypeKind {
696+
"""
697+
Indicates this type is a scalar. 'specifiedByURL' is a valid field
698+
"""
699+
SCALAR
700+
701+
"""
702+
Indicates this type is an object. `fields` and `interfaces` are valid fields.
703+
"""
704+
OBJECT
705+
706+
"""
707+
Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.
708+
"""
709+
INTERFACE
710+
711+
"""
712+
Indicates this type is a union. `possibleTypes` is a valid field.
713+
"""
714+
UNION
715+
716+
"""
717+
Indicates this type is an enum. `enumValues` is a valid field.
718+
"""
719+
ENUM
720+
721+
"""
722+
Indicates this type is an input object. `inputFields` is a valid field.
723+
"""
724+
INPUT_OBJECT
725+
726+
"""
727+
Indicates this type is a list. `ofType` is a valid field.
728+
"""
729+
LIST
730+
731+
"""
732+
Indicates this type is a non-null. `ofType` is a valid field.
733+
"""
734+
NON_NULL
735+
}
736+
737+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
738+
# noinspection GraphQLTypeRedefinition
739+
"""
740+
Directs the executor to include this field or fragment only when the `if` argument is true
741+
"""
742+
directive @include ("Included when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT
743+
744+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
745+
# noinspection GraphQLTypeRedefinition
746+
"""
747+
Directs the executor to skip this field or fragment when the `if` argument is true.
748+
"""
749+
directive @skip ("Skipped when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT
750+
751+
directive @extends on OBJECT|INTERFACE
752+
753+
directive @external on FIELD_DEFINITION
754+
755+
directive @key (fields: _FieldSet!) repeatable on OBJECT|INTERFACE
756+
757+
directive @provides (fields: _FieldSet!) on FIELD_DEFINITION
758+
759+
directive @requires (fields: _FieldSet!) on FIELD_DEFINITION
760+
761+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
762+
# noinspection GraphQLTypeRedefinition
763+
"""
764+
Marks the field, argument, input field or enum value as deprecated
765+
"""
766+
directive @deprecated ("The reason for the deprecation" reason: String = "No longer supported") on FIELD_DEFINITION|ARGUMENT_DEFINITION|ENUM_VALUE|INPUT_FIELD_DEFINITION
767+
768+
# See https://github.com/JetBrains/js-graphql-intellij-plugin/issues/665
769+
# noinspection GraphQLTypeRedefinition
770+
"""
771+
Exposes a URL that specifies the behaviour of this scalar.
772+
"""
773+
directive @specifiedBy ("The URL that specifies the behaviour of this scalar." url: String!) on SCALAR
774+
775+
"""
776+
Indicates an Input Object is a OneOf Input Object.
777+
"""
778+
directive @oneOf on INPUT_OBJECT
779+
462780
schema {
463781
query: Query
464782
}

kmp/data-runtime-cloud/src/commonMain/kotlin/io/github/reactivecircus/kstreamlined/kmp/data/feed/CloudFeedRepo.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CloudFeedRepo(private val apolloClient: ApolloClient) : FeedRepo {
1818
apolloClient.query(FeedSourcesQuery())
1919
.defaultFetchPolicy(refresh)
2020
.execute()
21-
.dataAssertNoErrors.feedSources
21+
.dataOrThrow().feedSources
2222
}.onFailure {
2323
Logger.w("Query failed", it)
2424
}.getOrThrow().map { it.toModel() }
@@ -36,7 +36,7 @@ class CloudFeedRepo(private val apolloClient: ApolloClient) : FeedRepo {
3636
)
3737
.defaultFetchPolicy(refresh)
3838
.execute()
39-
.dataAssertNoErrors.feedEntries
39+
.dataOrThrow().feedEntries
4040
}.onFailure {
4141
Logger.w("Query failed", it)
4242
}.getOrThrow().map { it.toModel() }

0 commit comments

Comments
 (0)