@@ -52,7 +52,9 @@ extension GraphQLScalars {
5252 case . string:
5353 return map
5454 default :
55- throw GraphQLError ( message: " EmailAddress cannot represent non-string value: \( map) " )
55+ throw GraphQLError (
56+ message: " EmailAddress cannot represent non-string value: \( map) "
57+ )
5658 }
5759 }
5860
@@ -89,7 +91,9 @@ struct User: GraphQLGenerated.User {
8991 // Can't use @graphQLResolver macro because we must convert from String to GraphQLScalars.EmailAddress
9092
9193 let email : String
92- func email( context _: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws -> GraphQLScalars . EmailAddress {
94+ func email( context _: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws
95+ -> GraphQLScalars . EmailAddress
96+ {
9397 return . init( email: email)
9498 }
9599}
@@ -99,7 +103,10 @@ struct Contact: GraphQLGenerated.Contact {
99103
100104 /// Required implementations
101105 let email : String
102- func email( context _: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws -> GraphQLScalars . EmailAddress {
106+ func email(
107+ context _: GraphQLContext ,
108+ info _: GraphQL . GraphQLResolveInfo
109+ ) async throws -> GraphQLScalars . EmailAddress {
103110 return . init( email: email)
104111 }
105112}
@@ -113,37 +120,63 @@ struct Post: GraphQLGenerated.Post {
113120
114121 /// Required implementations
115122 let authorId : String
116- func author( context: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws -> any GraphQLGenerated . User {
123+ func author(
124+ context: GraphQLContext ,
125+ info _: GraphQL . GraphQLResolveInfo
126+ ) async throws -> any GraphQLGenerated . User {
117127 return context. users [ authorId] !
118128 }
119129}
120130
121131struct Query : GraphQLGenerated . Query {
122132 /// Required implementations
123- static func user( id: String , context: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws -> ( any GraphQLGenerated . User ) ? {
133+ static func user(
134+ id: String ,
135+ context: GraphQLContext ,
136+ info _: GraphQL . GraphQLResolveInfo
137+ ) async throws -> ( any GraphQLGenerated . User ) ? {
124138 return context. users [ id]
125139 }
126140
127- static func users( context: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws -> [ any GraphQLGenerated . User ] {
141+ static func users(
142+ context: GraphQLContext ,
143+ info _: GraphQL . GraphQLResolveInfo
144+ ) async throws -> [ any GraphQLGenerated . User ] {
128145 return context. users. values. map { $0 as any GraphQLGenerated . User }
129146 }
130147
131- static func post( id: String , context: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws -> ( any GraphQLGenerated . Post ) ? {
148+ static func post(
149+ id: String ,
150+ context: GraphQLContext ,
151+ info _: GraphQL . GraphQLResolveInfo
152+ ) async throws -> ( any GraphQLGenerated . Post ) ? {
132153 return context. posts [ id]
133154 }
134155
135- static func posts( limit _: Int ? , context: GraphQLContext , info _: GraphQL . GraphQLResolveInfo ) async throws -> [ any GraphQLGenerated . Post ] {
156+ static func posts(
157+ limit _: Int ? ,
158+ context: GraphQLContext ,
159+ info _: GraphQL . GraphQLResolveInfo
160+ ) async throws -> [ any GraphQLGenerated . Post ] {
136161 return context. posts. values. map { $0 as any GraphQLGenerated . Post }
137162 }
138163
139- static func userOrPost( id: String , context: GraphQLContext , info _: GraphQLResolveInfo ) async throws -> ( any GraphQLGenerated . UserOrPost ) ? {
164+ static func userOrPost(
165+ id: String ,
166+ context: GraphQLContext ,
167+ info _: GraphQLResolveInfo
168+ ) async throws -> ( any GraphQLGenerated . UserOrPost ) ? {
140169 return context. users [ id] ?? context. posts [ id]
141170 }
142171}
143172
144173struct Mutation : GraphQLGenerated . Mutation {
145174 /// Required implementations
146- static func upsertUser( userInfo: GraphQLGenerated . UserInfo , context: GraphQLContext , info _: GraphQLResolveInfo ) -> any GraphQLGenerated . User {
175+ static func upsertUser(
176+ userInfo: GraphQLGenerated . UserInfo ,
177+ context: GraphQLContext ,
178+ info _: GraphQLResolveInfo
179+ ) -> any GraphQLGenerated . User {
147180 let user = User (
148181 id: userInfo. id,
149182 name: userInfo. name,
@@ -158,7 +191,11 @@ struct Mutation: GraphQLGenerated.Mutation {
158191
159192struct Subscription : GraphQLGenerated . Subscription {
160193 /// Required implementations
161- static func watchUser( id: String , context: GraphQLContext , info _: GraphQLResolveInfo ) async throws -> AnyAsyncSequence < ( any GraphQLGenerated . User ) ? > {
194+ static func watchUser(
195+ id: String ,
196+ context: GraphQLContext ,
197+ info _: GraphQLResolveInfo
198+ ) async throws -> AnyAsyncSequence < ( any GraphQLGenerated . User ) ? > {
162199 return AsyncStream < ( any GraphQLGenerated . User ) ? > { continuation in
163200 context. onTriggerWatch = { [ weak context] in
164201 continuation. yield ( context? . users [ id] )
0 commit comments