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