@@ -4,6 +4,7 @@ exports[`Swift code generation #classDeclarationForOperation() should generate a
44"public final class CreateReviewMutation: GraphQLMutation {
55 public let operationDefinition =
66 \\" mutation CreateReview($episode: Episode) {\\\\ n createReview(episode: $episode, review: {stars: 5, commentary: \\\\\\ " Wow ! \\\\\\" }) {\\\\ n stars\\\\ n commentary\\\\ n }\\\\ n}\\ "
7+ public let operationName : String ? = \\" CreateReview\\ "
78
89 public var episode : Episode ?
910
@@ -87,6 +88,7 @@ exports[`Swift code generation #classDeclarationForOperation() should generate a
8788"public final class HeroQuery: GraphQLQuery {
8889 public let operationDefinition =
8990 \\" query Hero {\\\\ n hero {\\\\ n ... on Droid {\\\\ n ...HeroDetails\\\\ n }\\\\ n }\\\\ n}\\ "
91+ public let operationName : String ? = \\" Hero\\ "
9092
9193 public var queryDocument : String { return operationDefinition.appending(HeroDetails .fragmentDefinition ) }
9294
@@ -217,6 +219,7 @@ exports[`Swift code generation #classDeclarationForOperation() should generate a
217219"public final class HeroQuery: GraphQLQuery {
218220 public let operationDefinition =
219221 \\" query Hero {\\\\ n hero {\\\\ n ...DroidDetails\\\\ n }\\\\ n}\\ "
222+ public let operationName : String ? = \\" Hero\\ "
220223
221224 public var queryDocument : String { return operationDefinition.appending(DroidDetails .fragmentDefinition ) }
222225
@@ -375,6 +378,7 @@ exports[`Swift code generation #classDeclarationForOperation() should generate a
375378"public final class HeroQuery: GraphQLQuery {
376379 public let operationDefinition =
377380 \\" query Hero {\\\\ n hero {\\\\ n ...HeroDetails\\\\ n }\\\\ n}\\ "
381+ public let operationName : String ? = \\" Hero\\ "
378382
379383 public var queryDocument : String { return operationDefinition.appending(HeroDetails .fragmentDefinition ) }
380384
@@ -472,6 +476,7 @@ exports[`Swift code generation #classDeclarationForOperation() should generate a
472476"public final class HeroNameQuery: GraphQLQuery {
473477 public let operationDefinition =
474478 \\" query HeroName($episode: Episode) {\\\\ n hero(episode: $episode) {\\\\ n name\\\\ n }\\\\ n}\\ "
479+ public let operationName : String ? = \\" HeroName\\ "
475480
476481 public var episode : Episode ?
477482
@@ -548,6 +553,7 @@ exports[`Swift code generation #classDeclarationForOperation() should generate a
548553"public final class HeroQuery: GraphQLQuery {
549554 public let operationDefinition =
550555 \\" query Hero {\\\\ n hero {\\\\ n ...HeroDetails\\\\ n }\\\\ n}\\ "
556+ public let operationName : String ? = \\" Hero\\ "
551557
552558 public let operationIdentifier : String ? = \\" 90d0d674eb6a7b33776f63200d6cec3d09f881247c360a2ac9a29037a02210c4\\ "
553559
@@ -643,6 +649,79 @@ exports[`Swift code generation #classDeclarationForOperation() should generate a
643649}"
644650`;
645651
652+ exports [` Swift code generation #classDeclarationForOperation() should generate a operationName matching operation name case 1` ] = `
653+ "public final class CreateEpReviewMutation: GraphQLMutation {
654+ public let operationDefinition =
655+ \\" mutation createEPReview($episode: Episode) {\\\\ n createReview(episode: $episode, review: {stars: 5, commentary: \\\\\\ " Wow ! \\\\\\" }) {\\\\ n stars\\\\ n }\\\\ n}\\ "
656+ public let operationName : String ? = \\" createEPReview\\ "
657+
658+ public var episode : Episode ?
659+
660+ public init (episode : Episode ? = nil ) {
661+ self.episode = episode
662+ }
663+
664+ public var variables : GraphQLMap ? {
665+ return [\\" episode\\ " : episode ]
666+ }
667+
668+ public struct Data : GraphQLSelectionSet {
669+ public static let possibleTypes = [\\"Mutation\\"]
670+
671+ public static let selections: [GraphQLSelection ] = [
672+ GraphQLField (\\" createReview\\ " , arguments : [\\" episode\\ " : GraphQLVariable (\\" episode\\ " ), \\" review\\ " : [\\" stars\\ " : 5 , \\" commentary\\ " : \\" Wow!\\ " ]], type : .object (CreateReview .selections )),
673+ ]
674+
675+ public private (set ) var resultMap : ResultMap
676+
677+ public init (unsafeResultMap : ResultMap ) {
678+ self.resultMap = unsafeResultMap
679+ }
680+
681+ public init (createReview : CreateReview ? = nil ) {
682+ self.init(unsafeResultMap : [\\" __typename\\ " : \\" Mutation\\ " , \\" createReview\\ " : createReview .flatMap { (value : CreateReview ) -> ResultMap in value.resultMap }])
683+ }
684+
685+ public var createReview : CreateReview ? {
686+ get {
687+ return (resultMap [\\"createReview \\"] as ? ResultMap ).flatMap { CreateReview (unsafeResultMap : $0 ) }
688+ }
689+ set {
690+ resultMap.updateValue(newValue ? .resultMap , forKey : \\" createReview\\ " )
691+ }
692+ }
693+
694+ public struct CreateReview : GraphQLSelectionSet {
695+ public static let possibleTypes = [\\"Review\\"]
696+
697+ public static let selections: [GraphQLSelection ] = [
698+ GraphQLField (\\" stars\\ " , type : .nonNull (.scalar (Int .self ))),
699+ ]
700+
701+ public private (set ) var resultMap : ResultMap
702+
703+ public init (unsafeResultMap : ResultMap ) {
704+ self.resultMap = unsafeResultMap
705+ }
706+
707+ public init (stars : Int ) {
708+ self.init(unsafeResultMap : [\\" __typename\\ " : \\" Review\\ " , \\" stars\\ " : stars ])
709+ }
710+
711+ // / The number of stars this review gave, 1-5
712+ public var stars : Int {
713+ get {
714+ return resultMap[\\"stars\\"]! as! Int
715+ }
716+ set {
717+ resultMap.updateValue(newValue , forKey : \\" stars\\ " )
718+ }
719+ }
720+ }
721+ }
722+ }"
723+ `;
724+
646725exports [` Swift code generation #initializerDeclarationForProperties() should generate initializer for a property 1` ] = `
647726"public init(episode: Episode) {
648727 self .episode = episode
0 commit comments