conformance.pb.swift 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. // swiftlint:disable all
  4. //
  5. // Generated by the Swift generator plugin for the protocol buffer compiler.
  6. // Source: conformance/conformance.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Protocol Buffers - Google's data interchange format
  11. // Copyright 2008 Google Inc. All rights reserved.
  12. //
  13. // Use of this source code is governed by a BSD-style
  14. // license that can be found in the LICENSE file or at
  15. // https://developers.google.com/open-source/licenses/bsd
  16. import Foundation
  17. import SwiftProtobuf
  18. // If the compiler emits an error on this type, it is because this file
  19. // was generated by a version of the `protoc` Swift plug-in that is
  20. // incompatible with the version of SwiftProtobuf to which you are linking.
  21. // Please ensure that you are building against the same version of the API
  22. // that was used to generate this file.
  23. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  24. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  25. typealias Version = _2
  26. }
  27. enum Conformance_WireFormat: SwiftProtobuf.Enum, Swift.CaseIterable {
  28. typealias RawValue = Int
  29. case unspecified // = 0
  30. case protobuf // = 1
  31. case json // = 2
  32. /// Only used inside Google. Opensource testees just skip it.
  33. case jspb // = 3
  34. case textFormat // = 4
  35. case UNRECOGNIZED(Int)
  36. init() {
  37. self = .unspecified
  38. }
  39. init?(rawValue: Int) {
  40. switch rawValue {
  41. case 0: self = .unspecified
  42. case 1: self = .protobuf
  43. case 2: self = .json
  44. case 3: self = .jspb
  45. case 4: self = .textFormat
  46. default: self = .UNRECOGNIZED(rawValue)
  47. }
  48. }
  49. var rawValue: Int {
  50. switch self {
  51. case .unspecified: return 0
  52. case .protobuf: return 1
  53. case .json: return 2
  54. case .jspb: return 3
  55. case .textFormat: return 4
  56. case .UNRECOGNIZED(let i): return i
  57. }
  58. }
  59. // The compiler won't synthesize support with the UNRECOGNIZED case.
  60. static let allCases: [Conformance_WireFormat] = [
  61. .unspecified,
  62. .protobuf,
  63. .json,
  64. .jspb,
  65. .textFormat,
  66. ]
  67. }
  68. enum Conformance_TestCategory: SwiftProtobuf.Enum, Swift.CaseIterable {
  69. typealias RawValue = Int
  70. case unspecifiedTest // = 0
  71. /// Test binary wire format.
  72. case binaryTest // = 1
  73. /// Test json wire format.
  74. case jsonTest // = 2
  75. /// Similar to JSON_TEST. However, during parsing json, testee should ignore
  76. /// unknown fields. This feature is optional. Each implementation can decide
  77. /// whether to support it. See
  78. /// https://developers.google.com/protocol-buffers/docs/proto3#json_options
  79. /// for more detail.
  80. case jsonIgnoreUnknownParsingTest // = 3
  81. /// Test jspb wire format. Only used inside Google. Opensource testees just
  82. /// skip it.
  83. case jspbTest // = 4
  84. /// Test text format. For cpp, java and python, testees can already deal with
  85. /// this type. Testees of other languages can simply skip it.
  86. case textFormatTest // = 5
  87. case UNRECOGNIZED(Int)
  88. init() {
  89. self = .unspecifiedTest
  90. }
  91. init?(rawValue: Int) {
  92. switch rawValue {
  93. case 0: self = .unspecifiedTest
  94. case 1: self = .binaryTest
  95. case 2: self = .jsonTest
  96. case 3: self = .jsonIgnoreUnknownParsingTest
  97. case 4: self = .jspbTest
  98. case 5: self = .textFormatTest
  99. default: self = .UNRECOGNIZED(rawValue)
  100. }
  101. }
  102. var rawValue: Int {
  103. switch self {
  104. case .unspecifiedTest: return 0
  105. case .binaryTest: return 1
  106. case .jsonTest: return 2
  107. case .jsonIgnoreUnknownParsingTest: return 3
  108. case .jspbTest: return 4
  109. case .textFormatTest: return 5
  110. case .UNRECOGNIZED(let i): return i
  111. }
  112. }
  113. // The compiler won't synthesize support with the UNRECOGNIZED case.
  114. static let allCases: [Conformance_TestCategory] = [
  115. .unspecifiedTest,
  116. .binaryTest,
  117. .jsonTest,
  118. .jsonIgnoreUnknownParsingTest,
  119. .jspbTest,
  120. .textFormatTest,
  121. ]
  122. }
  123. /// Meant to encapsulate all types of tests: successes, skips, failures, etc.
  124. /// Therefore, this may or may not have a failure message. Failure messages
  125. /// may be truncated for our failure lists.
  126. struct Conformance_TestStatus: Sendable {
  127. // SwiftProtobuf.Message conformance is added in an extension below. See the
  128. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  129. // methods supported on all messages.
  130. var name: String = String()
  131. var failureMessage: String = String()
  132. /// What an actual test name matched to in a failure list. Can be wildcarded or
  133. /// an exact match without wildcards.
  134. var matchedName: String = String()
  135. var unknownFields = SwiftProtobuf.UnknownStorage()
  136. init() {}
  137. }
  138. /// The conformance runner will request a list of failures as the first request.
  139. /// This will be known by message_type == "conformance.FailureSet", a conformance
  140. /// test should return a serialized FailureSet in protobuf_payload.
  141. struct Conformance_FailureSet: Sendable {
  142. // SwiftProtobuf.Message conformance is added in an extension below. See the
  143. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  144. // methods supported on all messages.
  145. var test: [Conformance_TestStatus] = []
  146. var unknownFields = SwiftProtobuf.UnknownStorage()
  147. init() {}
  148. }
  149. /// Represents a single test case's input. The testee should:
  150. ///
  151. /// 1. parse this proto (which should always succeed)
  152. /// 2. parse the protobuf or JSON payload in "payload" (which may fail)
  153. /// 3. if the parse succeeded, serialize the message in the requested format.
  154. struct Conformance_ConformanceRequest: Sendable {
  155. // SwiftProtobuf.Message conformance is added in an extension below. See the
  156. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  157. // methods supported on all messages.
  158. /// The payload (whether protobuf of JSON) is always for a
  159. /// protobuf_test_messages.proto3.TestAllTypes proto (as defined in
  160. /// src/google/protobuf/proto3_test_messages.proto).
  161. var payload: Conformance_ConformanceRequest.OneOf_Payload? = nil
  162. var protobufPayload: Data {
  163. get {
  164. if case .protobufPayload(let v)? = payload {return v}
  165. return Data()
  166. }
  167. set {payload = .protobufPayload(newValue)}
  168. }
  169. var jsonPayload: String {
  170. get {
  171. if case .jsonPayload(let v)? = payload {return v}
  172. return String()
  173. }
  174. set {payload = .jsonPayload(newValue)}
  175. }
  176. /// Only used inside Google. Opensource testees just skip it.
  177. var jspbPayload: String {
  178. get {
  179. if case .jspbPayload(let v)? = payload {return v}
  180. return String()
  181. }
  182. set {payload = .jspbPayload(newValue)}
  183. }
  184. var textPayload: String {
  185. get {
  186. if case .textPayload(let v)? = payload {return v}
  187. return String()
  188. }
  189. set {payload = .textPayload(newValue)}
  190. }
  191. /// Which format should the testee serialize its message to?
  192. var requestedOutputFormat: Conformance_WireFormat = .unspecified
  193. /// The full name for the test message to use; for the moment, either:
  194. /// protobuf_test_messages.proto3.TestAllTypesProto3 or
  195. /// protobuf_test_messages.proto2.TestAllTypesProto2 or
  196. /// protobuf_test_messages.editions.proto2.TestAllTypesProto2 or
  197. /// protobuf_test_messages.editions.proto3.TestAllTypesProto3 or
  198. /// protobuf_test_messages.editions.TestAllTypesEdition2023.
  199. var messageType: String = String()
  200. /// Each test is given a specific test category. Some category may need
  201. /// specific support in testee programs. Refer to the definition of
  202. /// TestCategory for more information.
  203. var testCategory: Conformance_TestCategory = .unspecifiedTest
  204. /// Specify details for how to encode jspb.
  205. var jspbEncodingOptions: Conformance_JspbEncodingConfig {
  206. get {return _jspbEncodingOptions ?? Conformance_JspbEncodingConfig()}
  207. set {_jspbEncodingOptions = newValue}
  208. }
  209. /// Returns true if `jspbEncodingOptions` has been explicitly set.
  210. var hasJspbEncodingOptions: Bool {return self._jspbEncodingOptions != nil}
  211. /// Clears the value of `jspbEncodingOptions`. Subsequent reads from it will return its default value.
  212. mutating func clearJspbEncodingOptions() {self._jspbEncodingOptions = nil}
  213. /// This can be used in json and text format. If true, testee should print
  214. /// unknown fields instead of ignore. This feature is optional.
  215. var printUnknownFields: Bool = false
  216. var unknownFields = SwiftProtobuf.UnknownStorage()
  217. /// The payload (whether protobuf of JSON) is always for a
  218. /// protobuf_test_messages.proto3.TestAllTypes proto (as defined in
  219. /// src/google/protobuf/proto3_test_messages.proto).
  220. enum OneOf_Payload: Equatable, Sendable {
  221. case protobufPayload(Data)
  222. case jsonPayload(String)
  223. /// Only used inside Google. Opensource testees just skip it.
  224. case jspbPayload(String)
  225. case textPayload(String)
  226. }
  227. init() {}
  228. fileprivate var _jspbEncodingOptions: Conformance_JspbEncodingConfig? = nil
  229. }
  230. /// Represents a single test case's output.
  231. struct Conformance_ConformanceResponse: Sendable {
  232. // SwiftProtobuf.Message conformance is added in an extension below. See the
  233. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  234. // methods supported on all messages.
  235. var result: Conformance_ConformanceResponse.OneOf_Result? = nil
  236. /// This string should be set to indicate parsing failed. The string can
  237. /// provide more information about the parse error if it is available.
  238. ///
  239. /// Setting this string does not necessarily mean the testee failed the
  240. /// test. Some of the test cases are intentionally invalid input.
  241. var parseError: String {
  242. get {
  243. if case .parseError(let v)? = result {return v}
  244. return String()
  245. }
  246. set {result = .parseError(newValue)}
  247. }
  248. /// If the input was successfully parsed but errors occurred when
  249. /// serializing it to the requested output format, set the error message in
  250. /// this field.
  251. var serializeError: String {
  252. get {
  253. if case .serializeError(let v)? = result {return v}
  254. return String()
  255. }
  256. set {result = .serializeError(newValue)}
  257. }
  258. /// This should be set if the test program timed out. The string should
  259. /// provide more information about what the child process was doing when it
  260. /// was killed.
  261. var timeoutError: String {
  262. get {
  263. if case .timeoutError(let v)? = result {return v}
  264. return String()
  265. }
  266. set {result = .timeoutError(newValue)}
  267. }
  268. /// This should be set if some other error occurred. This will always
  269. /// indicate that the test failed. The string can provide more information
  270. /// about the failure.
  271. var runtimeError: String {
  272. get {
  273. if case .runtimeError(let v)? = result {return v}
  274. return String()
  275. }
  276. set {result = .runtimeError(newValue)}
  277. }
  278. /// If the input was successfully parsed and the requested output was
  279. /// protobuf, serialize it to protobuf and set it in this field.
  280. var protobufPayload: Data {
  281. get {
  282. if case .protobufPayload(let v)? = result {return v}
  283. return Data()
  284. }
  285. set {result = .protobufPayload(newValue)}
  286. }
  287. /// If the input was successfully parsed and the requested output was JSON,
  288. /// serialize to JSON and set it in this field.
  289. var jsonPayload: String {
  290. get {
  291. if case .jsonPayload(let v)? = result {return v}
  292. return String()
  293. }
  294. set {result = .jsonPayload(newValue)}
  295. }
  296. /// For when the testee skipped the test, likely because a certain feature
  297. /// wasn't supported, like JSON input/output.
  298. var skipped: String {
  299. get {
  300. if case .skipped(let v)? = result {return v}
  301. return String()
  302. }
  303. set {result = .skipped(newValue)}
  304. }
  305. /// If the input was successfully parsed and the requested output was JSPB,
  306. /// serialize to JSPB and set it in this field. JSPB is only used inside
  307. /// Google. Opensource testees can just skip it.
  308. var jspbPayload: String {
  309. get {
  310. if case .jspbPayload(let v)? = result {return v}
  311. return String()
  312. }
  313. set {result = .jspbPayload(newValue)}
  314. }
  315. /// If the input was successfully parsed and the requested output was
  316. /// TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.
  317. var textPayload: String {
  318. get {
  319. if case .textPayload(let v)? = result {return v}
  320. return String()
  321. }
  322. set {result = .textPayload(newValue)}
  323. }
  324. var unknownFields = SwiftProtobuf.UnknownStorage()
  325. enum OneOf_Result: Equatable, Sendable {
  326. /// This string should be set to indicate parsing failed. The string can
  327. /// provide more information about the parse error if it is available.
  328. ///
  329. /// Setting this string does not necessarily mean the testee failed the
  330. /// test. Some of the test cases are intentionally invalid input.
  331. case parseError(String)
  332. /// If the input was successfully parsed but errors occurred when
  333. /// serializing it to the requested output format, set the error message in
  334. /// this field.
  335. case serializeError(String)
  336. /// This should be set if the test program timed out. The string should
  337. /// provide more information about what the child process was doing when it
  338. /// was killed.
  339. case timeoutError(String)
  340. /// This should be set if some other error occurred. This will always
  341. /// indicate that the test failed. The string can provide more information
  342. /// about the failure.
  343. case runtimeError(String)
  344. /// If the input was successfully parsed and the requested output was
  345. /// protobuf, serialize it to protobuf and set it in this field.
  346. case protobufPayload(Data)
  347. /// If the input was successfully parsed and the requested output was JSON,
  348. /// serialize to JSON and set it in this field.
  349. case jsonPayload(String)
  350. /// For when the testee skipped the test, likely because a certain feature
  351. /// wasn't supported, like JSON input/output.
  352. case skipped(String)
  353. /// If the input was successfully parsed and the requested output was JSPB,
  354. /// serialize to JSPB and set it in this field. JSPB is only used inside
  355. /// Google. Opensource testees can just skip it.
  356. case jspbPayload(String)
  357. /// If the input was successfully parsed and the requested output was
  358. /// TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.
  359. case textPayload(String)
  360. }
  361. init() {}
  362. }
  363. /// Encoding options for jspb format.
  364. struct Conformance_JspbEncodingConfig: Sendable {
  365. // SwiftProtobuf.Message conformance is added in an extension below. See the
  366. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  367. // methods supported on all messages.
  368. /// Encode the value field of Any as jspb array if true, otherwise binary.
  369. var useJspbArrayAnyFormat: Bool = false
  370. var unknownFields = SwiftProtobuf.UnknownStorage()
  371. init() {}
  372. }
  373. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  374. fileprivate let _protobuf_package = "conformance"
  375. extension Conformance_WireFormat: SwiftProtobuf._ProtoNameProviding {
  376. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0UNSPECIFIED\0\u{1}PROTOBUF\0\u{1}JSON\0\u{1}JSPB\0\u{1}TEXT_FORMAT\0")
  377. }
  378. extension Conformance_TestCategory: SwiftProtobuf._ProtoNameProviding {
  379. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0UNSPECIFIED_TEST\0\u{1}BINARY_TEST\0\u{1}JSON_TEST\0\u{1}JSON_IGNORE_UNKNOWN_PARSING_TEST\0\u{1}JSPB_TEST\0\u{1}TEXT_FORMAT_TEST\0")
  380. }
  381. extension Conformance_TestStatus: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  382. static let protoMessageName: String = _protobuf_package + ".TestStatus"
  383. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}name\0\u{3}failure_message\0\u{3}matched_name\0")
  384. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  385. while let fieldNumber = try decoder.nextFieldNumber() {
  386. // The use of inline closures is to circumvent an issue where the compiler
  387. // allocates stack space for every case branch when no optimizations are
  388. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  389. switch fieldNumber {
  390. case 1: try { try decoder.decodeSingularStringField(value: &self.name) }()
  391. case 2: try { try decoder.decodeSingularStringField(value: &self.failureMessage) }()
  392. case 3: try { try decoder.decodeSingularStringField(value: &self.matchedName) }()
  393. default: break
  394. }
  395. }
  396. }
  397. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  398. if !self.name.isEmpty {
  399. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  400. }
  401. if !self.failureMessage.isEmpty {
  402. try visitor.visitSingularStringField(value: self.failureMessage, fieldNumber: 2)
  403. }
  404. if !self.matchedName.isEmpty {
  405. try visitor.visitSingularStringField(value: self.matchedName, fieldNumber: 3)
  406. }
  407. try unknownFields.traverse(visitor: &visitor)
  408. }
  409. static func ==(lhs: Conformance_TestStatus, rhs: Conformance_TestStatus) -> Bool {
  410. if lhs.name != rhs.name {return false}
  411. if lhs.failureMessage != rhs.failureMessage {return false}
  412. if lhs.matchedName != rhs.matchedName {return false}
  413. if lhs.unknownFields != rhs.unknownFields {return false}
  414. return true
  415. }
  416. }
  417. extension Conformance_FailureSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  418. static let protoMessageName: String = _protobuf_package + ".FailureSet"
  419. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\u{2}test\0\u{c}\u{1}\u{1}")
  420. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  421. while let fieldNumber = try decoder.nextFieldNumber() {
  422. // The use of inline closures is to circumvent an issue where the compiler
  423. // allocates stack space for every case branch when no optimizations are
  424. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  425. switch fieldNumber {
  426. case 2: try { try decoder.decodeRepeatedMessageField(value: &self.test) }()
  427. default: break
  428. }
  429. }
  430. }
  431. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  432. if !self.test.isEmpty {
  433. try visitor.visitRepeatedMessageField(value: self.test, fieldNumber: 2)
  434. }
  435. try unknownFields.traverse(visitor: &visitor)
  436. }
  437. static func ==(lhs: Conformance_FailureSet, rhs: Conformance_FailureSet) -> Bool {
  438. if lhs.test != rhs.test {return false}
  439. if lhs.unknownFields != rhs.unknownFields {return false}
  440. return true
  441. }
  442. }
  443. extension Conformance_ConformanceRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  444. static let protoMessageName: String = _protobuf_package + ".ConformanceRequest"
  445. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}protobuf_payload\0\u{3}json_payload\0\u{3}requested_output_format\0\u{3}message_type\0\u{3}test_category\0\u{3}jspb_encoding_options\0\u{3}jspb_payload\0\u{3}text_payload\0\u{3}print_unknown_fields\0")
  446. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  447. while let fieldNumber = try decoder.nextFieldNumber() {
  448. // The use of inline closures is to circumvent an issue where the compiler
  449. // allocates stack space for every case branch when no optimizations are
  450. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  451. switch fieldNumber {
  452. case 1: try {
  453. var v: Data?
  454. try decoder.decodeSingularBytesField(value: &v)
  455. if let v = v {
  456. if self.payload != nil {try decoder.handleConflictingOneOf()}
  457. self.payload = .protobufPayload(v)
  458. }
  459. }()
  460. case 2: try {
  461. var v: String?
  462. try decoder.decodeSingularStringField(value: &v)
  463. if let v = v {
  464. if self.payload != nil {try decoder.handleConflictingOneOf()}
  465. self.payload = .jsonPayload(v)
  466. }
  467. }()
  468. case 3: try { try decoder.decodeSingularEnumField(value: &self.requestedOutputFormat) }()
  469. case 4: try { try decoder.decodeSingularStringField(value: &self.messageType) }()
  470. case 5: try { try decoder.decodeSingularEnumField(value: &self.testCategory) }()
  471. case 6: try { try decoder.decodeSingularMessageField(value: &self._jspbEncodingOptions) }()
  472. case 7: try {
  473. var v: String?
  474. try decoder.decodeSingularStringField(value: &v)
  475. if let v = v {
  476. if self.payload != nil {try decoder.handleConflictingOneOf()}
  477. self.payload = .jspbPayload(v)
  478. }
  479. }()
  480. case 8: try {
  481. var v: String?
  482. try decoder.decodeSingularStringField(value: &v)
  483. if let v = v {
  484. if self.payload != nil {try decoder.handleConflictingOneOf()}
  485. self.payload = .textPayload(v)
  486. }
  487. }()
  488. case 9: try { try decoder.decodeSingularBoolField(value: &self.printUnknownFields) }()
  489. default: break
  490. }
  491. }
  492. }
  493. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  494. // The use of inline closures is to circumvent an issue where the compiler
  495. // allocates stack space for every if/case branch local when no optimizations
  496. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  497. // https://github.com/apple/swift-protobuf/issues/1182
  498. switch self.payload {
  499. case .protobufPayload?: try {
  500. guard case .protobufPayload(let v)? = self.payload else { preconditionFailure() }
  501. try visitor.visitSingularBytesField(value: v, fieldNumber: 1)
  502. }()
  503. case .jsonPayload?: try {
  504. guard case .jsonPayload(let v)? = self.payload else { preconditionFailure() }
  505. try visitor.visitSingularStringField(value: v, fieldNumber: 2)
  506. }()
  507. default: break
  508. }
  509. if self.requestedOutputFormat != .unspecified {
  510. try visitor.visitSingularEnumField(value: self.requestedOutputFormat, fieldNumber: 3)
  511. }
  512. if !self.messageType.isEmpty {
  513. try visitor.visitSingularStringField(value: self.messageType, fieldNumber: 4)
  514. }
  515. if self.testCategory != .unspecifiedTest {
  516. try visitor.visitSingularEnumField(value: self.testCategory, fieldNumber: 5)
  517. }
  518. try { if let v = self._jspbEncodingOptions {
  519. try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
  520. } }()
  521. switch self.payload {
  522. case .jspbPayload?: try {
  523. guard case .jspbPayload(let v)? = self.payload else { preconditionFailure() }
  524. try visitor.visitSingularStringField(value: v, fieldNumber: 7)
  525. }()
  526. case .textPayload?: try {
  527. guard case .textPayload(let v)? = self.payload else { preconditionFailure() }
  528. try visitor.visitSingularStringField(value: v, fieldNumber: 8)
  529. }()
  530. default: break
  531. }
  532. if self.printUnknownFields != false {
  533. try visitor.visitSingularBoolField(value: self.printUnknownFields, fieldNumber: 9)
  534. }
  535. try unknownFields.traverse(visitor: &visitor)
  536. }
  537. static func ==(lhs: Conformance_ConformanceRequest, rhs: Conformance_ConformanceRequest) -> Bool {
  538. if lhs.payload != rhs.payload {return false}
  539. if lhs.requestedOutputFormat != rhs.requestedOutputFormat {return false}
  540. if lhs.messageType != rhs.messageType {return false}
  541. if lhs.testCategory != rhs.testCategory {return false}
  542. if lhs._jspbEncodingOptions != rhs._jspbEncodingOptions {return false}
  543. if lhs.printUnknownFields != rhs.printUnknownFields {return false}
  544. if lhs.unknownFields != rhs.unknownFields {return false}
  545. return true
  546. }
  547. }
  548. extension Conformance_ConformanceResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  549. static let protoMessageName: String = _protobuf_package + ".ConformanceResponse"
  550. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}parse_error\0\u{3}runtime_error\0\u{3}protobuf_payload\0\u{3}json_payload\0\u{1}skipped\0\u{3}serialize_error\0\u{3}jspb_payload\0\u{3}text_payload\0\u{3}timeout_error\0")
  551. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  552. while let fieldNumber = try decoder.nextFieldNumber() {
  553. // The use of inline closures is to circumvent an issue where the compiler
  554. // allocates stack space for every case branch when no optimizations are
  555. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  556. switch fieldNumber {
  557. case 1: try {
  558. var v: String?
  559. try decoder.decodeSingularStringField(value: &v)
  560. if let v = v {
  561. if self.result != nil {try decoder.handleConflictingOneOf()}
  562. self.result = .parseError(v)
  563. }
  564. }()
  565. case 2: try {
  566. var v: String?
  567. try decoder.decodeSingularStringField(value: &v)
  568. if let v = v {
  569. if self.result != nil {try decoder.handleConflictingOneOf()}
  570. self.result = .runtimeError(v)
  571. }
  572. }()
  573. case 3: try {
  574. var v: Data?
  575. try decoder.decodeSingularBytesField(value: &v)
  576. if let v = v {
  577. if self.result != nil {try decoder.handleConflictingOneOf()}
  578. self.result = .protobufPayload(v)
  579. }
  580. }()
  581. case 4: try {
  582. var v: String?
  583. try decoder.decodeSingularStringField(value: &v)
  584. if let v = v {
  585. if self.result != nil {try decoder.handleConflictingOneOf()}
  586. self.result = .jsonPayload(v)
  587. }
  588. }()
  589. case 5: try {
  590. var v: String?
  591. try decoder.decodeSingularStringField(value: &v)
  592. if let v = v {
  593. if self.result != nil {try decoder.handleConflictingOneOf()}
  594. self.result = .skipped(v)
  595. }
  596. }()
  597. case 6: try {
  598. var v: String?
  599. try decoder.decodeSingularStringField(value: &v)
  600. if let v = v {
  601. if self.result != nil {try decoder.handleConflictingOneOf()}
  602. self.result = .serializeError(v)
  603. }
  604. }()
  605. case 7: try {
  606. var v: String?
  607. try decoder.decodeSingularStringField(value: &v)
  608. if let v = v {
  609. if self.result != nil {try decoder.handleConflictingOneOf()}
  610. self.result = .jspbPayload(v)
  611. }
  612. }()
  613. case 8: try {
  614. var v: String?
  615. try decoder.decodeSingularStringField(value: &v)
  616. if let v = v {
  617. if self.result != nil {try decoder.handleConflictingOneOf()}
  618. self.result = .textPayload(v)
  619. }
  620. }()
  621. case 9: try {
  622. var v: String?
  623. try decoder.decodeSingularStringField(value: &v)
  624. if let v = v {
  625. if self.result != nil {try decoder.handleConflictingOneOf()}
  626. self.result = .timeoutError(v)
  627. }
  628. }()
  629. default: break
  630. }
  631. }
  632. }
  633. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  634. // The use of inline closures is to circumvent an issue where the compiler
  635. // allocates stack space for every if/case branch local when no optimizations
  636. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  637. // https://github.com/apple/swift-protobuf/issues/1182
  638. switch self.result {
  639. case .parseError?: try {
  640. guard case .parseError(let v)? = self.result else { preconditionFailure() }
  641. try visitor.visitSingularStringField(value: v, fieldNumber: 1)
  642. }()
  643. case .runtimeError?: try {
  644. guard case .runtimeError(let v)? = self.result else { preconditionFailure() }
  645. try visitor.visitSingularStringField(value: v, fieldNumber: 2)
  646. }()
  647. case .protobufPayload?: try {
  648. guard case .protobufPayload(let v)? = self.result else { preconditionFailure() }
  649. try visitor.visitSingularBytesField(value: v, fieldNumber: 3)
  650. }()
  651. case .jsonPayload?: try {
  652. guard case .jsonPayload(let v)? = self.result else { preconditionFailure() }
  653. try visitor.visitSingularStringField(value: v, fieldNumber: 4)
  654. }()
  655. case .skipped?: try {
  656. guard case .skipped(let v)? = self.result else { preconditionFailure() }
  657. try visitor.visitSingularStringField(value: v, fieldNumber: 5)
  658. }()
  659. case .serializeError?: try {
  660. guard case .serializeError(let v)? = self.result else { preconditionFailure() }
  661. try visitor.visitSingularStringField(value: v, fieldNumber: 6)
  662. }()
  663. case .jspbPayload?: try {
  664. guard case .jspbPayload(let v)? = self.result else { preconditionFailure() }
  665. try visitor.visitSingularStringField(value: v, fieldNumber: 7)
  666. }()
  667. case .textPayload?: try {
  668. guard case .textPayload(let v)? = self.result else { preconditionFailure() }
  669. try visitor.visitSingularStringField(value: v, fieldNumber: 8)
  670. }()
  671. case .timeoutError?: try {
  672. guard case .timeoutError(let v)? = self.result else { preconditionFailure() }
  673. try visitor.visitSingularStringField(value: v, fieldNumber: 9)
  674. }()
  675. case nil: break
  676. }
  677. try unknownFields.traverse(visitor: &visitor)
  678. }
  679. static func ==(lhs: Conformance_ConformanceResponse, rhs: Conformance_ConformanceResponse) -> Bool {
  680. if lhs.result != rhs.result {return false}
  681. if lhs.unknownFields != rhs.unknownFields {return false}
  682. return true
  683. }
  684. }
  685. extension Conformance_JspbEncodingConfig: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  686. static let protoMessageName: String = _protobuf_package + ".JspbEncodingConfig"
  687. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}use_jspb_array_any_format\0")
  688. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  689. while let fieldNumber = try decoder.nextFieldNumber() {
  690. // The use of inline closures is to circumvent an issue where the compiler
  691. // allocates stack space for every case branch when no optimizations are
  692. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  693. switch fieldNumber {
  694. case 1: try { try decoder.decodeSingularBoolField(value: &self.useJspbArrayAnyFormat) }()
  695. default: break
  696. }
  697. }
  698. }
  699. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  700. if self.useJspbArrayAnyFormat != false {
  701. try visitor.visitSingularBoolField(value: self.useJspbArrayAnyFormat, fieldNumber: 1)
  702. }
  703. try unknownFields.traverse(visitor: &visitor)
  704. }
  705. static func ==(lhs: Conformance_JspbEncodingConfig, rhs: Conformance_JspbEncodingConfig) -> Bool {
  706. if lhs.useJspbArrayAnyFormat != rhs.useJspbArrayAnyFormat {return false}
  707. if lhs.unknownFields != rhs.unknownFields {return false}
  708. return true
  709. }
  710. }