plugin.pb.swift 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. // DO NOT EDIT.
  2. //
  3. // Generated by the Swift generator plugin for the protocol buffer compiler.
  4. // Source: plugin.proto
  5. //
  6. // For information on using the generated types, please see the documenation:
  7. // https://github.com/apple/swift-protobuf/
  8. // Copyright 2017 Google Inc. All Rights Reserved.
  9. //
  10. // Licensed under the Apache License, Version 2.0 (the "License");
  11. // you may not use this file except in compliance with the License.
  12. // You may obtain a copy of the License at
  13. //
  14. // http://www.apache.org/licenses/LICENSE-2.0
  15. //
  16. // Unless required by applicable law or agreed to in writing, software
  17. // distributed under the License is distributed on an "AS IS" BASIS,
  18. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. // See the License for the specific language governing permissions and
  20. // limitations under the License.
  21. // openapic (aka the OpenAPI Compiler) can be extended via plugins.
  22. // A plugin is just a program that reads a Request from stdin
  23. // and writes a Response to stdout.
  24. //
  25. // A plugin executable needs only to be placed somewhere in the path. The
  26. // plugin should be named "openapi_$NAME", and will then be used when the
  27. // flag "--${NAME}_out" is passed to openapic.
  28. import Foundation
  29. import SwiftProtobuf
  30. // If the compiler emits an error on this type, it is because this file
  31. // was generated by a version of the `protoc` Swift plug-in that is
  32. // incompatible with the version of SwiftProtobuf to which you are linking.
  33. // Please ensure that your are building against the same version of the API
  34. // that was used to generate this file.
  35. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  36. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  37. typealias Version = _2
  38. }
  39. /// The version number of OpenAPI compiler.
  40. struct Openapi_Plugin_V1_Version: SwiftProtobuf.Message {
  41. static let protoMessageName: String = _protobuf_package + ".Version"
  42. var major: Int32 = 0
  43. var minor: Int32 = 0
  44. var patch: Int32 = 0
  45. /// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
  46. /// be empty for mainline stable releases.
  47. var suffix: String = String()
  48. var unknownFields = SwiftProtobuf.UnknownStorage()
  49. init() {}
  50. /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  51. /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  52. /// initializers are defined in the SwiftProtobuf library. See the Message and
  53. /// Message+*Additions` files.
  54. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  55. while let fieldNumber = try decoder.nextFieldNumber() {
  56. switch fieldNumber {
  57. case 1: try decoder.decodeSingularInt32Field(value: &self.major)
  58. case 2: try decoder.decodeSingularInt32Field(value: &self.minor)
  59. case 3: try decoder.decodeSingularInt32Field(value: &self.patch)
  60. case 4: try decoder.decodeSingularStringField(value: &self.suffix)
  61. default: break
  62. }
  63. }
  64. }
  65. /// Used by the encoding methods of the SwiftProtobuf library, not generally
  66. /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  67. /// other serializer methods are defined in the SwiftProtobuf library. See the
  68. /// `Message` and `Message+*Additions` files.
  69. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  70. if self.major != 0 {
  71. try visitor.visitSingularInt32Field(value: self.major, fieldNumber: 1)
  72. }
  73. if self.minor != 0 {
  74. try visitor.visitSingularInt32Field(value: self.minor, fieldNumber: 2)
  75. }
  76. if self.patch != 0 {
  77. try visitor.visitSingularInt32Field(value: self.patch, fieldNumber: 3)
  78. }
  79. if !self.suffix.isEmpty {
  80. try visitor.visitSingularStringField(value: self.suffix, fieldNumber: 4)
  81. }
  82. try unknownFields.traverse(visitor: &visitor)
  83. }
  84. }
  85. /// A parameter passed to the plugin from (or through) the OpenAPI compiler.
  86. struct Openapi_Plugin_V1_Parameter: SwiftProtobuf.Message {
  87. static let protoMessageName: String = _protobuf_package + ".Parameter"
  88. /// The name of the parameter as specified in the option string
  89. var name: String = String()
  90. /// The parameter value as specified in the option string
  91. var value: String = String()
  92. var unknownFields = SwiftProtobuf.UnknownStorage()
  93. init() {}
  94. /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  95. /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  96. /// initializers are defined in the SwiftProtobuf library. See the Message and
  97. /// Message+*Additions` files.
  98. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  99. while let fieldNumber = try decoder.nextFieldNumber() {
  100. switch fieldNumber {
  101. case 1: try decoder.decodeSingularStringField(value: &self.name)
  102. case 2: try decoder.decodeSingularStringField(value: &self.value)
  103. default: break
  104. }
  105. }
  106. }
  107. /// Used by the encoding methods of the SwiftProtobuf library, not generally
  108. /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  109. /// other serializer methods are defined in the SwiftProtobuf library. See the
  110. /// `Message` and `Message+*Additions` files.
  111. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  112. if !self.name.isEmpty {
  113. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  114. }
  115. if !self.value.isEmpty {
  116. try visitor.visitSingularStringField(value: self.value, fieldNumber: 2)
  117. }
  118. try unknownFields.traverse(visitor: &visitor)
  119. }
  120. }
  121. /// An encoded Request is written to the plugin's stdin.
  122. struct Openapi_Plugin_V1_Request: SwiftProtobuf.Message {
  123. static let protoMessageName: String = _protobuf_package + ".Request"
  124. /// A wrapped OpenAPI document to process.
  125. var wrapper: Openapi_Plugin_V1_Wrapper {
  126. get {return _storage._wrapper ?? Openapi_Plugin_V1_Wrapper()}
  127. set {_uniqueStorage()._wrapper = newValue}
  128. }
  129. /// Returns true if `wrapper` has been explicitly set.
  130. var hasWrapper: Bool {return _storage._wrapper != nil}
  131. /// Clears the value of `wrapper`. Subsequent reads from it will return its default value.
  132. mutating func clearWrapper() {_storage._wrapper = nil}
  133. /// Output path specified in the plugin invocation.
  134. var outputPath: String {
  135. get {return _storage._outputPath}
  136. set {_uniqueStorage()._outputPath = newValue}
  137. }
  138. /// Plugin parameters parsed from the invocation string.
  139. var parameters: [Openapi_Plugin_V1_Parameter] {
  140. get {return _storage._parameters}
  141. set {_uniqueStorage()._parameters = newValue}
  142. }
  143. /// The version number of openapi compiler.
  144. var compilerVersion: Openapi_Plugin_V1_Version {
  145. get {return _storage._compilerVersion ?? Openapi_Plugin_V1_Version()}
  146. set {_uniqueStorage()._compilerVersion = newValue}
  147. }
  148. /// Returns true if `compilerVersion` has been explicitly set.
  149. var hasCompilerVersion: Bool {return _storage._compilerVersion != nil}
  150. /// Clears the value of `compilerVersion`. Subsequent reads from it will return its default value.
  151. mutating func clearCompilerVersion() {_storage._compilerVersion = nil}
  152. var unknownFields = SwiftProtobuf.UnknownStorage()
  153. init() {}
  154. /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  155. /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  156. /// initializers are defined in the SwiftProtobuf library. See the Message and
  157. /// Message+*Additions` files.
  158. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  159. _ = _uniqueStorage()
  160. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  161. while let fieldNumber = try decoder.nextFieldNumber() {
  162. switch fieldNumber {
  163. case 1: try decoder.decodeSingularMessageField(value: &_storage._wrapper)
  164. case 2: try decoder.decodeSingularStringField(value: &_storage._outputPath)
  165. case 3: try decoder.decodeRepeatedMessageField(value: &_storage._parameters)
  166. case 4: try decoder.decodeSingularMessageField(value: &_storage._compilerVersion)
  167. default: break
  168. }
  169. }
  170. }
  171. }
  172. /// Used by the encoding methods of the SwiftProtobuf library, not generally
  173. /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  174. /// other serializer methods are defined in the SwiftProtobuf library. See the
  175. /// `Message` and `Message+*Additions` files.
  176. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  177. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  178. if let v = _storage._wrapper {
  179. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  180. }
  181. if !_storage._outputPath.isEmpty {
  182. try visitor.visitSingularStringField(value: _storage._outputPath, fieldNumber: 2)
  183. }
  184. if !_storage._parameters.isEmpty {
  185. try visitor.visitRepeatedMessageField(value: _storage._parameters, fieldNumber: 3)
  186. }
  187. if let v = _storage._compilerVersion {
  188. try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
  189. }
  190. }
  191. try unknownFields.traverse(visitor: &visitor)
  192. }
  193. fileprivate var _storage = _StorageClass.defaultInstance
  194. }
  195. /// The plugin writes an encoded Response to stdout.
  196. struct Openapi_Plugin_V1_Response: SwiftProtobuf.Message {
  197. static let protoMessageName: String = _protobuf_package + ".Response"
  198. /// Error message. If non-empty, the plugin failed.
  199. /// The plugin process should exit with status code zero
  200. /// even if it reports an error in this way.
  201. ///
  202. /// This should be used to indicate errors which prevent the plugin from
  203. /// operating as intended. Errors which indicate a problem in openapic
  204. /// itself -- such as the input Document being unparseable -- should be
  205. /// reported by writing a message to stderr and exiting with a non-zero
  206. /// status code.
  207. var errors: [String] = []
  208. /// file output, each file will be written by openapic to an appropriate location.
  209. var files: [Openapi_Plugin_V1_File] = []
  210. var unknownFields = SwiftProtobuf.UnknownStorage()
  211. init() {}
  212. /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  213. /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  214. /// initializers are defined in the SwiftProtobuf library. See the Message and
  215. /// Message+*Additions` files.
  216. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  217. while let fieldNumber = try decoder.nextFieldNumber() {
  218. switch fieldNumber {
  219. case 1: try decoder.decodeRepeatedStringField(value: &self.errors)
  220. case 2: try decoder.decodeRepeatedMessageField(value: &self.files)
  221. default: break
  222. }
  223. }
  224. }
  225. /// Used by the encoding methods of the SwiftProtobuf library, not generally
  226. /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  227. /// other serializer methods are defined in the SwiftProtobuf library. See the
  228. /// `Message` and `Message+*Additions` files.
  229. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  230. if !self.errors.isEmpty {
  231. try visitor.visitRepeatedStringField(value: self.errors, fieldNumber: 1)
  232. }
  233. if !self.files.isEmpty {
  234. try visitor.visitRepeatedMessageField(value: self.files, fieldNumber: 2)
  235. }
  236. try unknownFields.traverse(visitor: &visitor)
  237. }
  238. }
  239. /// File describes a file generated by a plugin.
  240. struct Openapi_Plugin_V1_File: SwiftProtobuf.Message {
  241. static let protoMessageName: String = _protobuf_package + ".File"
  242. /// name of the file
  243. var name: String = String()
  244. /// data to be written to the file
  245. var data: Data = SwiftProtobuf.Internal.emptyData
  246. var unknownFields = SwiftProtobuf.UnknownStorage()
  247. init() {}
  248. /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  249. /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  250. /// initializers are defined in the SwiftProtobuf library. See the Message and
  251. /// Message+*Additions` files.
  252. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  253. while let fieldNumber = try decoder.nextFieldNumber() {
  254. switch fieldNumber {
  255. case 1: try decoder.decodeSingularStringField(value: &self.name)
  256. case 2: try decoder.decodeSingularBytesField(value: &self.data)
  257. default: break
  258. }
  259. }
  260. }
  261. /// Used by the encoding methods of the SwiftProtobuf library, not generally
  262. /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  263. /// other serializer methods are defined in the SwiftProtobuf library. See the
  264. /// `Message` and `Message+*Additions` files.
  265. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  266. if !self.name.isEmpty {
  267. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  268. }
  269. if !self.data.isEmpty {
  270. try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2)
  271. }
  272. try unknownFields.traverse(visitor: &visitor)
  273. }
  274. }
  275. /// Wrapper wraps an OpenAPI document with its version.
  276. struct Openapi_Plugin_V1_Wrapper: SwiftProtobuf.Message {
  277. static let protoMessageName: String = _protobuf_package + ".Wrapper"
  278. /// filename or URL of the wrapped document
  279. var name: String = String()
  280. /// version of the OpenAPI specification that is used by the wrapped document
  281. var version: String = String()
  282. /// valid serialized protocol buffer of the named OpenAPI specification version
  283. var value: Data = SwiftProtobuf.Internal.emptyData
  284. var unknownFields = SwiftProtobuf.UnknownStorage()
  285. init() {}
  286. /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  287. /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  288. /// initializers are defined in the SwiftProtobuf library. See the Message and
  289. /// Message+*Additions` files.
  290. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  291. while let fieldNumber = try decoder.nextFieldNumber() {
  292. switch fieldNumber {
  293. case 1: try decoder.decodeSingularStringField(value: &self.name)
  294. case 2: try decoder.decodeSingularStringField(value: &self.version)
  295. case 3: try decoder.decodeSingularBytesField(value: &self.value)
  296. default: break
  297. }
  298. }
  299. }
  300. /// Used by the encoding methods of the SwiftProtobuf library, not generally
  301. /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  302. /// other serializer methods are defined in the SwiftProtobuf library. See the
  303. /// `Message` and `Message+*Additions` files.
  304. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  305. if !self.name.isEmpty {
  306. try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
  307. }
  308. if !self.version.isEmpty {
  309. try visitor.visitSingularStringField(value: self.version, fieldNumber: 2)
  310. }
  311. if !self.value.isEmpty {
  312. try visitor.visitSingularBytesField(value: self.value, fieldNumber: 3)
  313. }
  314. try unknownFields.traverse(visitor: &visitor)
  315. }
  316. }
  317. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  318. fileprivate let _protobuf_package = "openapi.plugin.v1"
  319. extension Openapi_Plugin_V1_Version: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  320. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  321. 1: .same(proto: "major"),
  322. 2: .same(proto: "minor"),
  323. 3: .same(proto: "patch"),
  324. 4: .same(proto: "suffix"),
  325. ]
  326. func _protobuf_generated_isEqualTo(other: Openapi_Plugin_V1_Version) -> Bool {
  327. if self.major != other.major {return false}
  328. if self.minor != other.minor {return false}
  329. if self.patch != other.patch {return false}
  330. if self.suffix != other.suffix {return false}
  331. if unknownFields != other.unknownFields {return false}
  332. return true
  333. }
  334. }
  335. extension Openapi_Plugin_V1_Parameter: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  336. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  337. 1: .same(proto: "name"),
  338. 2: .same(proto: "value"),
  339. ]
  340. func _protobuf_generated_isEqualTo(other: Openapi_Plugin_V1_Parameter) -> Bool {
  341. if self.name != other.name {return false}
  342. if self.value != other.value {return false}
  343. if unknownFields != other.unknownFields {return false}
  344. return true
  345. }
  346. }
  347. extension Openapi_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  348. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  349. 1: .same(proto: "wrapper"),
  350. 2: .standard(proto: "output_path"),
  351. 3: .same(proto: "parameters"),
  352. 4: .standard(proto: "compiler_version"),
  353. ]
  354. fileprivate class _StorageClass {
  355. var _wrapper: Openapi_Plugin_V1_Wrapper? = nil
  356. var _outputPath: String = String()
  357. var _parameters: [Openapi_Plugin_V1_Parameter] = []
  358. var _compilerVersion: Openapi_Plugin_V1_Version? = nil
  359. static let defaultInstance = _StorageClass()
  360. private init() {}
  361. init(copying source: _StorageClass) {
  362. _wrapper = source._wrapper
  363. _outputPath = source._outputPath
  364. _parameters = source._parameters
  365. _compilerVersion = source._compilerVersion
  366. }
  367. }
  368. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  369. if !isKnownUniquelyReferenced(&_storage) {
  370. _storage = _StorageClass(copying: _storage)
  371. }
  372. return _storage
  373. }
  374. func _protobuf_generated_isEqualTo(other: Openapi_Plugin_V1_Request) -> Bool {
  375. if _storage !== other._storage {
  376. let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in
  377. if _storage._wrapper != other_storage._wrapper {return false}
  378. if _storage._outputPath != other_storage._outputPath {return false}
  379. if _storage._parameters != other_storage._parameters {return false}
  380. if _storage._compilerVersion != other_storage._compilerVersion {return false}
  381. return true
  382. }
  383. if !storagesAreEqual {return false}
  384. }
  385. if unknownFields != other.unknownFields {return false}
  386. return true
  387. }
  388. }
  389. extension Openapi_Plugin_V1_Response: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  390. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  391. 1: .same(proto: "errors"),
  392. 2: .same(proto: "files"),
  393. ]
  394. func _protobuf_generated_isEqualTo(other: Openapi_Plugin_V1_Response) -> Bool {
  395. if self.errors != other.errors {return false}
  396. if self.files != other.files {return false}
  397. if unknownFields != other.unknownFields {return false}
  398. return true
  399. }
  400. }
  401. extension Openapi_Plugin_V1_File: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  402. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  403. 1: .same(proto: "name"),
  404. 2: .same(proto: "data"),
  405. ]
  406. func _protobuf_generated_isEqualTo(other: Openapi_Plugin_V1_File) -> Bool {
  407. if self.name != other.name {return false}
  408. if self.data != other.data {return false}
  409. if unknownFields != other.unknownFields {return false}
  410. return true
  411. }
  412. }
  413. extension Openapi_Plugin_V1_Wrapper: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  414. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  415. 1: .same(proto: "name"),
  416. 2: .same(proto: "version"),
  417. 3: .same(proto: "value"),
  418. ]
  419. func _protobuf_generated_isEqualTo(other: Openapi_Plugin_V1_Wrapper) -> Bool {
  420. if self.name != other.name {return false}
  421. if self.version != other.version {return false}
  422. if self.value != other.value {return false}
  423. if unknownFields != other.unknownFields {return false}
  424. return true
  425. }
  426. }