| 1 |
// Copyright (c) 2015, Gengo, Inc. |
| 2 |
// All rights reserved. |
| 3 |
// |
| 4 |
// Redistribution and use in source and binary forms, with or without modification, |
| 5 |
// are permitted provided that the following conditions are met: |
| 6 |
// |
| 7 |
// * Redistributions of source code must retain the above copyright notice, |
| 8 |
// this list of conditions and the following disclaimer. |
| 9 |
// |
| 10 |
// * Redistributions in binary form must reproduce the above copyright notice, |
| 11 |
// this list of conditions and the following disclaimer in the documentation |
| 12 |
// and/or other materials provided with the distribution. |
| 13 |
// |
| 14 |
// * Neither the name of Gengo, Inc. nor the names of its |
| 15 |
// contributors may be used to endorse or promote products derived from this |
| 16 |
// software without specific prior written permission. |
| 17 |
// |
| 18 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 19 |
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 20 |
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 |
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 22 |
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 |
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 24 |
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
| 25 |
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 27 |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 |
|
| 29 |
syntax = "proto3"; |
| 30 |
|
| 31 |
package grpc.gateway.protoc_gen_openapiv2.options; |
| 32 |
|
| 33 |
import "google/protobuf/struct.proto"; |
| 34 |
|
| 35 |
option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; |
| 36 |
|
| 37 |
// Scheme describes the schemes supported by the OpenAPI Swagger |
| 38 |
// and Operation objects. |
| 39 |
enum Scheme { |
| 40 |
UNKNOWN = 0; |
| 41 |
HTTP = 1; |
| 42 |
HTTPS = 2; |
| 43 |
WS = 3; |
| 44 |
WSS = 4; |
| 45 |
} |
| 46 |
|
| 47 |
// `Swagger` is a representation of OpenAPI v2 specification's Swagger object. |
| 48 |
// |
| 49 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject |
| 50 |
// |
| 51 |
// Example: |
| 52 |
// |
| 53 |
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { |
| 54 |
// info: { |
| 55 |
// title: "Echo API"; |
| 56 |
// version: "1.0"; |
| 57 |
// description: ""; |
| 58 |
// contact: { |
| 59 |
// name: "gRPC-Gateway project"; |
| 60 |
// url: "https://github.com/grpc-ecosystem/grpc-gateway"; |
| 61 |
// email: "[email protected]"; |
| 62 |
// }; |
| 63 |
// license: { |
| 64 |
// name: "BSD 3-Clause License"; |
| 65 |
// url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; |
| 66 |
// }; |
| 67 |
// }; |
| 68 |
// schemes: HTTPS; |
| 69 |
// consumes: "application/json"; |
| 70 |
// produces: "application/json"; |
| 71 |
// }; |
| 72 |
// |
| 73 |
message Swagger { |
| 74 |
// Specifies the OpenAPI Specification version being used. It can be |
| 75 |
// used by the OpenAPI UI and other clients to interpret the API listing. The |
| 76 |
// value MUST be "2.0". |
| 77 |
string swagger = 1; |
| 78 |
// Provides metadata about the API. The metadata can be used by the |
| 79 |
// clients if needed. |
| 80 |
Info info = 2; |
| 81 |
// The host (name or ip) serving the API. This MUST be the host only and does |
| 82 |
// not include the scheme nor sub-paths. It MAY include a port. If the host is |
| 83 |
// not included, the host serving the documentation is to be used (including |
| 84 |
// the port). The host does not support path templating. |
| 85 |
string host = 3; |
| 86 |
// The base path on which the API is served, which is relative to the host. If |
| 87 |
// it is not included, the API is served directly under the host. The value |
| 88 |
// MUST start with a leading slash (/). The basePath does not support path |
| 89 |
// templating. |
| 90 |
// Note that using `base_path` does not change the endpoint paths that are |
| 91 |
// generated in the resulting OpenAPI file. If you wish to use `base_path` |
| 92 |
// with relatively generated OpenAPI paths, the `base_path` prefix must be |
| 93 |
// manually removed from your `google.api.http` paths and your code changed to |
| 94 |
// serve the API from the `base_path`. |
| 95 |
string base_path = 4; |
| 96 |
// The transfer protocol of the API. Values MUST be from the list: "http", |
| 97 |
// "https", "ws", "wss". If the schemes is not included, the default scheme to |
| 98 |
// be used is the one used to access the OpenAPI definition itself. |
| 99 |
repeated Scheme schemes = 5; |
| 100 |
// A list of MIME types the APIs can consume. This is global to all APIs but |
| 101 |
// can be overridden on specific API calls. Value MUST be as described under |
| 102 |
// Mime Types. |
| 103 |
repeated string consumes = 6; |
| 104 |
// A list of MIME types the APIs can produce. This is global to all APIs but |
| 105 |
// can be overridden on specific API calls. Value MUST be as described under |
| 106 |
// Mime Types. |
| 107 |
repeated string produces = 7; |
| 108 |
// field 8 is reserved for 'paths'. |
| 109 |
reserved 8; |
| 110 |
// field 9 is reserved for 'definitions', which at this time are already |
| 111 |
// exposed as and customizable as proto messages. |
| 112 |
reserved 9; |
| 113 |
// An object to hold responses that can be used across operations. This |
| 114 |
// property does not define global responses for all operations. |
| 115 |
map<string, Response> responses = 10; |
| 116 |
// Security scheme definitions that can be used across the specification. |
| 117 |
SecurityDefinitions security_definitions = 11; |
| 118 |
// A declaration of which security schemes are applied for the API as a whole. |
| 119 |
// The list of values describes alternative security schemes that can be used |
| 120 |
// (that is, there is a logical OR between the security requirements). |
| 121 |
// Individual operations can override this definition. |
| 122 |
repeated SecurityRequirement security = 12; |
| 123 |
// field 13 is reserved for 'tags', which are supposed to be exposed as and |
| 124 |
// customizable as proto services. TODO(ivucica): add processing of proto |
| 125 |
// service objects into OpenAPI v2 Tag objects. |
| 126 |
reserved 13; |
| 127 |
// Additional external documentation. |
| 128 |
ExternalDocumentation external_docs = 14; |
| 129 |
map<string, google.protobuf.Value> extensions = 15; |
| 130 |
} |
| 131 |
|
| 132 |
// `Operation` is a representation of OpenAPI v2 specification's Operation object. |
| 133 |
// |
| 134 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#operationObject |
| 135 |
// |
| 136 |
// Example: |
| 137 |
// |
| 138 |
// service EchoService { |
| 139 |
// rpc Echo(SimpleMessage) returns (SimpleMessage) { |
| 140 |
// option (google.api.http) = { |
| 141 |
// get: "/v1/example/echo/{id}" |
| 142 |
// }; |
| 143 |
// |
| 144 |
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { |
| 145 |
// summary: "Get a message."; |
| 146 |
// operation_id: "getMessage"; |
| 147 |
// tags: "echo"; |
| 148 |
// responses: { |
| 149 |
// key: "200" |
| 150 |
// value: { |
| 151 |
// description: "OK"; |
| 152 |
// } |
| 153 |
// } |
| 154 |
// }; |
| 155 |
// } |
| 156 |
// } |
| 157 |
message Operation { |
| 158 |
// A list of tags for API documentation control. Tags can be used for logical |
| 159 |
// grouping of operations by resources or any other qualifier. |
| 160 |
repeated string tags = 1; |
| 161 |
// A short summary of what the operation does. For maximum readability in the |
| 162 |
// swagger-ui, this field SHOULD be less than 120 characters. |
| 163 |
string summary = 2; |
| 164 |
// A verbose explanation of the operation behavior. GFM syntax can be used for |
| 165 |
// rich text representation. |
| 166 |
string description = 3; |
| 167 |
// Additional external documentation for this operation. |
| 168 |
ExternalDocumentation external_docs = 4; |
| 169 |
// Unique string used to identify the operation. The id MUST be unique among |
| 170 |
// all operations described in the API. Tools and libraries MAY use the |
| 171 |
// operationId to uniquely identify an operation, therefore, it is recommended |
| 172 |
// to follow common programming naming conventions. |
| 173 |
string operation_id = 5; |
| 174 |
// A list of MIME types the operation can consume. This overrides the consumes |
| 175 |
// definition at the OpenAPI Object. An empty value MAY be used to clear the |
| 176 |
// global definition. Value MUST be as described under Mime Types. |
| 177 |
repeated string consumes = 6; |
| 178 |
// A list of MIME types the operation can produce. This overrides the produces |
| 179 |
// definition at the OpenAPI Object. An empty value MAY be used to clear the |
| 180 |
// global definition. Value MUST be as described under Mime Types. |
| 181 |
repeated string produces = 7; |
| 182 |
// field 8 is reserved for 'parameters'. |
| 183 |
reserved 8; |
| 184 |
// The list of possible responses as they are returned from executing this |
| 185 |
// operation. |
| 186 |
map<string, Response> responses = 9; |
| 187 |
// The transfer protocol for the operation. Values MUST be from the list: |
| 188 |
// "http", "https", "ws", "wss". The value overrides the OpenAPI Object |
| 189 |
// schemes definition. |
| 190 |
repeated Scheme schemes = 10; |
| 191 |
// Declares this operation to be deprecated. Usage of the declared operation |
| 192 |
// should be refrained. Default value is false. |
| 193 |
bool deprecated = 11; |
| 194 |
// A declaration of which security schemes are applied for this operation. The |
| 195 |
// list of values describes alternative security schemes that can be used |
| 196 |
// (that is, there is a logical OR between the security requirements). This |
| 197 |
// definition overrides any declared top-level security. To remove a top-level |
| 198 |
// security declaration, an empty array can be used. |
| 199 |
repeated SecurityRequirement security = 12; |
| 200 |
map<string, google.protobuf.Value> extensions = 13; |
| 201 |
} |
| 202 |
|
| 203 |
// `Header` is a representation of OpenAPI v2 specification's Header object. |
| 204 |
// |
| 205 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#headerObject |
| 206 |
// |
| 207 |
message Header { |
| 208 |
// `Description` is a short description of the header. |
| 209 |
string description = 1; |
| 210 |
// The type of the object. The value MUST be one of "string", "number", "integer", or "boolean". The "array" type is not supported. |
| 211 |
string type = 2; |
| 212 |
// `Format` The extending format for the previously mentioned type. |
| 213 |
string format = 3; |
| 214 |
// field 4 is reserved for 'items', but in OpenAPI-specific way. |
| 215 |
reserved 4; |
| 216 |
// field 5 is reserved `Collection Format` Determines the format of the array if type array is used. |
| 217 |
reserved 5; |
| 218 |
// `Default` Declares the value of the header that the server will use if none is provided. |
| 219 |
// See: https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-6.2. |
| 220 |
// Unlike JSON Schema this value MUST conform to the defined type for the header. |
| 221 |
string default = 6; |
| 222 |
// field 7 is reserved for 'maximum'. |
| 223 |
reserved 7; |
| 224 |
// field 8 is reserved for 'exclusiveMaximum'. |
| 225 |
reserved 8; |
| 226 |
// field 9 is reserved for 'minimum'. |
| 227 |
reserved 9; |
| 228 |
// field 10 is reserved for 'exclusiveMinimum'. |
| 229 |
reserved 10; |
| 230 |
// field 11 is reserved for 'maxLength'. |
| 231 |
reserved 11; |
| 232 |
// field 12 is reserved for 'minLength'. |
| 233 |
reserved 12; |
| 234 |
// 'Pattern' See https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.2.3. |
| 235 |
string pattern = 13; |
| 236 |
// field 14 is reserved for 'maxItems'. |
| 237 |
reserved 14; |
| 238 |
// field 15 is reserved for 'minItems'. |
| 239 |
reserved 15; |
| 240 |
// field 16 is reserved for 'uniqueItems'. |
| 241 |
reserved 16; |
| 242 |
// field 17 is reserved for 'enum'. |
| 243 |
reserved 17; |
| 244 |
// field 18 is reserved for 'multipleOf'. |
| 245 |
reserved 18; |
| 246 |
} |
| 247 |
|
| 248 |
// `Response` is a representation of OpenAPI v2 specification's Response object. |
| 249 |
// |
| 250 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#responseObject |
| 251 |
// |
| 252 |
message Response { |
| 253 |
// `Description` is a short description of the response. |
| 254 |
// GFM syntax can be used for rich text representation. |
| 255 |
string description = 1; |
| 256 |
// `Schema` optionally defines the structure of the response. |
| 257 |
// If `Schema` is not provided, it means there is no content to the response. |
| 258 |
Schema schema = 2; |
| 259 |
// `Headers` A list of headers that are sent with the response. |
| 260 |
// `Header` name is expected to be a string in the canonical format of the MIME header key |
| 261 |
// See: https://golang.org/pkg/net/textproto/#CanonicalMIMEHeaderKey |
| 262 |
map<string, Header> headers = 3; |
| 263 |
// `Examples` gives per-mimetype response examples. |
| 264 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#example-object |
| 265 |
map<string, string> examples = 4; |
| 266 |
map<string, google.protobuf.Value> extensions = 5; |
| 267 |
} |
| 268 |
|
| 269 |
// `Info` is a representation of OpenAPI v2 specification's Info object. |
| 270 |
// |
| 271 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#infoObject |
| 272 |
// |
| 273 |
// Example: |
| 274 |
// |
| 275 |
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { |
| 276 |
// info: { |
| 277 |
// title: "Echo API"; |
| 278 |
// version: "1.0"; |
| 279 |
// description: ""; |
| 280 |
// contact: { |
| 281 |
// name: "gRPC-Gateway project"; |
| 282 |
// url: "https://github.com/grpc-ecosystem/grpc-gateway"; |
| 283 |
// email: "[email protected]"; |
| 284 |
// }; |
| 285 |
// license: { |
| 286 |
// name: "BSD 3-Clause License"; |
| 287 |
// url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; |
| 288 |
// }; |
| 289 |
// }; |
| 290 |
// ... |
| 291 |
// }; |
| 292 |
// |
| 293 |
message Info { |
| 294 |
// The title of the application. |
| 295 |
string title = 1; |
| 296 |
// A short description of the application. GFM syntax can be used for rich |
| 297 |
// text representation. |
| 298 |
string description = 2; |
| 299 |
// The Terms of Service for the API. |
| 300 |
string terms_of_service = 3; |
| 301 |
// The contact information for the exposed API. |
| 302 |
Contact contact = 4; |
| 303 |
// The license information for the exposed API. |
| 304 |
License license = 5; |
| 305 |
// Provides the version of the application API (not to be confused |
| 306 |
// with the specification version). |
| 307 |
string version = 6; |
| 308 |
map<string, google.protobuf.Value> extensions = 7; |
| 309 |
} |
| 310 |
|
| 311 |
// `Contact` is a representation of OpenAPI v2 specification's Contact object. |
| 312 |
// |
| 313 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#contactObject |
| 314 |
// |
| 315 |
// Example: |
| 316 |
// |
| 317 |
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { |
| 318 |
// info: { |
| 319 |
// ... |
| 320 |
// contact: { |
| 321 |
// name: "gRPC-Gateway project"; |
| 322 |
// url: "https://github.com/grpc-ecosystem/grpc-gateway"; |
| 323 |
// email: "[email protected]"; |
| 324 |
// }; |
| 325 |
// ... |
| 326 |
// }; |
| 327 |
// ... |
| 328 |
// }; |
| 329 |
// |
| 330 |
message Contact { |
| 331 |
// The identifying name of the contact person/organization. |
| 332 |
string name = 1; |
| 333 |
// The URL pointing to the contact information. MUST be in the format of a |
| 334 |
// URL. |
| 335 |
string url = 2; |
| 336 |
// The email address of the contact person/organization. MUST be in the format |
| 337 |
// of an email address. |
| 338 |
string email = 3; |
| 339 |
} |
| 340 |
|
| 341 |
// `License` is a representation of OpenAPI v2 specification's License object. |
| 342 |
// |
| 343 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#licenseObject |
| 344 |
// |
| 345 |
// Example: |
| 346 |
// |
| 347 |
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { |
| 348 |
// info: { |
| 349 |
// ... |
| 350 |
// license: { |
| 351 |
// name: "BSD 3-Clause License"; |
| 352 |
// url: "https://github.com/grpc-ecosystem/grpc-gateway/blob/master/LICENSE.txt"; |
| 353 |
// }; |
| 354 |
// ... |
| 355 |
// }; |
| 356 |
// ... |
| 357 |
// }; |
| 358 |
// |
| 359 |
message License { |
| 360 |
// The license name used for the API. |
| 361 |
string name = 1; |
| 362 |
// A URL to the license used for the API. MUST be in the format of a URL. |
| 363 |
string url = 2; |
| 364 |
} |
| 365 |
|
| 366 |
// `ExternalDocumentation` is a representation of OpenAPI v2 specification's |
| 367 |
// ExternalDocumentation object. |
| 368 |
// |
| 369 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#externalDocumentationObject |
| 370 |
// |
| 371 |
// Example: |
| 372 |
// |
| 373 |
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { |
| 374 |
// ... |
| 375 |
// external_docs: { |
| 376 |
// description: "More about gRPC-Gateway"; |
| 377 |
// url: "https://github.com/grpc-ecosystem/grpc-gateway"; |
| 378 |
// } |
| 379 |
// ... |
| 380 |
// }; |
| 381 |
// |
| 382 |
message ExternalDocumentation { |
| 383 |
// A short description of the target documentation. GFM syntax can be used for |
| 384 |
// rich text representation. |
| 385 |
string description = 1; |
| 386 |
// The URL for the target documentation. Value MUST be in the format |
| 387 |
// of a URL. |
| 388 |
string url = 2; |
| 389 |
} |
| 390 |
|
| 391 |
// `Schema` is a representation of OpenAPI v2 specification's Schema object. |
| 392 |
// |
| 393 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject |
| 394 |
// |
| 395 |
message Schema { |
| 396 |
JSONSchema json_schema = 1; |
| 397 |
// Adds support for polymorphism. The discriminator is the schema property |
| 398 |
// name that is used to differentiate between other schema that inherit this |
| 399 |
// schema. The property name used MUST be defined at this schema and it MUST |
| 400 |
// be in the required property list. When used, the value MUST be the name of |
| 401 |
// this schema or any schema that inherits it. |
| 402 |
string discriminator = 2; |
| 403 |
// Relevant only for Schema "properties" definitions. Declares the property as |
| 404 |
// "read only". This means that it MAY be sent as part of a response but MUST |
| 405 |
// NOT be sent as part of the request. Properties marked as readOnly being |
| 406 |
// true SHOULD NOT be in the required list of the defined schema. Default |
| 407 |
// value is false. |
| 408 |
bool read_only = 3; |
| 409 |
// field 4 is reserved for 'xml'. |
| 410 |
reserved 4; |
| 411 |
// Additional external documentation for this schema. |
| 412 |
ExternalDocumentation external_docs = 5; |
| 413 |
// A free-form property to include an example of an instance for this schema in JSON. |
| 414 |
// This is copied verbatim to the output. |
| 415 |
string example = 6; |
| 416 |
} |
| 417 |
|
| 418 |
// `JSONSchema` represents properties from JSON Schema taken, and as used, in |
| 419 |
// the OpenAPI v2 spec. |
| 420 |
// |
| 421 |
// This includes changes made by OpenAPI v2. |
| 422 |
// |
| 423 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject |
| 424 |
// |
| 425 |
// See also: https://cswr.github.io/JsonSchema/spec/basic_types/, |
| 426 |
// https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json |
| 427 |
// |
| 428 |
// Example: |
| 429 |
// |
| 430 |
// message SimpleMessage { |
| 431 |
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { |
| 432 |
// json_schema: { |
| 433 |
// title: "SimpleMessage" |
| 434 |
// description: "A simple message." |
| 435 |
// required: ["id"] |
| 436 |
// } |
| 437 |
// }; |
| 438 |
// |
| 439 |
// // Id represents the message identifier. |
| 440 |
// string id = 1; [ |
| 441 |
// (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { |
| 442 |
// description: "The unique identifier of the simple message." |
| 443 |
// }]; |
| 444 |
// } |
| 445 |
// |
| 446 |
message JSONSchema { |
| 447 |
// field 1 is reserved for '$id', omitted from OpenAPI v2. |
| 448 |
reserved 1; |
| 449 |
// field 2 is reserved for '$schema', omitted from OpenAPI v2. |
| 450 |
reserved 2; |
| 451 |
// Ref is used to define an external reference to include in the message. |
| 452 |
// This could be a fully qualified proto message reference, and that type must |
| 453 |
// be imported into the protofile. If no message is identified, the Ref will |
| 454 |
// be used verbatim in the output. |
| 455 |
// For example: |
| 456 |
// `ref: ".google.protobuf.Timestamp"`. |
| 457 |
string ref = 3; |
| 458 |
// field 4 is reserved for '$comment', omitted from OpenAPI v2. |
| 459 |
reserved 4; |
| 460 |
// The title of the schema. |
| 461 |
string title = 5; |
| 462 |
// A short description of the schema. |
| 463 |
string description = 6; |
| 464 |
string default = 7; |
| 465 |
bool read_only = 8; |
| 466 |
// A free-form property to include a JSON example of this field. This is copied |
| 467 |
// verbatim to the output swagger.json. Quotes must be escaped. |
| 468 |
// 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 |
| 469 |
string example = 9; |
| 470 |
double multiple_of = 10; |
| 471 |
// Maximum represents an inclusive upper limit for a numeric instance. The |
| 472 |
// value of MUST be a number, |
| 473 |
double maximum = 11; |
| 474 |
bool exclusive_maximum = 12; |
| 475 |
// minimum represents an inclusive lower limit for a numeric instance. The |
| 476 |
// value of MUST be a number, |
| 477 |
double minimum = 13; |
| 478 |
bool exclusive_minimum = 14; |
| 479 |
uint64 max_length = 15; |
| 480 |
uint64 min_length = 16; |
| 481 |
string pattern = 17; |
| 482 |
// field 18 is reserved for 'additionalItems', omitted from OpenAPI v2. |
| 483 |
reserved 18; |
| 484 |
// field 19 is reserved for 'items', but in OpenAPI-specific way. |
| 485 |
// TODO(ivucica): add 'items'? |
| 486 |
reserved 19; |
| 487 |
uint64 max_items = 20; |
| 488 |
uint64 min_items = 21; |
| 489 |
bool unique_items = 22; |
| 490 |
// field 23 is reserved for 'contains', omitted from OpenAPI v2. |
| 491 |
reserved 23; |
| 492 |
uint64 max_properties = 24; |
| 493 |
uint64 min_properties = 25; |
| 494 |
repeated string required = 26; |
| 495 |
// field 27 is reserved for 'additionalProperties', but in OpenAPI-specific |
| 496 |
// way. TODO(ivucica): add 'additionalProperties'? |
| 497 |
reserved 27; |
| 498 |
// field 28 is reserved for 'definitions', omitted from OpenAPI v2. |
| 499 |
reserved 28; |
| 500 |
// field 29 is reserved for 'properties', but in OpenAPI-specific way. |
| 501 |
// TODO(ivucica): add 'additionalProperties'? |
| 502 |
reserved 29; |
| 503 |
// following fields are reserved, as the properties have been omitted from |
| 504 |
// OpenAPI v2: |
| 505 |
// patternProperties, dependencies, propertyNames, const |
| 506 |
reserved 30 to 33; |
| 507 |
// Items in 'array' must be unique. |
| 508 |
repeated string array = 34; |
| 509 |
|
| 510 |
enum JSONSchemaSimpleTypes { |
| 511 |
UNKNOWN = 0; |
| 512 |
ARRAY = 1; |
| 513 |
BOOLEAN = 2; |
| 514 |
INTEGER = 3; |
| 515 |
NULL = 4; |
| 516 |
NUMBER = 5; |
| 517 |
OBJECT = 6; |
| 518 |
STRING = 7; |
| 519 |
} |
| 520 |
|
| 521 |
repeated JSONSchemaSimpleTypes type = 35; |
| 522 |
// `Format` |
| 523 |
string format = 36; |
| 524 |
// following fields are reserved, as the properties have been omitted from |
| 525 |
// OpenAPI v2: contentMediaType, contentEncoding, if, then, else |
| 526 |
reserved 37 to 41; |
| 527 |
// field 42 is reserved for 'allOf', but in OpenAPI-specific way. |
| 528 |
// TODO(ivucica): add 'allOf'? |
| 529 |
reserved 42; |
| 530 |
// following fields are reserved, as the properties have been omitted from |
| 531 |
// OpenAPI v2: |
| 532 |
// anyOf, oneOf, not |
| 533 |
reserved 43 to 45; |
| 534 |
// Items in `enum` must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1 |
| 535 |
repeated string enum = 46; |
| 536 |
|
| 537 |
// Additional field level properties used when generating the OpenAPI v2 file. |
| 538 |
FieldConfiguration field_configuration = 1001; |
| 539 |
|
| 540 |
// 'FieldConfiguration' provides additional field level properties used when generating the OpenAPI v2 file. |
| 541 |
// These properties are not defined by OpenAPIv2, but they are used to control the generation. |
| 542 |
message FieldConfiguration { |
| 543 |
// Alternative parameter name when used as path parameter. If set, this will |
| 544 |
// be used as the complete parameter name when this field is used as a path |
| 545 |
// parameter. Use this to avoid having auto generated path parameter names |
| 546 |
// for overlapping paths. |
| 547 |
string path_param_name = 47; |
| 548 |
} |
| 549 |
map<string, google.protobuf.Value> extensions = 48; |
| 550 |
} |
| 551 |
|
| 552 |
// `Tag` is a representation of OpenAPI v2 specification's Tag object. |
| 553 |
// |
| 554 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#tagObject |
| 555 |
// |
| 556 |
message Tag { |
| 557 |
// field 1 is reserved for 'name'. In our generator, this is (to be) extracted |
| 558 |
// from the name of proto service, and thus not exposed to the user, as |
| 559 |
// changing tag object's name would break the link to the references to the |
| 560 |
// tag in individual operation specifications. |
| 561 |
// |
| 562 |
// TODO(ivucica): Add 'name' property. Use it to allow override of the name of |
| 563 |
// global Tag object, then use that name to reference the tag throughout the |
| 564 |
// OpenAPI file. |
| 565 |
reserved 1; |
| 566 |
// A short description for the tag. GFM syntax can be used for rich text |
| 567 |
// representation. |
| 568 |
string description = 2; |
| 569 |
// Additional external documentation for this tag. |
| 570 |
ExternalDocumentation external_docs = 3; |
| 571 |
} |
| 572 |
|
| 573 |
// `SecurityDefinitions` is a representation of OpenAPI v2 specification's |
| 574 |
// Security Definitions object. |
| 575 |
// |
| 576 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityDefinitionsObject |
| 577 |
// |
| 578 |
// A declaration of the security schemes available to be used in the |
| 579 |
// specification. This does not enforce the security schemes on the operations |
| 580 |
// and only serves to provide the relevant details for each scheme. |
| 581 |
message SecurityDefinitions { |
| 582 |
// A single security scheme definition, mapping a "name" to the scheme it |
| 583 |
// defines. |
| 584 |
map<string, SecurityScheme> security = 1; |
| 585 |
} |
| 586 |
|
| 587 |
// `SecurityScheme` is a representation of OpenAPI v2 specification's |
| 588 |
// Security Scheme object. |
| 589 |
// |
| 590 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securitySchemeObject |
| 591 |
// |
| 592 |
// Allows the definition of a security scheme that can be used by the |
| 593 |
// operations. Supported schemes are basic authentication, an API key (either as |
| 594 |
// a header or as a query parameter) and OAuth2's common flows (implicit, |
| 595 |
// password, application and access code). |
| 596 |
message SecurityScheme { |
| 597 |
// The type of the security scheme. Valid values are "basic", |
| 598 |
// "apiKey" or "oauth2". |
| 599 |
enum Type { |
| 600 |
TYPE_INVALID = 0; |
| 601 |
TYPE_BASIC = 1; |
| 602 |
TYPE_API_KEY = 2; |
| 603 |
TYPE_OAUTH2 = 3; |
| 604 |
} |
| 605 |
|
| 606 |
// The location of the API key. Valid values are "query" or "header". |
| 607 |
enum In { |
| 608 |
IN_INVALID = 0; |
| 609 |
IN_QUERY = 1; |
| 610 |
IN_HEADER = 2; |
| 611 |
} |
| 612 |
|
| 613 |
// The flow used by the OAuth2 security scheme. Valid values are |
| 614 |
// "implicit", "password", "application" or "accessCode". |
| 615 |
enum Flow { |
| 616 |
FLOW_INVALID = 0; |
| 617 |
FLOW_IMPLICIT = 1; |
| 618 |
FLOW_PASSWORD = 2; |
| 619 |
FLOW_APPLICATION = 3; |
| 620 |
FLOW_ACCESS_CODE = 4; |
| 621 |
} |
| 622 |
|
| 623 |
// The type of the security scheme. Valid values are "basic", |
| 624 |
// "apiKey" or "oauth2". |
| 625 |
Type type = 1; |
| 626 |
// A short description for security scheme. |
| 627 |
string description = 2; |
| 628 |
// The name of the header or query parameter to be used. |
| 629 |
// Valid for apiKey. |
| 630 |
string name = 3; |
| 631 |
// The location of the API key. Valid values are "query" or |
| 632 |
// "header". |
| 633 |
// Valid for apiKey. |
| 634 |
In in = 4; |
| 635 |
// The flow used by the OAuth2 security scheme. Valid values are |
| 636 |
// "implicit", "password", "application" or "accessCode". |
| 637 |
// Valid for oauth2. |
| 638 |
Flow flow = 5; |
| 639 |
// The authorization URL to be used for this flow. This SHOULD be in |
| 640 |
// the form of a URL. |
| 641 |
// Valid for oauth2/implicit and oauth2/accessCode. |
| 642 |
string authorization_url = 6; |
| 643 |
// The token URL to be used for this flow. This SHOULD be in the |
| 644 |
// form of a URL. |
| 645 |
// Valid for oauth2/password, oauth2/application and oauth2/accessCode. |
| 646 |
string token_url = 7; |
| 647 |
// The available scopes for the OAuth2 security scheme. |
| 648 |
// Valid for oauth2. |
| 649 |
Scopes scopes = 8; |
| 650 |
map<string, google.protobuf.Value> extensions = 9; |
| 651 |
} |
| 652 |
|
| 653 |
// `SecurityRequirement` is a representation of OpenAPI v2 specification's |
| 654 |
// Security Requirement object. |
| 655 |
// |
| 656 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#securityRequirementObject |
| 657 |
// |
| 658 |
// Lists the required security schemes to execute this operation. The object can |
| 659 |
// have multiple security schemes declared in it which are all required (that |
| 660 |
// is, there is a logical AND between the schemes). |
| 661 |
// |
| 662 |
// The name used for each property MUST correspond to a security scheme |
| 663 |
// declared in the Security Definitions. |
| 664 |
message SecurityRequirement { |
| 665 |
// If the security scheme is of type "oauth2", then the value is a list of |
| 666 |
// scope names required for the execution. For other security scheme types, |
| 667 |
// the array MUST be empty. |
| 668 |
message SecurityRequirementValue { |
| 669 |
repeated string scope = 1; |
| 670 |
} |
| 671 |
// Each name must correspond to a security scheme which is declared in |
| 672 |
// the Security Definitions. If the security scheme is of type "oauth2", |
| 673 |
// then the value is a list of scope names required for the execution. |
| 674 |
// For other security scheme types, the array MUST be empty. |
| 675 |
map<string, SecurityRequirementValue> security_requirement = 1; |
| 676 |
} |
| 677 |
|
| 678 |
// `Scopes` is a representation of OpenAPI v2 specification's Scopes object. |
| 679 |
// |
| 680 |
// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#scopesObject |
| 681 |
// |
| 682 |
// Lists the available scopes for an OAuth2 security scheme. |
| 683 |
message Scopes { |
| 684 |
// Maps between a name of a scope to a short description of it (as the value |
| 685 |
// of the property). |
| 686 |
map<string, string> scope = 1; |
| 687 |
} |