Paddy O'Brien
09/14/2022, 8:15 PMPaddy O'Brien
09/15/2022, 3:06 AMPaddy O'Brien
09/15/2022, 2:13 PMextra.graphqls
file
• It lives next to my schema.json
• Its contents are
# Remap names that will result in collisions, in particular when exported to Swift
extend scalar URL @targetName(name: "URL_")
• Definition in the schema is
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "URL",
"ofType": null
}
},
• I cleared the gradle cache
• I manually deleted the generated apollo sources
• in kotlin im still getting
public class URL {
public companion object {
public val type: CustomScalarType = CustomScalarType("URL", "kotlin.String")
}
}
• in Swift im still getting
__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("URL")))
@interface NativeSyncURL : NativeSyncBase
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
@property (class, readonly, getter=companion) NativeSyncURLCompanion *companion __attribute__((swift_name("companion")));
@end;
• build.gradle
service("admin") {
useVersion2Compat("com.admin")
schemaFile = file("src/commonMain/graphql/admin/schema.json")
sourceFolder.set("admin")
mapScalarToKotlinString("URL")
}
Paddy O'Brien
09/15/2022, 2:14 PMPaddy O'Brien
09/15/2022, 2:14 PMPaddy O'Brien
09/15/2022, 2:14 PMbod
09/15/2022, 2:38 PMURL_
Paddy O'Brien
09/15/2022, 2:40 PMPaddy O'Brien
09/15/2022, 2:42 PMuseVersion2Compat
or the fact that we use schema.json
and not schema.graphqls
as mentioned in the issue?bod
09/15/2022, 2:44 PM.graphqls
, it is a bit nicer to work with! ./gradlew convertApolloSchema --from=src/main/graphql/schema.json --to=src/main/graphql/schema.graphqls
)bod
09/15/2022, 2:50 PMschemaFile =
, in that case the extra.graphqls
is not automatically taken into account. You need to include it manually:
schemaFiles.setFrom(setOf(file("src/main/graphql/schema.json"), file(file("src/main/graphql/extra.graphqls"))))
Paddy O'Brien
09/15/2022, 3:12 PM10:11 a.m. Gradle sync failed: No signature of method: build_a7r62ca1lbwotzkp5jpoglq3a.apollo() is applicable for argument types: (build_a7r62ca1lbwotzkp5jpoglq3a$_run_closure2) values: [build_a7r62ca1lbwotzkp5jpoglq3a$_run_closure2@19625293]
Possible solutions: apply(groovy.lang.Closure), apply(java.util.Map), apply(groovy.lang.Closure), apply(java.util.Map), split(groovy.lang.Closure) (34 s 133 ms)
bod
09/15/2022, 3:13 PMsetOf
exist in Groovy?Paddy O'Brien
09/15/2022, 3:14 PMfile(
in your example, I assumed the file(file(
was a typobod
09/15/2022, 3:14 PMPaddy O'Brien
09/15/2022, 3:15 PMPaddy O'Brien
09/15/2022, 3:16 PMset
Paddy O'Brien
09/15/2022, 3:18 PMbod
09/15/2022, 3:19 PMschemaFiles.setFrom(files("src/main/graphql/schema.json", "src/main/graphql/extra.graphqls"))
Paddy O'Brien
09/15/2022, 3:30 PMbod
09/15/2022, 3:31 PM