File: plugin.pb.swift

package info (click to toggle)
golang-github-googleapis-gnostic 0.2.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,636 kB
  • sloc: makefile: 154; javascript: 106; sh: 57
file content (441 lines) | stat: -rw-r--r-- 17,808 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
// DO NOT EDIT.
//
// Generated by the Swift generator plugin for the protocol buffer compiler.
// Source: github.com/googleapis/gnostic/plugins/plugin.proto
//
// For information on using the generated types, please see the documenation:
//   https://github.com/apple/swift-protobuf/

// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// gnostic can be extended with plugins.  
// A plugin is uset a program that reads a Request from stdin 
// and writes a Response to stdout.
//
// A plugin executable needs only to be placed somewhere in the path.  The
// plugin should be named "gnostic_$NAME", and will then be used when the
// flag "--${NAME}_out" is passed to gnostic.

import Foundation
import SwiftProtobuf

// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that your are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  typealias Version = _2
}

/// The version number of gnostic.
public struct Gnostic_Plugin_V1_Version: SwiftProtobuf.Message {
  public static let protoMessageName: String = _protobuf_package + ".Version"

  public var major: Int32 = 0

  public var minor: Int32 = 0

  public var patch: Int32 = 0

  /// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
  /// be empty for mainline stable releases.
  public var suffix: String = String()

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}

  /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  /// initializers are defined in the SwiftProtobuf library. See the Message and
  /// Message+*Additions` files.
  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularInt32Field(value: &self.major)
      case 2: try decoder.decodeSingularInt32Field(value: &self.minor)
      case 3: try decoder.decodeSingularInt32Field(value: &self.patch)
      case 4: try decoder.decodeSingularStringField(value: &self.suffix)
      default: break
      }
    }
  }

  /// Used by the encoding methods of the SwiftProtobuf library, not generally
  /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  /// other serializer methods are defined in the SwiftProtobuf library. See the
  /// `Message` and `Message+*Additions` files.
  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if self.major != 0 {
      try visitor.visitSingularInt32Field(value: self.major, fieldNumber: 1)
    }
    if self.minor != 0 {
      try visitor.visitSingularInt32Field(value: self.minor, fieldNumber: 2)
    }
    if self.patch != 0 {
      try visitor.visitSingularInt32Field(value: self.patch, fieldNumber: 3)
    }
    if !self.suffix.isEmpty {
      try visitor.visitSingularStringField(value: self.suffix, fieldNumber: 4)
    }
    try unknownFields.traverse(visitor: &visitor)
  }
}

/// A parameter passed to the plugin from (or through) gnostic.
public struct Gnostic_Plugin_V1_Parameter: SwiftProtobuf.Message {
  public static let protoMessageName: String = _protobuf_package + ".Parameter"

  /// The name of the parameter as specified in the option string
  public var name: String = String()

  /// The parameter value as specified in the option string
  public var value: String = String()

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}

  /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  /// initializers are defined in the SwiftProtobuf library. See the Message and
  /// Message+*Additions` files.
  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularStringField(value: &self.name)
      case 2: try decoder.decodeSingularStringField(value: &self.value)
      default: break
      }
    }
  }

  /// Used by the encoding methods of the SwiftProtobuf library, not generally
  /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  /// other serializer methods are defined in the SwiftProtobuf library. See the
  /// `Message` and `Message+*Additions` files.
  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.name.isEmpty {
      try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
    }
    if !self.value.isEmpty {
      try visitor.visitSingularStringField(value: self.value, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }
}

/// An encoded Request is written to the plugin's stdin.
public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message {
  public static let protoMessageName: String = _protobuf_package + ".Request"

  /// filename or URL of the original source document
  public var sourceName: String {
    get {return _storage._sourceName}
    set {_uniqueStorage()._sourceName = newValue}
  }

  /// Output path specified in the plugin invocation.
  public var outputPath: String {
    get {return _storage._outputPath}
    set {_uniqueStorage()._outputPath = newValue}
  }

  /// Plugin parameters parsed from the invocation string.
  public var parameters: [Gnostic_Plugin_V1_Parameter] {
    get {return _storage._parameters}
    set {_uniqueStorage()._parameters = newValue}
  }

  /// The version number of gnostic.
  public var compilerVersion: Gnostic_Plugin_V1_Version {
    get {return _storage._compilerVersion ?? Gnostic_Plugin_V1_Version()}
    set {_uniqueStorage()._compilerVersion = newValue}
  }
  /// Returns true if `compilerVersion` has been explicitly set.
  public var hasCompilerVersion: Bool {return _storage._compilerVersion != nil}
  /// Clears the value of `compilerVersion`. Subsequent reads from it will return its default value.
  public mutating func clearCompilerVersion() {_storage._compilerVersion = nil}

  /// API models
  public var models: [SwiftProtobuf.Google_Protobuf_Any] {
    get {return _storage._models}
    set {_uniqueStorage()._models = newValue}
  }

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}

  /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  /// initializers are defined in the SwiftProtobuf library. See the Message and
  /// Message+*Additions` files.
  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    _ = _uniqueStorage()
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      while let fieldNumber = try decoder.nextFieldNumber() {
        switch fieldNumber {
        case 1: try decoder.decodeSingularStringField(value: &_storage._sourceName)
        case 2: try decoder.decodeSingularStringField(value: &_storage._outputPath)
        case 3: try decoder.decodeRepeatedMessageField(value: &_storage._parameters)
        case 4: try decoder.decodeSingularMessageField(value: &_storage._compilerVersion)
        case 5: try decoder.decodeRepeatedMessageField(value: &_storage._models)
        default: break
        }
      }
    }
  }

  /// Used by the encoding methods of the SwiftProtobuf library, not generally
  /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  /// other serializer methods are defined in the SwiftProtobuf library. See the
  /// `Message` and `Message+*Additions` files.
  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
      if !_storage._sourceName.isEmpty {
        try visitor.visitSingularStringField(value: _storage._sourceName, fieldNumber: 1)
      }
      if !_storage._outputPath.isEmpty {
        try visitor.visitSingularStringField(value: _storage._outputPath, fieldNumber: 2)
      }
      if !_storage._parameters.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._parameters, fieldNumber: 3)
      }
      if let v = _storage._compilerVersion {
        try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
      }
      if !_storage._models.isEmpty {
        try visitor.visitRepeatedMessageField(value: _storage._models, fieldNumber: 5)
      }
    }
    try unknownFields.traverse(visitor: &visitor)
  }

  fileprivate var _storage = _StorageClass.defaultInstance
}

/// The plugin writes an encoded Response to stdout.
public struct Gnostic_Plugin_V1_Response: SwiftProtobuf.Message {
  public static let protoMessageName: String = _protobuf_package + ".Response"

  /// Error message.  If non-empty, the plugin failed. 
  /// The plugin process should exit with status code zero 
  /// even if it reports an error in this way.
  ///
  /// This should be used to indicate errors which prevent the plugin from 
  /// operating as intended.  Errors which indicate a problem in gnostic 
  /// itself -- such as the input Document being unparseable -- should be 
  /// reported by writing a message to stderr and exiting with a non-zero 
  /// status code.
  public var errors: [String] = []

  /// file output, each file will be written by gnostic to an appropriate location.
  public var files: [Gnostic_Plugin_V1_File] = []

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}

  /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  /// initializers are defined in the SwiftProtobuf library. See the Message and
  /// Message+*Additions` files.
  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeRepeatedStringField(value: &self.errors)
      case 2: try decoder.decodeRepeatedMessageField(value: &self.files)
      default: break
      }
    }
  }

  /// Used by the encoding methods of the SwiftProtobuf library, not generally
  /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  /// other serializer methods are defined in the SwiftProtobuf library. See the
  /// `Message` and `Message+*Additions` files.
  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.errors.isEmpty {
      try visitor.visitRepeatedStringField(value: self.errors, fieldNumber: 1)
    }
    if !self.files.isEmpty {
      try visitor.visitRepeatedMessageField(value: self.files, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }
}

/// File describes a file generated by a plugin.
public struct Gnostic_Plugin_V1_File: SwiftProtobuf.Message {
  public static let protoMessageName: String = _protobuf_package + ".File"

  /// name of the file
  public var name: String = String()

  /// data to be written to the file
  public var data: Data = SwiftProtobuf.Internal.emptyData

  public var unknownFields = SwiftProtobuf.UnknownStorage()

  public init() {}

  /// Used by the decoding initializers in the SwiftProtobuf library, not generally
  /// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding
  /// initializers are defined in the SwiftProtobuf library. See the Message and
  /// Message+*Additions` files.
  public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
    while let fieldNumber = try decoder.nextFieldNumber() {
      switch fieldNumber {
      case 1: try decoder.decodeSingularStringField(value: &self.name)
      case 2: try decoder.decodeSingularBytesField(value: &self.data)
      default: break
      }
    }
  }

  /// Used by the encoding methods of the SwiftProtobuf library, not generally
  /// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and
  /// other serializer methods are defined in the SwiftProtobuf library. See the
  /// `Message` and `Message+*Additions` files.
  public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
    if !self.name.isEmpty {
      try visitor.visitSingularStringField(value: self.name, fieldNumber: 1)
    }
    if !self.data.isEmpty {
      try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2)
    }
    try unknownFields.traverse(visitor: &visitor)
  }
}

// MARK: - Code below here is support for the SwiftProtobuf runtime.

fileprivate let _protobuf_package = "gnostic.plugin.v1"

extension Gnostic_Plugin_V1_Version: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "major"),
    2: .same(proto: "minor"),
    3: .same(proto: "patch"),
    4: .same(proto: "suffix"),
  ]

  public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Version) -> Bool {
    if self.major != other.major {return false}
    if self.minor != other.minor {return false}
    if self.patch != other.patch {return false}
    if self.suffix != other.suffix {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Gnostic_Plugin_V1_Parameter: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "name"),
    2: .same(proto: "value"),
  ]

  public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Parameter) -> Bool {
    if self.name != other.name {return false}
    if self.value != other.value {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .standard(proto: "source_name"),
    2: .standard(proto: "output_path"),
    3: .same(proto: "parameters"),
    4: .standard(proto: "compiler_version"),
    5: .same(proto: "models"),
  ]

  fileprivate class _StorageClass {
    var _sourceName: String = String()
    var _outputPath: String = String()
    var _parameters: [Gnostic_Plugin_V1_Parameter] = []
    var _compilerVersion: Gnostic_Plugin_V1_Version? = nil
    var _models: [SwiftProtobuf.Google_Protobuf_Any] = []

    static let defaultInstance = _StorageClass()

    private init() {}

    init(copying source: _StorageClass) {
      _sourceName = source._sourceName
      _outputPath = source._outputPath
      _parameters = source._parameters
      _compilerVersion = source._compilerVersion
      _models = source._models
    }
  }

  fileprivate mutating func _uniqueStorage() -> _StorageClass {
    if !isKnownUniquelyReferenced(&_storage) {
      _storage = _StorageClass(copying: _storage)
    }
    return _storage
  }

  public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Request) -> Bool {
    if _storage !== other._storage {
      let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in
        if _storage._sourceName != other_storage._sourceName {return false}
        if _storage._outputPath != other_storage._outputPath {return false}
        if _storage._parameters != other_storage._parameters {return false}
        if _storage._compilerVersion != other_storage._compilerVersion {return false}
        if _storage._models != other_storage._models {return false}
        return true
      }
      if !storagesAreEqual {return false}
    }
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Gnostic_Plugin_V1_Response: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "errors"),
    2: .same(proto: "files"),
  ]

  public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Response) -> Bool {
    if self.errors != other.errors {return false}
    if self.files != other.files {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}

extension Gnostic_Plugin_V1_File: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
    1: .same(proto: "name"),
    2: .same(proto: "data"),
  ]

  public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_File) -> Bool {
    if self.name != other.name {return false}
    if self.data != other.data {return false}
    if unknownFields != other.unknownFields {return false}
    return true
  }
}