cx_api/generated/grpc.gateway.protoc_gen_openapiv2.options.rs
1// This file is @generated by prost-build.
2/// `Swagger` is a representation of OpenAPI v2 specification's Swagger object.
3///
4/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject>
5///
6/// Example:
7///
8/// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
9/// info: {
10/// title: "Echo API";
11/// version: "1.0";
12/// description: "";
13/// contact: {
14/// name: "gRPC-Gateway project";
15/// url: "<https://github.com/grpc-ecosystem/grpc-gateway";>
16/// email: "none@example.com";
17/// };
18/// license: {
19/// name: "BSD 3-Clause License";
20/// url: "<https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE";>
21/// };
22/// };
23/// schemes: HTTPS;
24/// consumes: "application/json";
25/// produces: "application/json";
26/// };
27///
28#[derive(serde::Serialize, serde::Deserialize)]
29#[serde(rename_all = "snake_case")]
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct Swagger {
32 /// Specifies the OpenAPI Specification version being used. It can be
33 /// used by the OpenAPI UI and other clients to interpret the API listing. The
34 /// value MUST be "2.0".
35 #[prost(string, tag = "1")]
36 pub swagger: ::prost::alloc::string::String,
37 /// Provides metadata about the API. The metadata can be used by the
38 /// clients if needed.
39 #[prost(message, optional, tag = "2")]
40 pub info: ::core::option::Option<Info>,
41 /// The host (name or ip) serving the API. This MUST be the host only and does
42 /// not include the scheme nor sub-paths. It MAY include a port. If the host is
43 /// not included, the host serving the documentation is to be used (including
44 /// the port). The host does not support path templating.
45 #[prost(string, tag = "3")]
46 pub host: ::prost::alloc::string::String,
47 /// The base path on which the API is served, which is relative to the host. If
48 /// it is not included, the API is served directly under the host. The value
49 /// MUST start with a leading slash (/). The basePath does not support path
50 /// templating.
51 /// Note that using `base_path` does not change the endpoint paths that are
52 /// generated in the resulting OpenAPI file. If you wish to use `base_path`
53 /// with relatively generated OpenAPI paths, the `base_path` prefix must be
54 /// manually removed from your `google.api.http` paths and your code changed to
55 /// serve the API from the `base_path`.
56 #[prost(string, tag = "4")]
57 pub base_path: ::prost::alloc::string::String,
58 /// The transfer protocol of the API. Values MUST be from the list: "http",
59 /// "https", "ws", "wss". If the schemes is not included, the default scheme to
60 /// be used is the one used to access the OpenAPI definition itself.
61 #[prost(enumeration = "Scheme", repeated, tag = "5")]
62 pub schemes: ::prost::alloc::vec::Vec<i32>,
63 /// A list of MIME types the APIs can consume. This is global to all APIs but
64 /// can be overridden on specific API calls. Value MUST be as described under
65 /// Mime Types.
66 #[prost(string, repeated, tag = "6")]
67 pub consumes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
68 /// A list of MIME types the APIs can produce. This is global to all APIs but
69 /// can be overridden on specific API calls. Value MUST be as described under
70 /// Mime Types.
71 #[prost(string, repeated, tag = "7")]
72 pub produces: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
73 /// An object to hold responses that can be used across operations. This
74 /// property does not define global responses for all operations.
75 #[prost(map = "string, message", tag = "10")]
76 pub responses: ::std::collections::HashMap<::prost::alloc::string::String, Response>,
77 /// Security scheme definitions that can be used across the specification.
78 #[prost(message, optional, tag = "11")]
79 pub security_definitions: ::core::option::Option<SecurityDefinitions>,
80 /// A declaration of which security schemes are applied for the API as a whole.
81 /// The list of values describes alternative security schemes that can be used
82 /// (that is, there is a logical OR between the security requirements).
83 /// Individual operations can override this definition.
84 #[prost(message, repeated, tag = "12")]
85 pub security: ::prost::alloc::vec::Vec<SecurityRequirement>,
86 /// A list of tags for API documentation control. Tags can be used for logical
87 /// grouping of operations by resources or any other qualifier.
88 #[prost(message, repeated, tag = "13")]
89 pub tags: ::prost::alloc::vec::Vec<Tag>,
90 /// Additional external documentation.
91 #[prost(message, optional, tag = "14")]
92 pub external_docs: ::core::option::Option<ExternalDocumentation>,
93 /// Custom properties that start with "x-" such as "x-foo" used to describe
94 /// extra functionality that is not covered by the standard OpenAPI Specification.
95 /// See: <https://swagger.io/docs/specification/2-0/swagger-extensions/>
96 #[prost(map = "string, message", tag = "15")]
97 pub extensions: ::std::collections::HashMap<
98 ::prost::alloc::string::String,
99 ::prost_wkt_types::Value,
100 >,
101}
102/// `Operation` is a representation of OpenAPI v2 specification's Operation object.
103///
104/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject>
105///
106/// Example:
107///
108/// service EchoService {
109/// rpc Echo(SimpleMessage) returns (SimpleMessage) {
110/// option (google.api.http) = {
111/// get: "/v1/example/echo/{id}"
112/// };
113///
114/// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
115/// summary: "Get a message.";
116/// operation_id: "getMessage";
117/// tags: "echo";
118/// responses: {
119/// key: "200"
120/// value: {
121/// description: "OK";
122/// }
123/// }
124/// };
125/// }
126/// }
127#[derive(serde::Serialize, serde::Deserialize)]
128#[serde(rename_all = "snake_case")]
129#[derive(Clone, PartialEq, ::prost::Message)]
130pub struct Operation {
131 /// A list of tags for API documentation control. Tags can be used for logical
132 /// grouping of operations by resources or any other qualifier.
133 #[prost(string, repeated, tag = "1")]
134 pub tags: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
135 /// A short summary of what the operation does. For maximum readability in the
136 /// swagger-ui, this field SHOULD be less than 120 characters.
137 #[prost(string, tag = "2")]
138 pub summary: ::prost::alloc::string::String,
139 /// A verbose explanation of the operation behavior. GFM syntax can be used for
140 /// rich text representation.
141 #[prost(string, tag = "3")]
142 pub description: ::prost::alloc::string::String,
143 /// Additional external documentation for this operation.
144 #[prost(message, optional, tag = "4")]
145 pub external_docs: ::core::option::Option<ExternalDocumentation>,
146 /// Unique string used to identify the operation. The id MUST be unique among
147 /// all operations described in the API. Tools and libraries MAY use the
148 /// operationId to uniquely identify an operation, therefore, it is recommended
149 /// to follow common programming naming conventions.
150 #[prost(string, tag = "5")]
151 pub operation_id: ::prost::alloc::string::String,
152 /// A list of MIME types the operation can consume. This overrides the consumes
153 /// definition at the OpenAPI Object. An empty value MAY be used to clear the
154 /// global definition. Value MUST be as described under Mime Types.
155 #[prost(string, repeated, tag = "6")]
156 pub consumes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
157 /// A list of MIME types the operation can produce. This overrides the produces
158 /// definition at the OpenAPI Object. An empty value MAY be used to clear the
159 /// global definition. Value MUST be as described under Mime Types.
160 #[prost(string, repeated, tag = "7")]
161 pub produces: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
162 /// The list of possible responses as they are returned from executing this
163 /// operation.
164 #[prost(map = "string, message", tag = "9")]
165 pub responses: ::std::collections::HashMap<::prost::alloc::string::String, Response>,
166 /// The transfer protocol for the operation. Values MUST be from the list:
167 /// "http", "https", "ws", "wss". The value overrides the OpenAPI Object
168 /// schemes definition.
169 #[prost(enumeration = "Scheme", repeated, tag = "10")]
170 pub schemes: ::prost::alloc::vec::Vec<i32>,
171 /// Declares this operation to be deprecated. Usage of the declared operation
172 /// should be refrained. Default value is false.
173 #[prost(bool, tag = "11")]
174 pub deprecated: bool,
175 /// A declaration of which security schemes are applied for this operation. The
176 /// list of values describes alternative security schemes that can be used
177 /// (that is, there is a logical OR between the security requirements). This
178 /// definition overrides any declared top-level security. To remove a top-level
179 /// security declaration, an empty array can be used.
180 #[prost(message, repeated, tag = "12")]
181 pub security: ::prost::alloc::vec::Vec<SecurityRequirement>,
182 /// Custom properties that start with "x-" such as "x-foo" used to describe
183 /// extra functionality that is not covered by the standard OpenAPI Specification.
184 /// See: <https://swagger.io/docs/specification/2-0/swagger-extensions/>
185 #[prost(map = "string, message", tag = "13")]
186 pub extensions: ::std::collections::HashMap<
187 ::prost::alloc::string::String,
188 ::prost_wkt_types::Value,
189 >,
190 /// Custom parameters such as HTTP request headers.
191 /// See: <https://swagger.io/docs/specification/2-0/describing-parameters/>
192 /// and <https://swagger.io/specification/v2/#parameter-object.>
193 #[prost(message, optional, tag = "14")]
194 pub parameters: ::core::option::Option<Parameters>,
195}
196/// `Parameters` is a representation of OpenAPI v2 specification's parameters object.
197/// Note: This technically breaks compatibility with the OpenAPI 2 definition structure as we only
198/// allow header parameters to be set here since we do not want users specifying custom non-header
199/// parameters beyond those inferred from the Protobuf schema.
200/// See: <https://swagger.io/specification/v2/#parameter-object>
201#[derive(serde::Serialize, serde::Deserialize)]
202#[serde(rename_all = "snake_case")]
203#[derive(Clone, PartialEq, ::prost::Message)]
204pub struct Parameters {
205 /// `Headers` is one or more HTTP header parameter.
206 /// See: <https://swagger.io/docs/specification/2-0/describing-parameters/#header-parameters>
207 #[prost(message, repeated, tag = "1")]
208 pub headers: ::prost::alloc::vec::Vec<HeaderParameter>,
209}
210/// `HeaderParameter` a HTTP header parameter.
211/// See: <https://swagger.io/specification/v2/#parameter-object>
212#[derive(serde::Serialize, serde::Deserialize)]
213#[serde(rename_all = "snake_case")]
214#[derive(Clone, PartialEq, ::prost::Message)]
215pub struct HeaderParameter {
216 /// `Name` is the header name.
217 #[prost(string, tag = "1")]
218 pub name: ::prost::alloc::string::String,
219 /// `Description` is a short description of the header.
220 #[prost(string, tag = "2")]
221 pub description: ::prost::alloc::string::String,
222 /// `Type` is the type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported.
223 /// See: <https://swagger.io/specification/v2/#parameterType.>
224 #[prost(enumeration = "header_parameter::Type", tag = "3")]
225 pub r#type: i32,
226 /// `Format` The extending format for the previously mentioned type.
227 #[prost(string, tag = "4")]
228 pub format: ::prost::alloc::string::String,
229 /// `Required` indicates if the header is optional
230 #[prost(bool, tag = "5")]
231 pub required: bool,
232}
233/// Nested message and enum types in `HeaderParameter`.
234pub mod header_parameter {
235 /// `Type` is a supported HTTP header type.
236 /// See <https://swagger.io/specification/v2/#parameterType.>
237 #[derive(serde::Serialize, serde::Deserialize)]
238 #[serde(rename_all = "snake_case")]
239 #[derive(
240 Clone,
241 Copy,
242 Debug,
243 PartialEq,
244 Eq,
245 Hash,
246 PartialOrd,
247 Ord,
248 ::prost::Enumeration
249 )]
250 #[repr(i32)]
251 pub enum Type {
252 Unknown = 0,
253 String = 1,
254 Number = 2,
255 Integer = 3,
256 Boolean = 4,
257 }
258 impl Type {
259 /// String value of the enum field names used in the ProtoBuf definition.
260 ///
261 /// The values are not transformed in any way and thus are considered stable
262 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
263 pub fn as_str_name(&self) -> &'static str {
264 match self {
265 Self::Unknown => "UNKNOWN",
266 Self::String => "STRING",
267 Self::Number => "NUMBER",
268 Self::Integer => "INTEGER",
269 Self::Boolean => "BOOLEAN",
270 }
271 }
272 /// Creates an enum from field names used in the ProtoBuf definition.
273 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
274 match value {
275 "UNKNOWN" => Some(Self::Unknown),
276 "STRING" => Some(Self::String),
277 "NUMBER" => Some(Self::Number),
278 "INTEGER" => Some(Self::Integer),
279 "BOOLEAN" => Some(Self::Boolean),
280 _ => None,
281 }
282 }
283 }
284}
285/// `Header` is a representation of OpenAPI v2 specification's Header object.
286///
287/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject>
288///
289#[derive(serde::Serialize, serde::Deserialize)]
290#[serde(rename_all = "snake_case")]
291#[derive(Clone, PartialEq, ::prost::Message)]
292pub struct Header {
293 /// `Description` is a short description of the header.
294 #[prost(string, tag = "1")]
295 pub description: ::prost::alloc::string::String,
296 /// The type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported.
297 #[prost(string, tag = "2")]
298 pub r#type: ::prost::alloc::string::String,
299 /// `Format` The extending format for the previously mentioned type.
300 #[prost(string, tag = "3")]
301 pub format: ::prost::alloc::string::String,
302 /// `Default` Declares the value of the header that the server will use if none is provided.
303 /// See: <https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2.>
304 /// Unlike JSON Schema this value MUST conform to the defined type for the header.
305 #[prost(string, tag = "6")]
306 pub default: ::prost::alloc::string::String,
307 /// 'Pattern' See <https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3.>
308 #[prost(string, tag = "13")]
309 pub pattern: ::prost::alloc::string::String,
310}
311/// `Response` is a representation of OpenAPI v2 specification's Response object.
312///
313/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject>
314///
315#[derive(serde::Serialize, serde::Deserialize)]
316#[serde(rename_all = "snake_case")]
317#[derive(Clone, PartialEq, ::prost::Message)]
318pub struct Response {
319 /// `Description` is a short description of the response.
320 /// GFM syntax can be used for rich text representation.
321 #[prost(string, tag = "1")]
322 pub description: ::prost::alloc::string::String,
323 /// `Schema` optionally defines the structure of the response.
324 /// If `Schema` is not provided, it means there is no content to the response.
325 #[prost(message, optional, tag = "2")]
326 pub schema: ::core::option::Option<Schema>,
327 /// `Headers` A list of headers that are sent with the response.
328 /// `Header` name is expected to be a string in the canonical format of the MIME header key
329 /// See: <https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey>
330 #[prost(map = "string, message", tag = "3")]
331 pub headers: ::std::collections::HashMap<::prost::alloc::string::String, Header>,
332 /// `Examples` gives per-mimetype response examples.
333 /// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object>
334 #[prost(map = "string, string", tag = "4")]
335 pub examples: ::std::collections::HashMap<
336 ::prost::alloc::string::String,
337 ::prost::alloc::string::String,
338 >,
339 /// Custom properties that start with "x-" such as "x-foo" used to describe
340 /// extra functionality that is not covered by the standard OpenAPI Specification.
341 /// See: <https://swagger.io/docs/specification/2-0/swagger-extensions/>
342 #[prost(map = "string, message", tag = "5")]
343 pub extensions: ::std::collections::HashMap<
344 ::prost::alloc::string::String,
345 ::prost_wkt_types::Value,
346 >,
347}
348/// `Info` is a representation of OpenAPI v2 specification's Info object.
349///
350/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject>
351///
352/// Example:
353///
354/// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
355/// info: {
356/// title: "Echo API";
357/// version: "1.0";
358/// description: "";
359/// contact: {
360/// name: "gRPC-Gateway project";
361/// url: "<https://github.com/grpc-ecosystem/grpc-gateway";>
362/// email: "none@example.com";
363/// };
364/// license: {
365/// name: "BSD 3-Clause License";
366/// url: "<https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE";>
367/// };
368/// };
369/// ...
370/// };
371///
372#[derive(serde::Serialize, serde::Deserialize)]
373#[serde(rename_all = "snake_case")]
374#[derive(Clone, PartialEq, ::prost::Message)]
375pub struct Info {
376 /// The title of the application.
377 #[prost(string, tag = "1")]
378 pub title: ::prost::alloc::string::String,
379 /// A short description of the application. GFM syntax can be used for rich
380 /// text representation.
381 #[prost(string, tag = "2")]
382 pub description: ::prost::alloc::string::String,
383 /// The Terms of Service for the API.
384 #[prost(string, tag = "3")]
385 pub terms_of_service: ::prost::alloc::string::String,
386 /// The contact information for the exposed API.
387 #[prost(message, optional, tag = "4")]
388 pub contact: ::core::option::Option<Contact>,
389 /// The license information for the exposed API.
390 #[prost(message, optional, tag = "5")]
391 pub license: ::core::option::Option<License>,
392 /// Provides the version of the application API (not to be confused
393 /// with the specification version).
394 #[prost(string, tag = "6")]
395 pub version: ::prost::alloc::string::String,
396 /// Custom properties that start with "x-" such as "x-foo" used to describe
397 /// extra functionality that is not covered by the standard OpenAPI Specification.
398 /// See: <https://swagger.io/docs/specification/2-0/swagger-extensions/>
399 #[prost(map = "string, message", tag = "7")]
400 pub extensions: ::std::collections::HashMap<
401 ::prost::alloc::string::String,
402 ::prost_wkt_types::Value,
403 >,
404}
405/// `Contact` is a representation of OpenAPI v2 specification's Contact object.
406///
407/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject>
408///
409/// Example:
410///
411/// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
412/// info: {
413/// ...
414/// contact: {
415/// name: "gRPC-Gateway project";
416/// url: "<https://github.com/grpc-ecosystem/grpc-gateway";>
417/// email: "none@example.com";
418/// };
419/// ...
420/// };
421/// ...
422/// };
423///
424#[derive(serde::Serialize, serde::Deserialize)]
425#[serde(rename_all = "snake_case")]
426#[derive(Clone, PartialEq, ::prost::Message)]
427pub struct Contact {
428 /// The identifying name of the contact person/organization.
429 #[prost(string, tag = "1")]
430 pub name: ::prost::alloc::string::String,
431 /// The URL pointing to the contact information. MUST be in the format of a
432 /// URL.
433 #[prost(string, tag = "2")]
434 pub url: ::prost::alloc::string::String,
435 /// The email address of the contact person/organization. MUST be in the format
436 /// of an email address.
437 #[prost(string, tag = "3")]
438 pub email: ::prost::alloc::string::String,
439}
440/// `License` is a representation of OpenAPI v2 specification's License object.
441///
442/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject>
443///
444/// Example:
445///
446/// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
447/// info: {
448/// ...
449/// license: {
450/// name: "BSD 3-Clause License";
451/// url: "<https://github.com/grpc-ecosystem/grpc-gateway/blob/main/LICENSE";>
452/// };
453/// ...
454/// };
455/// ...
456/// };
457///
458#[derive(serde::Serialize, serde::Deserialize)]
459#[serde(rename_all = "snake_case")]
460#[derive(Clone, PartialEq, ::prost::Message)]
461pub struct License {
462 /// The license name used for the API.
463 #[prost(string, tag = "1")]
464 pub name: ::prost::alloc::string::String,
465 /// A URL to the license used for the API. MUST be in the format of a URL.
466 #[prost(string, tag = "2")]
467 pub url: ::prost::alloc::string::String,
468}
469/// `ExternalDocumentation` is a representation of OpenAPI v2 specification's
470/// ExternalDocumentation object.
471///
472/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject>
473///
474/// Example:
475///
476/// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
477/// ...
478/// external_docs: {
479/// description: "More about gRPC-Gateway";
480/// url: "<https://github.com/grpc-ecosystem/grpc-gateway";>
481/// }
482/// ...
483/// };
484///
485#[derive(serde::Serialize, serde::Deserialize)]
486#[serde(rename_all = "snake_case")]
487#[derive(Clone, PartialEq, ::prost::Message)]
488pub struct ExternalDocumentation {
489 /// A short description of the target documentation. GFM syntax can be used for
490 /// rich text representation.
491 #[prost(string, tag = "1")]
492 pub description: ::prost::alloc::string::String,
493 /// The URL for the target documentation. Value MUST be in the format
494 /// of a URL.
495 #[prost(string, tag = "2")]
496 pub url: ::prost::alloc::string::String,
497}
498/// `Schema` is a representation of OpenAPI v2 specification's Schema object.
499///
500/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject>
501///
502#[derive(serde::Serialize, serde::Deserialize)]
503#[serde(rename_all = "snake_case")]
504#[derive(Clone, PartialEq, ::prost::Message)]
505pub struct Schema {
506 #[prost(message, optional, tag = "1")]
507 pub json_schema: ::core::option::Option<JsonSchema>,
508 /// Adds support for polymorphism. The discriminator is the schema property
509 /// name that is used to differentiate between other schema that inherit this
510 /// schema. The property name used MUST be defined at this schema and it MUST
511 /// be in the required property list. When used, the value MUST be the name of
512 /// this schema or any schema that inherits it.
513 #[prost(string, tag = "2")]
514 pub discriminator: ::prost::alloc::string::String,
515 /// Relevant only for Schema "properties" definitions. Declares the property as
516 /// "read only". This means that it MAY be sent as part of a response but MUST
517 /// NOT be sent as part of the request. Properties marked as readOnly being
518 /// true SHOULD NOT be in the required list of the defined schema. Default
519 /// value is false.
520 #[prost(bool, tag = "3")]
521 pub read_only: bool,
522 /// Additional external documentation for this schema.
523 #[prost(message, optional, tag = "5")]
524 pub external_docs: ::core::option::Option<ExternalDocumentation>,
525 /// A free-form property to include an example of an instance for this schema in JSON.
526 /// This is copied verbatim to the output.
527 #[prost(string, tag = "6")]
528 pub example: ::prost::alloc::string::String,
529}
530/// `JSONSchema` represents properties from JSON Schema taken, and as used, in
531/// the OpenAPI v2 spec.
532///
533/// This includes changes made by OpenAPI v2.
534///
535/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject>
536///
537/// See also: <https://cswr.github.io/JsonSchema/spec/basic_types/,>
538/// <https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json>
539///
540/// Example:
541///
542/// message SimpleMessage {
543/// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = {
544/// json_schema: {
545/// title: "SimpleMessage"
546/// description: "A simple message."
547/// required: \["id"\]
548/// }
549/// };
550///
551/// // Id represents the message identifier.
552/// string id = 1; [
553/// (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
554/// description: "The unique identifier of the simple message."
555/// }];
556/// }
557///
558#[derive(serde::Serialize, serde::Deserialize)]
559#[serde(rename_all = "snake_case")]
560#[derive(Clone, PartialEq, ::prost::Message)]
561pub struct JsonSchema {
562 /// Ref is used to define an external reference to include in the message.
563 /// This could be a fully qualified proto message reference, and that type must
564 /// be imported into the protofile. If no message is identified, the Ref will
565 /// be used verbatim in the output.
566 /// For example:
567 /// `ref: ".google.protobuf.Timestamp"`.
568 #[prost(string, tag = "3")]
569 pub r#ref: ::prost::alloc::string::String,
570 /// The title of the schema.
571 #[prost(string, tag = "5")]
572 pub title: ::prost::alloc::string::String,
573 /// A short description of the schema.
574 #[prost(string, tag = "6")]
575 pub description: ::prost::alloc::string::String,
576 #[prost(string, tag = "7")]
577 pub default: ::prost::alloc::string::String,
578 #[prost(bool, tag = "8")]
579 pub read_only: bool,
580 /// A free-form property to include a JSON example of this field. This is copied
581 /// verbatim to the output swagger.json. Quotes must be escaped.
582 /// This property is the same for 2.0 and 3.0.0 <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#schemaObject> <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject>
583 #[prost(string, tag = "9")]
584 pub example: ::prost::alloc::string::String,
585 #[prost(double, tag = "10")]
586 pub multiple_of: f64,
587 /// Maximum represents an inclusive upper limit for a numeric instance. The
588 /// value of MUST be a number,
589 #[prost(double, tag = "11")]
590 pub maximum: f64,
591 #[prost(bool, tag = "12")]
592 pub exclusive_maximum: bool,
593 /// minimum represents an inclusive lower limit for a numeric instance. The
594 /// value of MUST be a number,
595 #[prost(double, tag = "13")]
596 pub minimum: f64,
597 #[prost(bool, tag = "14")]
598 pub exclusive_minimum: bool,
599 #[prost(uint64, tag = "15")]
600 pub max_length: u64,
601 #[prost(uint64, tag = "16")]
602 pub min_length: u64,
603 #[prost(string, tag = "17")]
604 pub pattern: ::prost::alloc::string::String,
605 #[prost(uint64, tag = "20")]
606 pub max_items: u64,
607 #[prost(uint64, tag = "21")]
608 pub min_items: u64,
609 #[prost(bool, tag = "22")]
610 pub unique_items: bool,
611 #[prost(uint64, tag = "24")]
612 pub max_properties: u64,
613 #[prost(uint64, tag = "25")]
614 pub min_properties: u64,
615 #[prost(string, repeated, tag = "26")]
616 pub required: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
617 /// Items in 'array' must be unique.
618 #[prost(string, repeated, tag = "34")]
619 pub array: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
620 #[prost(enumeration = "json_schema::JsonSchemaSimpleTypes", repeated, tag = "35")]
621 pub r#type: ::prost::alloc::vec::Vec<i32>,
622 /// `Format`
623 #[prost(string, tag = "36")]
624 pub format: ::prost::alloc::string::String,
625 /// Items in `enum` must be unique <https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1>
626 #[prost(string, repeated, tag = "46")]
627 pub r#enum: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
628 /// Additional field level properties used when generating the OpenAPI v2 file.
629 #[prost(message, optional, tag = "1001")]
630 pub field_configuration: ::core::option::Option<json_schema::FieldConfiguration>,
631 /// Custom properties that start with "x-" such as "x-foo" used to describe
632 /// extra functionality that is not covered by the standard OpenAPI Specification.
633 /// See: <https://swagger.io/docs/specification/2-0/swagger-extensions/>
634 #[prost(map = "string, message", tag = "48")]
635 pub extensions: ::std::collections::HashMap<
636 ::prost::alloc::string::String,
637 ::prost_wkt_types::Value,
638 >,
639}
640/// Nested message and enum types in `JSONSchema`.
641pub mod json_schema {
642 /// 'FieldConfiguration' provides additional field level properties used when generating the OpenAPI v2 file.
643 /// These properties are not defined by OpenAPIv2, but they are used to control the generation.
644 #[derive(serde::Serialize, serde::Deserialize)]
645 #[serde(rename_all = "snake_case")]
646 #[derive(Clone, PartialEq, ::prost::Message)]
647 pub struct FieldConfiguration {
648 /// Alternative parameter name when used as path parameter. If set, this will
649 /// be used as the complete parameter name when this field is used as a path
650 /// parameter. Use this to avoid having auto generated path parameter names
651 /// for overlapping paths.
652 #[prost(string, tag = "47")]
653 pub path_param_name: ::prost::alloc::string::String,
654 }
655 #[derive(serde::Serialize, serde::Deserialize)]
656 #[serde(rename_all = "snake_case")]
657 #[derive(
658 Clone,
659 Copy,
660 Debug,
661 PartialEq,
662 Eq,
663 Hash,
664 PartialOrd,
665 Ord,
666 ::prost::Enumeration
667 )]
668 #[repr(i32)]
669 pub enum JsonSchemaSimpleTypes {
670 Unknown = 0,
671 Array = 1,
672 Boolean = 2,
673 Integer = 3,
674 Null = 4,
675 Number = 5,
676 Object = 6,
677 String = 7,
678 }
679 impl JsonSchemaSimpleTypes {
680 /// String value of the enum field names used in the ProtoBuf definition.
681 ///
682 /// The values are not transformed in any way and thus are considered stable
683 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
684 pub fn as_str_name(&self) -> &'static str {
685 match self {
686 Self::Unknown => "UNKNOWN",
687 Self::Array => "ARRAY",
688 Self::Boolean => "BOOLEAN",
689 Self::Integer => "INTEGER",
690 Self::Null => "NULL",
691 Self::Number => "NUMBER",
692 Self::Object => "OBJECT",
693 Self::String => "STRING",
694 }
695 }
696 /// Creates an enum from field names used in the ProtoBuf definition.
697 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
698 match value {
699 "UNKNOWN" => Some(Self::Unknown),
700 "ARRAY" => Some(Self::Array),
701 "BOOLEAN" => Some(Self::Boolean),
702 "INTEGER" => Some(Self::Integer),
703 "NULL" => Some(Self::Null),
704 "NUMBER" => Some(Self::Number),
705 "OBJECT" => Some(Self::Object),
706 "STRING" => Some(Self::String),
707 _ => None,
708 }
709 }
710 }
711}
712/// `Tag` is a representation of OpenAPI v2 specification's Tag object.
713///
714/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject>
715///
716#[derive(serde::Serialize, serde::Deserialize)]
717#[serde(rename_all = "snake_case")]
718#[derive(Clone, PartialEq, ::prost::Message)]
719pub struct Tag {
720 /// The name of the tag. Use it to allow override of the name of a
721 /// global Tag object, then use that name to reference the tag throughout the
722 /// OpenAPI file.
723 #[prost(string, tag = "1")]
724 pub name: ::prost::alloc::string::String,
725 /// A short description for the tag. GFM syntax can be used for rich text
726 /// representation.
727 #[prost(string, tag = "2")]
728 pub description: ::prost::alloc::string::String,
729 /// Additional external documentation for this tag.
730 #[prost(message, optional, tag = "3")]
731 pub external_docs: ::core::option::Option<ExternalDocumentation>,
732 /// Custom properties that start with "x-" such as "x-foo" used to describe
733 /// extra functionality that is not covered by the standard OpenAPI Specification.
734 /// See: <https://swagger.io/docs/specification/2-0/swagger-extensions/>
735 #[prost(map = "string, message", tag = "4")]
736 pub extensions: ::std::collections::HashMap<
737 ::prost::alloc::string::String,
738 ::prost_wkt_types::Value,
739 >,
740}
741/// `SecurityDefinitions` is a representation of OpenAPI v2 specification's
742/// Security Definitions object.
743///
744/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject>
745///
746/// A declaration of the security schemes available to be used in the
747/// specification. This does not enforce the security schemes on the operations
748/// and only serves to provide the relevant details for each scheme.
749#[derive(serde::Serialize, serde::Deserialize)]
750#[serde(rename_all = "snake_case")]
751#[derive(Clone, PartialEq, ::prost::Message)]
752pub struct SecurityDefinitions {
753 /// A single security scheme definition, mapping a "name" to the scheme it
754 /// defines.
755 #[prost(map = "string, message", tag = "1")]
756 pub security: ::std::collections::HashMap<
757 ::prost::alloc::string::String,
758 SecurityScheme,
759 >,
760}
761/// `SecurityScheme` is a representation of OpenAPI v2 specification's
762/// Security Scheme object.
763///
764/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject>
765///
766/// Allows the definition of a security scheme that can be used by the
767/// operations. Supported schemes are basic authentication, an API key (either as
768/// a header or as a query parameter) and OAuth2's common flows (implicit,
769/// password, application and access code).
770#[derive(serde::Serialize, serde::Deserialize)]
771#[serde(rename_all = "snake_case")]
772#[derive(Clone, PartialEq, ::prost::Message)]
773pub struct SecurityScheme {
774 /// The type of the security scheme. Valid values are "basic",
775 /// "apiKey" or "oauth2".
776 #[prost(enumeration = "security_scheme::Type", tag = "1")]
777 pub r#type: i32,
778 /// A short description for security scheme.
779 #[prost(string, tag = "2")]
780 pub description: ::prost::alloc::string::String,
781 /// The name of the header or query parameter to be used.
782 /// Valid for apiKey.
783 #[prost(string, tag = "3")]
784 pub name: ::prost::alloc::string::String,
785 /// The location of the API key. Valid values are "query" or
786 /// "header".
787 /// Valid for apiKey.
788 #[prost(enumeration = "security_scheme::In", tag = "4")]
789 pub r#in: i32,
790 /// The flow used by the OAuth2 security scheme. Valid values are
791 /// "implicit", "password", "application" or "accessCode".
792 /// Valid for oauth2.
793 #[prost(enumeration = "security_scheme::Flow", tag = "5")]
794 pub flow: i32,
795 /// The authorization URL to be used for this flow. This SHOULD be in
796 /// the form of a URL.
797 /// Valid for oauth2/implicit and oauth2/accessCode.
798 #[prost(string, tag = "6")]
799 pub authorization_url: ::prost::alloc::string::String,
800 /// The token URL to be used for this flow. This SHOULD be in the
801 /// form of a URL.
802 /// Valid for oauth2/password, oauth2/application and oauth2/accessCode.
803 #[prost(string, tag = "7")]
804 pub token_url: ::prost::alloc::string::String,
805 /// The available scopes for the OAuth2 security scheme.
806 /// Valid for oauth2.
807 #[prost(message, optional, tag = "8")]
808 pub scopes: ::core::option::Option<Scopes>,
809 /// Custom properties that start with "x-" such as "x-foo" used to describe
810 /// extra functionality that is not covered by the standard OpenAPI Specification.
811 /// See: <https://swagger.io/docs/specification/2-0/swagger-extensions/>
812 #[prost(map = "string, message", tag = "9")]
813 pub extensions: ::std::collections::HashMap<
814 ::prost::alloc::string::String,
815 ::prost_wkt_types::Value,
816 >,
817}
818/// Nested message and enum types in `SecurityScheme`.
819pub mod security_scheme {
820 /// The type of the security scheme. Valid values are "basic",
821 /// "apiKey" or "oauth2".
822 #[derive(serde::Serialize, serde::Deserialize)]
823 #[serde(rename_all = "snake_case")]
824 #[derive(
825 Clone,
826 Copy,
827 Debug,
828 PartialEq,
829 Eq,
830 Hash,
831 PartialOrd,
832 Ord,
833 ::prost::Enumeration
834 )]
835 #[repr(i32)]
836 pub enum Type {
837 Invalid = 0,
838 Basic = 1,
839 ApiKey = 2,
840 Oauth2 = 3,
841 }
842 impl Type {
843 /// String value of the enum field names used in the ProtoBuf definition.
844 ///
845 /// The values are not transformed in any way and thus are considered stable
846 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
847 pub fn as_str_name(&self) -> &'static str {
848 match self {
849 Self::Invalid => "TYPE_INVALID",
850 Self::Basic => "TYPE_BASIC",
851 Self::ApiKey => "TYPE_API_KEY",
852 Self::Oauth2 => "TYPE_OAUTH2",
853 }
854 }
855 /// Creates an enum from field names used in the ProtoBuf definition.
856 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
857 match value {
858 "TYPE_INVALID" => Some(Self::Invalid),
859 "TYPE_BASIC" => Some(Self::Basic),
860 "TYPE_API_KEY" => Some(Self::ApiKey),
861 "TYPE_OAUTH2" => Some(Self::Oauth2),
862 _ => None,
863 }
864 }
865 }
866 /// The location of the API key. Valid values are "query" or "header".
867 #[derive(serde::Serialize, serde::Deserialize)]
868 #[serde(rename_all = "snake_case")]
869 #[derive(
870 Clone,
871 Copy,
872 Debug,
873 PartialEq,
874 Eq,
875 Hash,
876 PartialOrd,
877 Ord,
878 ::prost::Enumeration
879 )]
880 #[repr(i32)]
881 pub enum In {
882 Invalid = 0,
883 Query = 1,
884 Header = 2,
885 }
886 impl In {
887 /// String value of the enum field names used in the ProtoBuf definition.
888 ///
889 /// The values are not transformed in any way and thus are considered stable
890 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
891 pub fn as_str_name(&self) -> &'static str {
892 match self {
893 Self::Invalid => "IN_INVALID",
894 Self::Query => "IN_QUERY",
895 Self::Header => "IN_HEADER",
896 }
897 }
898 /// Creates an enum from field names used in the ProtoBuf definition.
899 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
900 match value {
901 "IN_INVALID" => Some(Self::Invalid),
902 "IN_QUERY" => Some(Self::Query),
903 "IN_HEADER" => Some(Self::Header),
904 _ => None,
905 }
906 }
907 }
908 /// The flow used by the OAuth2 security scheme. Valid values are
909 /// "implicit", "password", "application" or "accessCode".
910 #[derive(serde::Serialize, serde::Deserialize)]
911 #[serde(rename_all = "snake_case")]
912 #[derive(
913 Clone,
914 Copy,
915 Debug,
916 PartialEq,
917 Eq,
918 Hash,
919 PartialOrd,
920 Ord,
921 ::prost::Enumeration
922 )]
923 #[repr(i32)]
924 pub enum Flow {
925 Invalid = 0,
926 Implicit = 1,
927 Password = 2,
928 Application = 3,
929 AccessCode = 4,
930 }
931 impl Flow {
932 /// String value of the enum field names used in the ProtoBuf definition.
933 ///
934 /// The values are not transformed in any way and thus are considered stable
935 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
936 pub fn as_str_name(&self) -> &'static str {
937 match self {
938 Self::Invalid => "FLOW_INVALID",
939 Self::Implicit => "FLOW_IMPLICIT",
940 Self::Password => "FLOW_PASSWORD",
941 Self::Application => "FLOW_APPLICATION",
942 Self::AccessCode => "FLOW_ACCESS_CODE",
943 }
944 }
945 /// Creates an enum from field names used in the ProtoBuf definition.
946 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
947 match value {
948 "FLOW_INVALID" => Some(Self::Invalid),
949 "FLOW_IMPLICIT" => Some(Self::Implicit),
950 "FLOW_PASSWORD" => Some(Self::Password),
951 "FLOW_APPLICATION" => Some(Self::Application),
952 "FLOW_ACCESS_CODE" => Some(Self::AccessCode),
953 _ => None,
954 }
955 }
956 }
957}
958/// `SecurityRequirement` is a representation of OpenAPI v2 specification's
959/// Security Requirement object.
960///
961/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject>
962///
963/// Lists the required security schemes to execute this operation. The object can
964/// have multiple security schemes declared in it which are all required (that
965/// is, there is a logical AND between the schemes).
966///
967/// The name used for each property MUST correspond to a security scheme
968/// declared in the Security Definitions.
969#[derive(serde::Serialize, serde::Deserialize)]
970#[serde(rename_all = "snake_case")]
971#[derive(Clone, PartialEq, ::prost::Message)]
972pub struct SecurityRequirement {
973 /// Each name must correspond to a security scheme which is declared in
974 /// the Security Definitions. If the security scheme is of type "oauth2",
975 /// then the value is a list of scope names required for the execution.
976 /// For other security scheme types, the array MUST be empty.
977 #[prost(map = "string, message", tag = "1")]
978 pub security_requirement: ::std::collections::HashMap<
979 ::prost::alloc::string::String,
980 security_requirement::SecurityRequirementValue,
981 >,
982}
983/// Nested message and enum types in `SecurityRequirement`.
984pub mod security_requirement {
985 /// If the security scheme is of type "oauth2", then the value is a list of
986 /// scope names required for the execution. For other security scheme types,
987 /// the array MUST be empty.
988 #[derive(serde::Serialize, serde::Deserialize)]
989 #[serde(rename_all = "snake_case")]
990 #[derive(Clone, PartialEq, ::prost::Message)]
991 pub struct SecurityRequirementValue {
992 #[prost(string, repeated, tag = "1")]
993 pub scope: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
994 }
995}
996/// `Scopes` is a representation of OpenAPI v2 specification's Scopes object.
997///
998/// See: <https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject>
999///
1000/// Lists the available scopes for an OAuth2 security scheme.
1001#[derive(serde::Serialize, serde::Deserialize)]
1002#[serde(rename_all = "snake_case")]
1003#[derive(Clone, PartialEq, ::prost::Message)]
1004pub struct Scopes {
1005 /// Maps between a name of a scope to a short description of it (as the value
1006 /// of the property).
1007 #[prost(map = "string, string", tag = "1")]
1008 pub scope: ::std::collections::HashMap<
1009 ::prost::alloc::string::String,
1010 ::prost::alloc::string::String,
1011 >,
1012}
1013/// Scheme describes the schemes supported by the OpenAPI Swagger
1014/// and Operation objects.
1015#[derive(serde::Serialize, serde::Deserialize)]
1016#[serde(rename_all = "snake_case")]
1017#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
1018#[repr(i32)]
1019pub enum Scheme {
1020 Unknown = 0,
1021 Http = 1,
1022 Https = 2,
1023 Ws = 3,
1024 Wss = 4,
1025}
1026impl Scheme {
1027 /// String value of the enum field names used in the ProtoBuf definition.
1028 ///
1029 /// The values are not transformed in any way and thus are considered stable
1030 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1031 pub fn as_str_name(&self) -> &'static str {
1032 match self {
1033 Self::Unknown => "UNKNOWN",
1034 Self::Http => "HTTP",
1035 Self::Https => "HTTPS",
1036 Self::Ws => "WS",
1037 Self::Wss => "WSS",
1038 }
1039 }
1040 /// Creates an enum from field names used in the ProtoBuf definition.
1041 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
1042 match value {
1043 "UNKNOWN" => Some(Self::Unknown),
1044 "HTTP" => Some(Self::Http),
1045 "HTTPS" => Some(Self::Https),
1046 "WS" => Some(Self::Ws),
1047 "WSS" => Some(Self::Wss),
1048 _ => None,
1049 }
1050 }
1051}