Skip to content

Commit 1b04d48

Browse files
author
Dan Stenmark
committed
Added type annotation for fragmentDefinition
1 parent 06873be commit 1b04d48

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

packages/apollo-codegen-swift/src/__tests__/__snapshots__/codeGeneration.ts.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ exports[`Swift code generation #initializerDeclarationForProperties() should gen
916916
exports[`Swift code generation #structDeclarationForFragment() should generate a struct declaration for a fragment that includes a fragment spread 1`] = `
917917
"public struct HeroDetails: GraphQLFragment {
918918
/// The raw GraphQL definition of this fragment.
919-
public static let fragmentDefinition =
919+
public static let fragmentDefinition: String =
920920
\\"\\"\\"
921921
fragment HeroDetails on Character {
922922
name
@@ -996,7 +996,7 @@ exports[`Swift code generation #structDeclarationForFragment() should generate a
996996
exports[`Swift code generation #structDeclarationForFragment() should generate a struct declaration for a fragment with a concrete type condition 1`] = `
997997
"public struct DroidDetails: GraphQLFragment {
998998
/// The raw GraphQL definition of this fragment.
999-
public static let fragmentDefinition =
999+
public static let fragmentDefinition: String =
10001000
\\"\\"\\"
10011001
fragment DroidDetails on Droid {
10021002
name
@@ -1046,7 +1046,7 @@ exports[`Swift code generation #structDeclarationForFragment() should generate a
10461046
exports[`Swift code generation #structDeclarationForFragment() should generate a struct declaration for a fragment with a subselection 1`] = `
10471047
"public struct HeroDetails: GraphQLFragment {
10481048
/// The raw GraphQL definition of this fragment.
1049-
public static let fragmentDefinition =
1049+
public static let fragmentDefinition: String =
10501050
\\"\\"\\"
10511051
fragment HeroDetails on Character {
10521052
name
@@ -1134,7 +1134,7 @@ exports[`Swift code generation #structDeclarationForFragment() should generate a
11341134
exports[`Swift code generation #structDeclarationForFragment() should generate a struct declaration for a fragment with an abstract type condition 1`] = `
11351135
"public struct HeroDetails: GraphQLFragment {
11361136
/// The raw GraphQL definition of this fragment.
1137-
public static let fragmentDefinition =
1137+
public static let fragmentDefinition: String =
11381138
\\"\\"\\"
11391139
fragment HeroDetails on Character {
11401140
name

packages/apollo-codegen-swift/src/codeGeneration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ export class SwiftAPIGenerator extends SwiftGenerator<CompilerContext> {
346346
() => {
347347
if (source) {
348348
this.comment("The raw GraphQL definition of this fragment.");
349-
this.printOnNewline(swift`public static let fragmentDefinition =`);
349+
this.printOnNewline(
350+
swift`public static let fragmentDefinition: String =`
351+
);
350352
this.withIndent(() => {
351353
this.multilineString(source, suppressMultilineStringLiterals);
352354
});

0 commit comments

Comments
 (0)