ProtobufCodeGeneratorTests.swift 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  1. /*
  2. * Copyright 2024, gRPC Authors All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import GRPCCodeGen
  17. import GRPCProtobufCodeGen
  18. import SwiftProtobufPluginLibrary
  19. import Testing
  20. struct ProtobufCodeGeneratorTests {
  21. @Suite("Self-contained service (test-service.proto)")
  22. struct TestService: UsesDescriptorSet {
  23. static let descriptorSetName = "test-service"
  24. static let fileDescriptorName = "test-service"
  25. @Test("Generate", arguments: [CodeGenerator.Config.AccessLevel.internal])
  26. func generate(accessLevel: GRPCCodeGen.CodeGenerator.Config.AccessLevel) throws {
  27. let generator = ProtobufCodeGenerator(
  28. config: CodeGenerator.Config(
  29. accessLevel: accessLevel,
  30. accessLevelOnImports: false,
  31. client: true,
  32. server: true,
  33. indentation: 2
  34. )
  35. )
  36. let access: String
  37. switch accessLevel {
  38. case .public:
  39. access = "public"
  40. case .internal:
  41. access = "internal"
  42. case .package:
  43. access = "package"
  44. default:
  45. fatalError()
  46. }
  47. let generated = try generator.generateCode(
  48. fileDescriptor: Self.fileDescriptor,
  49. protoFileModuleMappings: ProtoFileToModuleMappings(),
  50. extraModuleImports: []
  51. )
  52. let expected = """
  53. /// Leading trivia.
  54. // DO NOT EDIT.
  55. // swift-format-ignore-file
  56. //
  57. // Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
  58. // Source: test-service.proto
  59. //
  60. // For information on using the generated types, please see the documentation:
  61. // https://github.com/grpc/grpc-swift
  62. import GRPCCore
  63. import GRPCProtobuf
  64. // MARK: - test.TestService
  65. /// Namespace containing generated types for the "test.TestService" service.
  66. \(access) enum Test_TestService {
  67. /// Service descriptor for the "test.TestService" service.
  68. \(access) static let descriptor = GRPCCore.ServiceDescriptor(fullyQualifiedService: "test.TestService")
  69. /// Namespace for method metadata.
  70. \(access) enum Method {
  71. /// Namespace for "Unary" metadata.
  72. \(access) enum Unary {
  73. /// Request type for "Unary".
  74. \(access) typealias Input = Test_TestInput
  75. /// Response type for "Unary".
  76. \(access) typealias Output = Test_TestOutput
  77. /// Descriptor for "Unary".
  78. \(access) static let descriptor = GRPCCore.MethodDescriptor(
  79. service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "test.TestService"),
  80. method: "Unary"
  81. )
  82. }
  83. /// Namespace for "ClientStreaming" metadata.
  84. \(access) enum ClientStreaming {
  85. /// Request type for "ClientStreaming".
  86. \(access) typealias Input = Test_TestInput
  87. /// Response type for "ClientStreaming".
  88. \(access) typealias Output = Test_TestOutput
  89. /// Descriptor for "ClientStreaming".
  90. \(access) static let descriptor = GRPCCore.MethodDescriptor(
  91. service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "test.TestService"),
  92. method: "ClientStreaming"
  93. )
  94. }
  95. /// Namespace for "ServerStreaming" metadata.
  96. \(access) enum ServerStreaming {
  97. /// Request type for "ServerStreaming".
  98. \(access) typealias Input = Test_TestInput
  99. /// Response type for "ServerStreaming".
  100. \(access) typealias Output = Test_TestOutput
  101. /// Descriptor for "ServerStreaming".
  102. \(access) static let descriptor = GRPCCore.MethodDescriptor(
  103. service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "test.TestService"),
  104. method: "ServerStreaming"
  105. )
  106. }
  107. /// Namespace for "BidirectionalStreaming" metadata.
  108. \(access) enum BidirectionalStreaming {
  109. /// Request type for "BidirectionalStreaming".
  110. \(access) typealias Input = Test_TestInput
  111. /// Response type for "BidirectionalStreaming".
  112. \(access) typealias Output = Test_TestOutput
  113. /// Descriptor for "BidirectionalStreaming".
  114. \(access) static let descriptor = GRPCCore.MethodDescriptor(
  115. service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "test.TestService"),
  116. method: "BidirectionalStreaming"
  117. )
  118. }
  119. /// Descriptors for all methods in the "test.TestService" service.
  120. \(access) static let descriptors: [GRPCCore.MethodDescriptor] = [
  121. Unary.descriptor,
  122. ClientStreaming.descriptor,
  123. ServerStreaming.descriptor,
  124. BidirectionalStreaming.descriptor
  125. ]
  126. }
  127. }
  128. extension GRPCCore.ServiceDescriptor {
  129. /// Service descriptor for the "test.TestService" service.
  130. \(access) static let test_TestService = GRPCCore.ServiceDescriptor(fullyQualifiedService: "test.TestService")
  131. }
  132. // MARK: test.TestService (server)
  133. extension Test_TestService {
  134. /// Streaming variant of the service protocol for the "test.TestService" service.
  135. ///
  136. /// This protocol is the lowest-level of the service protocols generated for this service
  137. /// giving you the most flexibility over the implementation of your service. This comes at
  138. /// the cost of more verbose and less strict APIs. Each RPC requires you to implement it in
  139. /// terms of a request stream and response stream. Where only a single request or response
  140. /// message is expected, you are responsible for enforcing this invariant is maintained.
  141. ///
  142. /// Where possible, prefer using the stricter, less-verbose ``ServiceProtocol``
  143. /// or ``SimpleServiceProtocol`` instead.
  144. ///
  145. /// > Source IDL Documentation:
  146. /// >
  147. /// > Service docs.
  148. \(access) protocol StreamingServiceProtocol: GRPCCore.RegistrableRPCService {
  149. /// Handle the "Unary" method.
  150. ///
  151. /// > Source IDL Documentation:
  152. /// >
  153. /// > Unary docs.
  154. ///
  155. /// - Parameters:
  156. /// - request: A streaming request of `Test_TestInput` messages.
  157. /// - context: Context providing information about the RPC.
  158. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  159. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  160. /// to an internal error.
  161. /// - Returns: A streaming response of `Test_TestOutput` messages.
  162. func unary(
  163. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  164. context: GRPCCore.ServerContext
  165. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput>
  166. /// Handle the "ClientStreaming" method.
  167. ///
  168. /// > Source IDL Documentation:
  169. /// >
  170. /// > Client streaming docs.
  171. ///
  172. /// - Parameters:
  173. /// - request: A streaming request of `Test_TestInput` messages.
  174. /// - context: Context providing information about the RPC.
  175. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  176. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  177. /// to an internal error.
  178. /// - Returns: A streaming response of `Test_TestOutput` messages.
  179. func clientStreaming(
  180. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  181. context: GRPCCore.ServerContext
  182. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput>
  183. /// Handle the "ServerStreaming" method.
  184. ///
  185. /// > Source IDL Documentation:
  186. /// >
  187. /// > Server streaming docs.
  188. ///
  189. /// - Parameters:
  190. /// - request: A streaming request of `Test_TestInput` messages.
  191. /// - context: Context providing information about the RPC.
  192. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  193. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  194. /// to an internal error.
  195. /// - Returns: A streaming response of `Test_TestOutput` messages.
  196. func serverStreaming(
  197. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  198. context: GRPCCore.ServerContext
  199. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput>
  200. /// Handle the "BidirectionalStreaming" method.
  201. ///
  202. /// > Source IDL Documentation:
  203. /// >
  204. /// > Bidirectional streaming docs.
  205. ///
  206. /// - Parameters:
  207. /// - request: A streaming request of `Test_TestInput` messages.
  208. /// - context: Context providing information about the RPC.
  209. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  210. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  211. /// to an internal error.
  212. /// - Returns: A streaming response of `Test_TestOutput` messages.
  213. func bidirectionalStreaming(
  214. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  215. context: GRPCCore.ServerContext
  216. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput>
  217. }
  218. /// Service protocol for the "test.TestService" service.
  219. ///
  220. /// This protocol is higher level than ``StreamingServiceProtocol`` but lower level than
  221. /// the ``SimpleServiceProtocol``, it provides access to request and response metadata and
  222. /// trailing response metadata. If you don't need these then consider using
  223. /// the ``SimpleServiceProtocol``. If you need fine grained control over your RPCs then
  224. /// use ``StreamingServiceProtocol``.
  225. ///
  226. /// > Source IDL Documentation:
  227. /// >
  228. /// > Service docs.
  229. \(access) protocol ServiceProtocol: Test_TestService.StreamingServiceProtocol {
  230. /// Handle the "Unary" method.
  231. ///
  232. /// > Source IDL Documentation:
  233. /// >
  234. /// > Unary docs.
  235. ///
  236. /// - Parameters:
  237. /// - request: A request containing a single `Test_TestInput` message.
  238. /// - context: Context providing information about the RPC.
  239. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  240. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  241. /// to an internal error.
  242. /// - Returns: A response containing a single `Test_TestOutput` message.
  243. func unary(
  244. request: GRPCCore.ServerRequest<Test_TestInput>,
  245. context: GRPCCore.ServerContext
  246. ) async throws -> GRPCCore.ServerResponse<Test_TestOutput>
  247. /// Handle the "ClientStreaming" method.
  248. ///
  249. /// > Source IDL Documentation:
  250. /// >
  251. /// > Client streaming docs.
  252. ///
  253. /// - Parameters:
  254. /// - request: A streaming request of `Test_TestInput` messages.
  255. /// - context: Context providing information about the RPC.
  256. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  257. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  258. /// to an internal error.
  259. /// - Returns: A response containing a single `Test_TestOutput` message.
  260. func clientStreaming(
  261. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  262. context: GRPCCore.ServerContext
  263. ) async throws -> GRPCCore.ServerResponse<Test_TestOutput>
  264. /// Handle the "ServerStreaming" method.
  265. ///
  266. /// > Source IDL Documentation:
  267. /// >
  268. /// > Server streaming docs.
  269. ///
  270. /// - Parameters:
  271. /// - request: A request containing a single `Test_TestInput` message.
  272. /// - context: Context providing information about the RPC.
  273. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  274. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  275. /// to an internal error.
  276. /// - Returns: A streaming response of `Test_TestOutput` messages.
  277. func serverStreaming(
  278. request: GRPCCore.ServerRequest<Test_TestInput>,
  279. context: GRPCCore.ServerContext
  280. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput>
  281. /// Handle the "BidirectionalStreaming" method.
  282. ///
  283. /// > Source IDL Documentation:
  284. /// >
  285. /// > Bidirectional streaming docs.
  286. ///
  287. /// - Parameters:
  288. /// - request: A streaming request of `Test_TestInput` messages.
  289. /// - context: Context providing information about the RPC.
  290. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  291. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  292. /// to an internal error.
  293. /// - Returns: A streaming response of `Test_TestOutput` messages.
  294. func bidirectionalStreaming(
  295. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  296. context: GRPCCore.ServerContext
  297. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput>
  298. }
  299. /// Simple service protocol for the "test.TestService" service.
  300. ///
  301. /// This is the highest level protocol for the service. The API is the easiest to use but
  302. /// doesn't provide access to request or response metadata. If you need access to these
  303. /// then use ``ServiceProtocol`` instead.
  304. ///
  305. /// > Source IDL Documentation:
  306. /// >
  307. /// > Service docs.
  308. \(access) protocol SimpleServiceProtocol: Test_TestService.ServiceProtocol {
  309. /// Handle the "Unary" method.
  310. ///
  311. /// > Source IDL Documentation:
  312. /// >
  313. /// > Unary docs.
  314. ///
  315. /// - Parameters:
  316. /// - request: A `Test_TestInput` message.
  317. /// - context: Context providing information about the RPC.
  318. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  319. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  320. /// to an internal error.
  321. /// - Returns: A `Test_TestOutput` to respond with.
  322. func unary(
  323. request: Test_TestInput,
  324. context: GRPCCore.ServerContext
  325. ) async throws -> Test_TestOutput
  326. /// Handle the "ClientStreaming" method.
  327. ///
  328. /// > Source IDL Documentation:
  329. /// >
  330. /// > Client streaming docs.
  331. ///
  332. /// - Parameters:
  333. /// - request: A stream of `Test_TestInput` messages.
  334. /// - context: Context providing information about the RPC.
  335. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  336. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  337. /// to an internal error.
  338. /// - Returns: A `Test_TestOutput` to respond with.
  339. func clientStreaming(
  340. request: GRPCCore.RPCAsyncSequence<Test_TestInput, any Swift.Error>,
  341. context: GRPCCore.ServerContext
  342. ) async throws -> Test_TestOutput
  343. /// Handle the "ServerStreaming" method.
  344. ///
  345. /// > Source IDL Documentation:
  346. /// >
  347. /// > Server streaming docs.
  348. ///
  349. /// - Parameters:
  350. /// - request: A `Test_TestInput` message.
  351. /// - response: A response stream of `Test_TestOutput` messages.
  352. /// - context: Context providing information about the RPC.
  353. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  354. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  355. /// to an internal error.
  356. func serverStreaming(
  357. request: Test_TestInput,
  358. response: GRPCCore.RPCWriter<Test_TestOutput>,
  359. context: GRPCCore.ServerContext
  360. ) async throws
  361. /// Handle the "BidirectionalStreaming" method.
  362. ///
  363. /// > Source IDL Documentation:
  364. /// >
  365. /// > Bidirectional streaming docs.
  366. ///
  367. /// - Parameters:
  368. /// - request: A stream of `Test_TestInput` messages.
  369. /// - response: A response stream of `Test_TestOutput` messages.
  370. /// - context: Context providing information about the RPC.
  371. /// - Throws: Any error which occurred during the processing of the request. Thrown errors
  372. /// of type `RPCError` are mapped to appropriate statuses. All other errors are converted
  373. /// to an internal error.
  374. func bidirectionalStreaming(
  375. request: GRPCCore.RPCAsyncSequence<Test_TestInput, any Swift.Error>,
  376. response: GRPCCore.RPCWriter<Test_TestOutput>,
  377. context: GRPCCore.ServerContext
  378. ) async throws
  379. }
  380. }
  381. // Default implementation of 'registerMethods(with:)'.
  382. extension Test_TestService.StreamingServiceProtocol {
  383. \(access) func registerMethods<Transport>(with router: inout GRPCCore.RPCRouter<Transport>) where Transport: GRPCCore.ServerTransport {
  384. router.registerHandler(
  385. forMethod: Test_TestService.Method.Unary.descriptor,
  386. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestInput>(),
  387. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestOutput>(),
  388. handler: { request, context in
  389. try await self.unary(
  390. request: request,
  391. context: context
  392. )
  393. }
  394. )
  395. router.registerHandler(
  396. forMethod: Test_TestService.Method.ClientStreaming.descriptor,
  397. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestInput>(),
  398. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestOutput>(),
  399. handler: { request, context in
  400. try await self.clientStreaming(
  401. request: request,
  402. context: context
  403. )
  404. }
  405. )
  406. router.registerHandler(
  407. forMethod: Test_TestService.Method.ServerStreaming.descriptor,
  408. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestInput>(),
  409. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestOutput>(),
  410. handler: { request, context in
  411. try await self.serverStreaming(
  412. request: request,
  413. context: context
  414. )
  415. }
  416. )
  417. router.registerHandler(
  418. forMethod: Test_TestService.Method.BidirectionalStreaming.descriptor,
  419. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestInput>(),
  420. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestOutput>(),
  421. handler: { request, context in
  422. try await self.bidirectionalStreaming(
  423. request: request,
  424. context: context
  425. )
  426. }
  427. )
  428. }
  429. }
  430. // Default implementation of streaming methods from 'StreamingServiceProtocol'.
  431. extension Test_TestService.ServiceProtocol {
  432. \(access) func unary(
  433. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  434. context: GRPCCore.ServerContext
  435. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput> {
  436. let response = try await self.unary(
  437. request: GRPCCore.ServerRequest(stream: request),
  438. context: context
  439. )
  440. return GRPCCore.StreamingServerResponse(single: response)
  441. }
  442. \(access) func clientStreaming(
  443. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  444. context: GRPCCore.ServerContext
  445. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput> {
  446. let response = try await self.clientStreaming(
  447. request: request,
  448. context: context
  449. )
  450. return GRPCCore.StreamingServerResponse(single: response)
  451. }
  452. \(access) func serverStreaming(
  453. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  454. context: GRPCCore.ServerContext
  455. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput> {
  456. let response = try await self.serverStreaming(
  457. request: GRPCCore.ServerRequest(stream: request),
  458. context: context
  459. )
  460. return response
  461. }
  462. }
  463. // Default implementation of methods from 'ServiceProtocol'.
  464. extension Test_TestService.SimpleServiceProtocol {
  465. \(access) func unary(
  466. request: GRPCCore.ServerRequest<Test_TestInput>,
  467. context: GRPCCore.ServerContext
  468. ) async throws -> GRPCCore.ServerResponse<Test_TestOutput> {
  469. return GRPCCore.ServerResponse<Test_TestOutput>(
  470. message: try await self.unary(
  471. request: request.message,
  472. context: context
  473. ),
  474. metadata: [:]
  475. )
  476. }
  477. \(access) func clientStreaming(
  478. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  479. context: GRPCCore.ServerContext
  480. ) async throws -> GRPCCore.ServerResponse<Test_TestOutput> {
  481. return GRPCCore.ServerResponse<Test_TestOutput>(
  482. message: try await self.clientStreaming(
  483. request: request.messages,
  484. context: context
  485. ),
  486. metadata: [:]
  487. )
  488. }
  489. \(access) func serverStreaming(
  490. request: GRPCCore.ServerRequest<Test_TestInput>,
  491. context: GRPCCore.ServerContext
  492. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput> {
  493. return GRPCCore.StreamingServerResponse<Test_TestOutput>(
  494. metadata: [:],
  495. producer: { writer in
  496. try await self.serverStreaming(
  497. request: request.message,
  498. response: writer,
  499. context: context
  500. )
  501. return [:]
  502. }
  503. )
  504. }
  505. \(access) func bidirectionalStreaming(
  506. request: GRPCCore.StreamingServerRequest<Test_TestInput>,
  507. context: GRPCCore.ServerContext
  508. ) async throws -> GRPCCore.StreamingServerResponse<Test_TestOutput> {
  509. return GRPCCore.StreamingServerResponse<Test_TestOutput>(
  510. metadata: [:],
  511. producer: { writer in
  512. try await self.bidirectionalStreaming(
  513. request: request.messages,
  514. response: writer,
  515. context: context
  516. )
  517. return [:]
  518. }
  519. )
  520. }
  521. }
  522. // MARK: test.TestService (client)
  523. extension Test_TestService {
  524. /// Generated client protocol for the "test.TestService" service.
  525. ///
  526. /// You don't need to implement this protocol directly, use the generated
  527. /// implementation, ``Client``.
  528. ///
  529. /// > Source IDL Documentation:
  530. /// >
  531. /// > Service docs.
  532. \(access) protocol ClientProtocol: Sendable {
  533. /// Call the "Unary" method.
  534. ///
  535. /// > Source IDL Documentation:
  536. /// >
  537. /// > Unary docs.
  538. ///
  539. /// - Parameters:
  540. /// - request: A request containing a single `Test_TestInput` message.
  541. /// - serializer: A serializer for `Test_TestInput` messages.
  542. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  543. /// - options: Options to apply to this RPC.
  544. /// - handleResponse: A closure which handles the response, the result of which is
  545. /// returned to the caller. Returning from the closure will cancel the RPC if it
  546. /// hasn't already finished.
  547. /// - Returns: The result of `handleResponse`.
  548. func unary<Result>(
  549. request: GRPCCore.ClientRequest<Test_TestInput>,
  550. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  551. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  552. options: GRPCCore.CallOptions,
  553. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result
  554. ) async throws -> Result where Result: Sendable
  555. /// Call the "ClientStreaming" method.
  556. ///
  557. /// > Source IDL Documentation:
  558. /// >
  559. /// > Client streaming docs.
  560. ///
  561. /// - Parameters:
  562. /// - request: A streaming request producing `Test_TestInput` messages.
  563. /// - serializer: A serializer for `Test_TestInput` messages.
  564. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  565. /// - options: Options to apply to this RPC.
  566. /// - handleResponse: A closure which handles the response, the result of which is
  567. /// returned to the caller. Returning from the closure will cancel the RPC if it
  568. /// hasn't already finished.
  569. /// - Returns: The result of `handleResponse`.
  570. func clientStreaming<Result>(
  571. request: GRPCCore.StreamingClientRequest<Test_TestInput>,
  572. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  573. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  574. options: GRPCCore.CallOptions,
  575. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result
  576. ) async throws -> Result where Result: Sendable
  577. /// Call the "ServerStreaming" method.
  578. ///
  579. /// > Source IDL Documentation:
  580. /// >
  581. /// > Server streaming docs.
  582. ///
  583. /// - Parameters:
  584. /// - request: A request containing a single `Test_TestInput` message.
  585. /// - serializer: A serializer for `Test_TestInput` messages.
  586. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  587. /// - options: Options to apply to this RPC.
  588. /// - handleResponse: A closure which handles the response, the result of which is
  589. /// returned to the caller. Returning from the closure will cancel the RPC if it
  590. /// hasn't already finished.
  591. /// - Returns: The result of `handleResponse`.
  592. func serverStreaming<Result>(
  593. request: GRPCCore.ClientRequest<Test_TestInput>,
  594. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  595. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  596. options: GRPCCore.CallOptions,
  597. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  598. ) async throws -> Result where Result: Sendable
  599. /// Call the "BidirectionalStreaming" method.
  600. ///
  601. /// > Source IDL Documentation:
  602. /// >
  603. /// > Bidirectional streaming docs.
  604. ///
  605. /// - Parameters:
  606. /// - request: A streaming request producing `Test_TestInput` messages.
  607. /// - serializer: A serializer for `Test_TestInput` messages.
  608. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  609. /// - options: Options to apply to this RPC.
  610. /// - handleResponse: A closure which handles the response, the result of which is
  611. /// returned to the caller. Returning from the closure will cancel the RPC if it
  612. /// hasn't already finished.
  613. /// - Returns: The result of `handleResponse`.
  614. func bidirectionalStreaming<Result>(
  615. request: GRPCCore.StreamingClientRequest<Test_TestInput>,
  616. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  617. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  618. options: GRPCCore.CallOptions,
  619. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  620. ) async throws -> Result where Result: Sendable
  621. }
  622. /// Generated client for the "test.TestService" service.
  623. ///
  624. /// The ``Client`` provides an implementation of ``ClientProtocol`` which wraps
  625. /// a `GRPCCore.GRPCCClient`. The underlying `GRPCClient` provides the long-lived
  626. /// means of communication with the remote peer.
  627. ///
  628. /// > Source IDL Documentation:
  629. /// >
  630. /// > Service docs.
  631. \(access) struct Client<Transport>: ClientProtocol where Transport: GRPCCore.ClientTransport {
  632. private let client: GRPCCore.GRPCClient<Transport>
  633. /// Creates a new client wrapping the provided `GRPCCore.GRPCClient`.
  634. ///
  635. /// - Parameters:
  636. /// - client: A `GRPCCore.GRPCClient` providing a communication channel to the service.
  637. \(access) init(wrapping client: GRPCCore.GRPCClient<Transport>) {
  638. self.client = client
  639. }
  640. /// Call the "Unary" method.
  641. ///
  642. /// > Source IDL Documentation:
  643. /// >
  644. /// > Unary docs.
  645. ///
  646. /// - Parameters:
  647. /// - request: A request containing a single `Test_TestInput` message.
  648. /// - serializer: A serializer for `Test_TestInput` messages.
  649. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  650. /// - options: Options to apply to this RPC.
  651. /// - handleResponse: A closure which handles the response, the result of which is
  652. /// returned to the caller. Returning from the closure will cancel the RPC if it
  653. /// hasn't already finished.
  654. /// - Returns: The result of `handleResponse`.
  655. \(access) func unary<Result>(
  656. request: GRPCCore.ClientRequest<Test_TestInput>,
  657. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  658. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  659. options: GRPCCore.CallOptions = .defaults,
  660. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result = { response in
  661. try response.message
  662. }
  663. ) async throws -> Result where Result: Sendable {
  664. try await self.client.unary(
  665. request: request,
  666. descriptor: Test_TestService.Method.Unary.descriptor,
  667. serializer: serializer,
  668. deserializer: deserializer,
  669. options: options,
  670. onResponse: handleResponse
  671. )
  672. }
  673. /// Call the "ClientStreaming" method.
  674. ///
  675. /// > Source IDL Documentation:
  676. /// >
  677. /// > Client streaming docs.
  678. ///
  679. /// - Parameters:
  680. /// - request: A streaming request producing `Test_TestInput` messages.
  681. /// - serializer: A serializer for `Test_TestInput` messages.
  682. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  683. /// - options: Options to apply to this RPC.
  684. /// - handleResponse: A closure which handles the response, the result of which is
  685. /// returned to the caller. Returning from the closure will cancel the RPC if it
  686. /// hasn't already finished.
  687. /// - Returns: The result of `handleResponse`.
  688. \(access) func clientStreaming<Result>(
  689. request: GRPCCore.StreamingClientRequest<Test_TestInput>,
  690. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  691. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  692. options: GRPCCore.CallOptions = .defaults,
  693. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result = { response in
  694. try response.message
  695. }
  696. ) async throws -> Result where Result: Sendable {
  697. try await self.client.clientStreaming(
  698. request: request,
  699. descriptor: Test_TestService.Method.ClientStreaming.descriptor,
  700. serializer: serializer,
  701. deserializer: deserializer,
  702. options: options,
  703. onResponse: handleResponse
  704. )
  705. }
  706. /// Call the "ServerStreaming" method.
  707. ///
  708. /// > Source IDL Documentation:
  709. /// >
  710. /// > Server streaming docs.
  711. ///
  712. /// - Parameters:
  713. /// - request: A request containing a single `Test_TestInput` message.
  714. /// - serializer: A serializer for `Test_TestInput` messages.
  715. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  716. /// - options: Options to apply to this RPC.
  717. /// - handleResponse: A closure which handles the response, the result of which is
  718. /// returned to the caller. Returning from the closure will cancel the RPC if it
  719. /// hasn't already finished.
  720. /// - Returns: The result of `handleResponse`.
  721. \(access) func serverStreaming<Result>(
  722. request: GRPCCore.ClientRequest<Test_TestInput>,
  723. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  724. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  725. options: GRPCCore.CallOptions = .defaults,
  726. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  727. ) async throws -> Result where Result: Sendable {
  728. try await self.client.serverStreaming(
  729. request: request,
  730. descriptor: Test_TestService.Method.ServerStreaming.descriptor,
  731. serializer: serializer,
  732. deserializer: deserializer,
  733. options: options,
  734. onResponse: handleResponse
  735. )
  736. }
  737. /// Call the "BidirectionalStreaming" method.
  738. ///
  739. /// > Source IDL Documentation:
  740. /// >
  741. /// > Bidirectional streaming docs.
  742. ///
  743. /// - Parameters:
  744. /// - request: A streaming request producing `Test_TestInput` messages.
  745. /// - serializer: A serializer for `Test_TestInput` messages.
  746. /// - deserializer: A deserializer for `Test_TestOutput` messages.
  747. /// - options: Options to apply to this RPC.
  748. /// - handleResponse: A closure which handles the response, the result of which is
  749. /// returned to the caller. Returning from the closure will cancel the RPC if it
  750. /// hasn't already finished.
  751. /// - Returns: The result of `handleResponse`.
  752. \(access) func bidirectionalStreaming<Result>(
  753. request: GRPCCore.StreamingClientRequest<Test_TestInput>,
  754. serializer: some GRPCCore.MessageSerializer<Test_TestInput>,
  755. deserializer: some GRPCCore.MessageDeserializer<Test_TestOutput>,
  756. options: GRPCCore.CallOptions = .defaults,
  757. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  758. ) async throws -> Result where Result: Sendable {
  759. try await self.client.bidirectionalStreaming(
  760. request: request,
  761. descriptor: Test_TestService.Method.BidirectionalStreaming.descriptor,
  762. serializer: serializer,
  763. deserializer: deserializer,
  764. options: options,
  765. onResponse: handleResponse
  766. )
  767. }
  768. }
  769. }
  770. // Helpers providing default arguments to 'ClientProtocol' methods.
  771. extension Test_TestService.ClientProtocol {
  772. /// Call the "Unary" method.
  773. ///
  774. /// > Source IDL Documentation:
  775. /// >
  776. /// > Unary docs.
  777. ///
  778. /// - Parameters:
  779. /// - request: A request containing a single `Test_TestInput` message.
  780. /// - options: Options to apply to this RPC.
  781. /// - handleResponse: A closure which handles the response, the result of which is
  782. /// returned to the caller. Returning from the closure will cancel the RPC if it
  783. /// hasn't already finished.
  784. /// - Returns: The result of `handleResponse`.
  785. \(access) func unary<Result>(
  786. request: GRPCCore.ClientRequest<Test_TestInput>,
  787. options: GRPCCore.CallOptions = .defaults,
  788. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result = { response in
  789. try response.message
  790. }
  791. ) async throws -> Result where Result: Sendable {
  792. try await self.unary(
  793. request: request,
  794. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestInput>(),
  795. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestOutput>(),
  796. options: options,
  797. onResponse: handleResponse
  798. )
  799. }
  800. /// Call the "ClientStreaming" method.
  801. ///
  802. /// > Source IDL Documentation:
  803. /// >
  804. /// > Client streaming docs.
  805. ///
  806. /// - Parameters:
  807. /// - request: A streaming request producing `Test_TestInput` messages.
  808. /// - options: Options to apply to this RPC.
  809. /// - handleResponse: A closure which handles the response, the result of which is
  810. /// returned to the caller. Returning from the closure will cancel the RPC if it
  811. /// hasn't already finished.
  812. /// - Returns: The result of `handleResponse`.
  813. \(access) func clientStreaming<Result>(
  814. request: GRPCCore.StreamingClientRequest<Test_TestInput>,
  815. options: GRPCCore.CallOptions = .defaults,
  816. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result = { response in
  817. try response.message
  818. }
  819. ) async throws -> Result where Result: Sendable {
  820. try await self.clientStreaming(
  821. request: request,
  822. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestInput>(),
  823. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestOutput>(),
  824. options: options,
  825. onResponse: handleResponse
  826. )
  827. }
  828. /// Call the "ServerStreaming" method.
  829. ///
  830. /// > Source IDL Documentation:
  831. /// >
  832. /// > Server streaming docs.
  833. ///
  834. /// - Parameters:
  835. /// - request: A request containing a single `Test_TestInput` message.
  836. /// - options: Options to apply to this RPC.
  837. /// - handleResponse: A closure which handles the response, the result of which is
  838. /// returned to the caller. Returning from the closure will cancel the RPC if it
  839. /// hasn't already finished.
  840. /// - Returns: The result of `handleResponse`.
  841. \(access) func serverStreaming<Result>(
  842. request: GRPCCore.ClientRequest<Test_TestInput>,
  843. options: GRPCCore.CallOptions = .defaults,
  844. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  845. ) async throws -> Result where Result: Sendable {
  846. try await self.serverStreaming(
  847. request: request,
  848. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestInput>(),
  849. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestOutput>(),
  850. options: options,
  851. onResponse: handleResponse
  852. )
  853. }
  854. /// Call the "BidirectionalStreaming" method.
  855. ///
  856. /// > Source IDL Documentation:
  857. /// >
  858. /// > Bidirectional streaming docs.
  859. ///
  860. /// - Parameters:
  861. /// - request: A streaming request producing `Test_TestInput` messages.
  862. /// - options: Options to apply to this RPC.
  863. /// - handleResponse: A closure which handles the response, the result of which is
  864. /// returned to the caller. Returning from the closure will cancel the RPC if it
  865. /// hasn't already finished.
  866. /// - Returns: The result of `handleResponse`.
  867. \(access) func bidirectionalStreaming<Result>(
  868. request: GRPCCore.StreamingClientRequest<Test_TestInput>,
  869. options: GRPCCore.CallOptions = .defaults,
  870. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  871. ) async throws -> Result where Result: Sendable {
  872. try await self.bidirectionalStreaming(
  873. request: request,
  874. serializer: GRPCProtobuf.ProtobufSerializer<Test_TestInput>(),
  875. deserializer: GRPCProtobuf.ProtobufDeserializer<Test_TestOutput>(),
  876. options: options,
  877. onResponse: handleResponse
  878. )
  879. }
  880. }
  881. // Helpers providing sugared APIs for 'ClientProtocol' methods.
  882. extension Test_TestService.ClientProtocol {
  883. /// Call the "Unary" method.
  884. ///
  885. /// > Source IDL Documentation:
  886. /// >
  887. /// > Unary docs.
  888. ///
  889. /// - Parameters:
  890. /// - message: request message to send.
  891. /// - metadata: Additional metadata to send, defaults to empty.
  892. /// - options: Options to apply to this RPC, defaults to `.defaults`.
  893. /// - handleResponse: A closure which handles the response, the result of which is
  894. /// returned to the caller. Returning from the closure will cancel the RPC if it
  895. /// hasn't already finished.
  896. /// - Returns: The result of `handleResponse`.
  897. \(access) func unary<Result>(
  898. _ message: Test_TestInput,
  899. metadata: GRPCCore.Metadata = [:],
  900. options: GRPCCore.CallOptions = .defaults,
  901. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result = { response in
  902. try response.message
  903. }
  904. ) async throws -> Result where Result: Sendable {
  905. let request = GRPCCore.ClientRequest<Test_TestInput>(
  906. message: message,
  907. metadata: metadata
  908. )
  909. return try await self.unary(
  910. request: request,
  911. options: options,
  912. onResponse: handleResponse
  913. )
  914. }
  915. /// Call the "ClientStreaming" method.
  916. ///
  917. /// > Source IDL Documentation:
  918. /// >
  919. /// > Client streaming docs.
  920. ///
  921. /// - Parameters:
  922. /// - metadata: Additional metadata to send, defaults to empty.
  923. /// - options: Options to apply to this RPC, defaults to `.defaults`.
  924. /// - producer: A closure producing request messages to send to the server. The request
  925. /// stream is closed when the closure returns.
  926. /// - handleResponse: A closure which handles the response, the result of which is
  927. /// returned to the caller. Returning from the closure will cancel the RPC if it
  928. /// hasn't already finished.
  929. /// - Returns: The result of `handleResponse`.
  930. \(access) func clientStreaming<Result>(
  931. metadata: GRPCCore.Metadata = [:],
  932. options: GRPCCore.CallOptions = .defaults,
  933. requestProducer producer: @Sendable @escaping (GRPCCore.RPCWriter<Test_TestInput>) async throws -> Void,
  934. onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Test_TestOutput>) async throws -> Result = { response in
  935. try response.message
  936. }
  937. ) async throws -> Result where Result: Sendable {
  938. let request = GRPCCore.StreamingClientRequest<Test_TestInput>(
  939. metadata: metadata,
  940. producer: producer
  941. )
  942. return try await self.clientStreaming(
  943. request: request,
  944. options: options,
  945. onResponse: handleResponse
  946. )
  947. }
  948. /// Call the "ServerStreaming" method.
  949. ///
  950. /// > Source IDL Documentation:
  951. /// >
  952. /// > Server streaming docs.
  953. ///
  954. /// - Parameters:
  955. /// - message: request message to send.
  956. /// - metadata: Additional metadata to send, defaults to empty.
  957. /// - options: Options to apply to this RPC, defaults to `.defaults`.
  958. /// - handleResponse: A closure which handles the response, the result of which is
  959. /// returned to the caller. Returning from the closure will cancel the RPC if it
  960. /// hasn't already finished.
  961. /// - Returns: The result of `handleResponse`.
  962. \(access) func serverStreaming<Result>(
  963. _ message: Test_TestInput,
  964. metadata: GRPCCore.Metadata = [:],
  965. options: GRPCCore.CallOptions = .defaults,
  966. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  967. ) async throws -> Result where Result: Sendable {
  968. let request = GRPCCore.ClientRequest<Test_TestInput>(
  969. message: message,
  970. metadata: metadata
  971. )
  972. return try await self.serverStreaming(
  973. request: request,
  974. options: options,
  975. onResponse: handleResponse
  976. )
  977. }
  978. /// Call the "BidirectionalStreaming" method.
  979. ///
  980. /// > Source IDL Documentation:
  981. /// >
  982. /// > Bidirectional streaming docs.
  983. ///
  984. /// - Parameters:
  985. /// - metadata: Additional metadata to send, defaults to empty.
  986. /// - options: Options to apply to this RPC, defaults to `.defaults`.
  987. /// - producer: A closure producing request messages to send to the server. The request
  988. /// stream is closed when the closure returns.
  989. /// - handleResponse: A closure which handles the response, the result of which is
  990. /// returned to the caller. Returning from the closure will cancel the RPC if it
  991. /// hasn't already finished.
  992. /// - Returns: The result of `handleResponse`.
  993. \(access) func bidirectionalStreaming<Result>(
  994. metadata: GRPCCore.Metadata = [:],
  995. options: GRPCCore.CallOptions = .defaults,
  996. requestProducer producer: @Sendable @escaping (GRPCCore.RPCWriter<Test_TestInput>) async throws -> Void,
  997. onResponse handleResponse: @Sendable @escaping (GRPCCore.StreamingClientResponse<Test_TestOutput>) async throws -> Result
  998. ) async throws -> Result where Result: Sendable {
  999. let request = GRPCCore.StreamingClientRequest<Test_TestInput>(
  1000. metadata: metadata,
  1001. producer: producer
  1002. )
  1003. return try await self.bidirectionalStreaming(
  1004. request: request,
  1005. options: options,
  1006. onResponse: handleResponse
  1007. )
  1008. }
  1009. }
  1010. """
  1011. #expect(generated == expected)
  1012. }
  1013. }
  1014. @Suite("File-without-services (foo-messages.proto)")
  1015. struct NoServices: UsesDescriptorSet {
  1016. static let descriptorSetName = "foo-messages"
  1017. static let fileDescriptorName = "foo-messages"
  1018. @Test("Generate")
  1019. func generate() throws {
  1020. let generator = ProtobufCodeGenerator(
  1021. config: CodeGenerator.Config(
  1022. accessLevel: .public,
  1023. accessLevelOnImports: false,
  1024. client: true,
  1025. server: true,
  1026. indentation: 2
  1027. )
  1028. )
  1029. let generated = try generator.generateCode(
  1030. fileDescriptor: Self.fileDescriptor,
  1031. protoFileModuleMappings: ProtoFileToModuleMappings(),
  1032. extraModuleImports: []
  1033. )
  1034. let expected = """
  1035. /// Leading trivia.
  1036. // DO NOT EDIT.
  1037. // swift-format-ignore-file
  1038. //
  1039. // Generated by the gRPC Swift generator plugin for the protocol buffer compiler.
  1040. // Source: foo-messages.proto
  1041. //
  1042. // For information on using the generated types, please see the documentation:
  1043. // https://github.com/grpc/grpc-swift
  1044. // This file contained no services.
  1045. """
  1046. #expect(generated == expected)
  1047. }
  1048. }
  1049. }