openapi.proto 21.6 KB
Newer Older
kzkzzzz's avatar
kzkzzzz committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
// Copyright 2020 Google LLC. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// THIS FILE IS AUTOMATICALLY GENERATED.

syntax = "proto3";

package openapi.v3;

import "google/protobuf/any.proto";

// This option lets the proto compiler generate Java code inside the package
// name (see below) instead of inside an outer class. It creates a simpler
// developer experience by reducing one-level of name nesting and be
// consistent with most programming languages that don't support outer classes.
option java_multiple_files = true;

// The Java outer classname should be the filename in UpperCamelCase. This
// class is only used to hold proto descriptor, so developers don't need to
// work with it directly.
option java_outer_classname = "OpenAPIProto";

// The Java package name must be proto package name with proper prefix.
option java_package = "org.openapi_v3";

// A reasonable prefix for the Objective-C symbols generated from the package.
// It should at a minimum be 3 characters long, all uppercase, and convention
// is to use an abbreviation of the package name. Something short, but
// hopefully unique enough to not conflict with things that may come along in
// the future. 'GPB' is reserved for the protocol buffer implementation itself.
option objc_class_prefix = "OAS";

// The Go package name.
option go_package = "github.com/google/gnostic/openapiv3;openapi_v3";

message AdditionalPropertiesItem {
  oneof oneof {
    SchemaOrReference schema_or_reference = 1;
    bool boolean = 2;
  }
}

message Any {
  google.protobuf.Any value = 1;
  string yaml = 2;
}

message AnyOrExpression {
  oneof oneof {
    Any any = 1;
    Expression expression = 2;
  }
}

// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
message Callback {
  repeated NamedPathItem path = 1;
  repeated NamedAny specification_extension = 2;
}

message CallbackOrReference {
  oneof oneof {
    Callback callback = 1;
    Reference reference = 2;
  }
}

message CallbacksOrReferences {
  repeated NamedCallbackOrReference additional_properties = 1;
}

// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
message Components {
  SchemasOrReferences schemas = 1;
  ResponsesOrReferences responses = 2;
  ParametersOrReferences parameters = 3;
  ExamplesOrReferences examples = 4;
  RequestBodiesOrReferences request_bodies = 5;
  HeadersOrReferences headers = 6;
  SecuritySchemesOrReferences security_schemes = 7;
  LinksOrReferences links = 8;
  CallbacksOrReferences callbacks = 9;
  repeated NamedAny specification_extension = 10;
}

// Contact information for the exposed API.
message Contact {
  string name = 1;
  string url = 2;
  string email = 3;
  repeated NamedAny specification_extension = 4;
}

message DefaultType {
  oneof oneof {
    double number = 1;
    bool boolean = 2;
    string string = 3;
  }
}

// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation.  The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.  When using the discriminator, _inline_ schemas will not be considered.
message Discriminator {
  string property_name = 1;
  Strings mapping = 2;
  repeated NamedAny specification_extension = 3;
}

message Document {
  string openapi = 1;
  Info info = 2;
  repeated Server servers = 3;
  Paths paths = 4;
  Components components = 5;
  repeated SecurityRequirement security = 6;
  repeated Tag tags = 7;
  ExternalDocs external_docs = 8;
  repeated NamedAny specification_extension = 9;
}

// A single encoding definition applied to a single schema property.
message Encoding {
  string content_type = 1;
  HeadersOrReferences headers = 2;
  string style = 3;
  bool explode = 4;
  bool allow_reserved = 5;
  repeated NamedAny specification_extension = 6;
}

message Encodings {
  repeated NamedEncoding additional_properties = 1;
}

message Example {
  string summary = 1;
  string description = 2;
  Any value = 3;
  string external_value = 4;
  repeated NamedAny specification_extension = 5;
}

message ExampleOrReference {
  oneof oneof {
    Example example = 1;
    Reference reference = 2;
  }
}

message ExamplesOrReferences {
  repeated NamedExampleOrReference additional_properties = 1;
}

message Expression {
  repeated NamedAny additional_properties = 1;
}

// Allows referencing an external resource for extended documentation.
message ExternalDocs {
  string description = 1;
  string url = 2;
  repeated NamedAny specification_extension = 3;
}

// The Header Object follows the structure of the Parameter Object with the following changes:  1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).
message Header {
  string description = 1;
  bool required = 2;
  bool deprecated = 3;
  bool allow_empty_value = 4;
  string style = 5;
  bool explode = 6;
  bool allow_reserved = 7;
  SchemaOrReference schema = 8;
  Any example = 9;
  ExamplesOrReferences examples = 10;
  MediaTypes content = 11;
  repeated NamedAny specification_extension = 12;
}

message HeaderOrReference {
  oneof oneof {
    Header header = 1;
    Reference reference = 2;
  }
}

message HeadersOrReferences {
  repeated NamedHeaderOrReference additional_properties = 1;
}

// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
message Info {
  string title = 1;
  string description = 2;
  string terms_of_service = 3;
  Contact contact = 4;
  License license = 5;
  string version = 6;
  repeated NamedAny specification_extension = 7;
  string summary = 8;
}

message ItemsItem {
  repeated SchemaOrReference schema_or_reference = 1;
}

// License information for the exposed API.
message License {
  string name = 1;
  string url = 2;
  repeated NamedAny specification_extension = 3;
}

// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations.  Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response.  For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
message Link {
  string operation_ref = 1;
  string operation_id = 2;
  AnyOrExpression parameters = 3;
  AnyOrExpression request_body = 4;
  string description = 5;
  Server server = 6;
  repeated NamedAny specification_extension = 7;
}

message LinkOrReference {
  oneof oneof {
    Link link = 1;
    Reference reference = 2;
  }
}

message LinksOrReferences {
  repeated NamedLinkOrReference additional_properties = 1;
}

// Each Media Type Object provides schema and examples for the media type identified by its key.
message MediaType {
  SchemaOrReference schema = 1;
  Any example = 2;
  ExamplesOrReferences examples = 3;
  Encodings encoding = 4;
  repeated NamedAny specification_extension = 5;
}

message MediaTypes {
  repeated NamedMediaType additional_properties = 1;
}

// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
message NamedAny {
  // Map key
  string name = 1;
  // Mapped value
  Any value = 2;
}

// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs.
message NamedCallbackOrReference {
  // Map key
  string name = 1;
  // Mapped value
  CallbackOrReference value = 2;
}

// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs.
message NamedEncoding {
  // Map key
  string name = 1;
  // Mapped value
  Encoding value = 2;
}

// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs.
message NamedExampleOrReference {
  // Map key
  string name = 1;
  // Mapped value
  ExampleOrReference value = 2;
}

// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs.
message NamedHeaderOrReference {
  // Map key
  string name = 1;
  // Mapped value
  HeaderOrReference value = 2;
}

// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs.
message NamedLinkOrReference {
  // Map key
  string name = 1;
  // Mapped value
  LinkOrReference value = 2;
}

// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs.
message NamedMediaType {
  // Map key
  string name = 1;
  // Mapped value
  MediaType value = 2;
}

// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs.
message NamedParameterOrReference {
  // Map key
  string name = 1;
  // Mapped value
  ParameterOrReference value = 2;
}

// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
message NamedPathItem {
  // Map key
  string name = 1;
  // Mapped value
  PathItem value = 2;
}

// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs.
message NamedRequestBodyOrReference {
  // Map key
  string name = 1;
  // Mapped value
  RequestBodyOrReference value = 2;
}

// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs.
message NamedResponseOrReference {
  // Map key
  string name = 1;
  // Mapped value
  ResponseOrReference value = 2;
}

// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs.
message NamedSchemaOrReference {
  // Map key
  string name = 1;
  // Mapped value
  SchemaOrReference value = 2;
}

// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs.
message NamedSecuritySchemeOrReference {
  // Map key
  string name = 1;
  // Mapped value
  SecuritySchemeOrReference value = 2;
}

// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs.
message NamedServerVariable {
  // Map key
  string name = 1;
  // Mapped value
  ServerVariable value = 2;
}

// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
message NamedString {
  // Map key
  string name = 1;
  // Mapped value
  string value = 2;
}

// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
message NamedStringArray {
  // Map key
  string name = 1;
  // Mapped value
  StringArray value = 2;
}

// Configuration details for a supported OAuth Flow
message OauthFlow {
  string authorization_url = 1;
  string token_url = 2;
  string refresh_url = 3;
  Strings scopes = 4;
  repeated NamedAny specification_extension = 5;
}

// Allows configuration of the supported OAuth Flows.
message OauthFlows {
  OauthFlow implicit = 1;
  OauthFlow password = 2;
  OauthFlow client_credentials = 3;
  OauthFlow authorization_code = 4;
  repeated NamedAny specification_extension = 5;
}

message Object {
  repeated NamedAny additional_properties = 1;
}

// Describes a single API operation on a path.
message Operation {
  repeated string tags = 1;
  string summary = 2;
  string description = 3;
  ExternalDocs external_docs = 4;
  string operation_id = 5;
  repeated ParameterOrReference parameters = 6;
  RequestBodyOrReference request_body = 7;
  Responses responses = 8;
  CallbacksOrReferences callbacks = 9;
  bool deprecated = 10;
  repeated SecurityRequirement security = 11;
  repeated Server servers = 12;
  repeated NamedAny specification_extension = 13;
}

// Describes a single operation parameter.  A unique parameter is defined by a combination of a name and location.
message Parameter {
  string name = 1;
  string in = 2;
  string description = 3;
  bool required = 4;
  bool deprecated = 5;
  bool allow_empty_value = 6;
  string style = 7;
  bool explode = 8;
  bool allow_reserved = 9;
  SchemaOrReference schema = 10;
  Any example = 11;
  ExamplesOrReferences examples = 12;
  MediaTypes content = 13;
  repeated NamedAny specification_extension = 14;
}

message ParameterOrReference {
  oneof oneof {
    Parameter parameter = 1;
    Reference reference = 2;
  }
}

message ParametersOrReferences {
  repeated NamedParameterOrReference additional_properties = 1;
}

// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
message PathItem {
  string _ref = 1;
  string summary = 2;
  string description = 3;
  Operation get = 4;
  Operation put = 5;
  Operation post = 6;
  Operation delete = 7;
  Operation options = 8;
  Operation head = 9;
  Operation patch = 10;
  Operation trace = 11;
  repeated Server servers = 12;
  repeated ParameterOrReference parameters = 13;
  repeated NamedAny specification_extension = 14;
}

// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL.  The Paths MAY be empty, due to ACL constraints.
message Paths {
  repeated NamedPathItem path = 1;
  repeated NamedAny specification_extension = 2;
}

message Properties {
  repeated NamedSchemaOrReference additional_properties = 1;
}

// A simple object to allow referencing other components in the specification, internally and externally.  The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules.   For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
message Reference {
  string _ref = 1;
  string summary = 2;
  string description = 3;
}

message RequestBodiesOrReferences {
  repeated NamedRequestBodyOrReference additional_properties = 1;
}

// Describes a single request body.
message RequestBody {
  string description = 1;
  MediaTypes content = 2;
  bool required = 3;
  repeated NamedAny specification_extension = 4;
}

message RequestBodyOrReference {
  oneof oneof {
    RequestBody request_body = 1;
    Reference reference = 2;
  }
}

// Describes a single response from an API Operation, including design-time, static  `links` to operations based on the response.
message Response {
  string description = 1;
  HeadersOrReferences headers = 2;
  MediaTypes content = 3;
  LinksOrReferences links = 4;
  repeated NamedAny specification_extension = 5;
}

message ResponseOrReference {
  oneof oneof {
    Response response = 1;
    Reference reference = 2;
  }
}

// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response.  The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors.  The `default` MAY be used as a default response object for all HTTP codes  that are not covered individually by the specification.  The `Responses Object` MUST contain at least one response code, and it  SHOULD be the response for a successful operation call.
message Responses {
  ResponseOrReference default = 1;
  repeated NamedResponseOrReference response_or_reference = 2;
  repeated NamedAny specification_extension = 3;
}

message ResponsesOrReferences {
  repeated NamedResponseOrReference additional_properties = 1;
}

// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00.  For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.
message Schema {
  bool nullable = 1;
  Discriminator discriminator = 2;
  bool read_only = 3;
  bool write_only = 4;
  Xml xml = 5;
  ExternalDocs external_docs = 6;
  Any example = 7;
  bool deprecated = 8;
  string title = 9;
  double multiple_of = 10;
  double maximum = 11;
  bool exclusive_maximum = 12;
  double minimum = 13;
  bool exclusive_minimum = 14;
  int64 max_length = 15;
  int64 min_length = 16;
  string pattern = 17;
  int64 max_items = 18;
  int64 min_items = 19;
  bool unique_items = 20;
  int64 max_properties = 21;
  int64 min_properties = 22;
  repeated string required = 23;
  repeated Any enum = 24;
  string type = 25;
  repeated SchemaOrReference all_of = 26;
  repeated SchemaOrReference one_of = 27;
  repeated SchemaOrReference any_of = 28;
  Schema not = 29;
  ItemsItem items = 30;
  Properties properties = 31;
  AdditionalPropertiesItem additional_properties = 32;
  DefaultType default = 33;
  string description = 34;
  string format = 35;
  repeated NamedAny specification_extension = 36;
}

message SchemaOrReference {
  oneof oneof {
    Schema schema = 1;
    Reference reference = 2;
  }
}

message SchemasOrReferences {
  repeated NamedSchemaOrReference additional_properties = 1;
}

// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object.  Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information.  When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request.
message SecurityRequirement {
  repeated NamedStringArray additional_properties = 1;
}

// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect.   Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE.
message SecurityScheme {
  string type = 1;
  string description = 2;
  string name = 3;
  string in = 4;
  string scheme = 5;
  string bearer_format = 6;
  OauthFlows flows = 7;
  string open_id_connect_url = 8;
  repeated NamedAny specification_extension = 9;
}

message SecuritySchemeOrReference {
  oneof oneof {
    SecurityScheme security_scheme = 1;
    Reference reference = 2;
  }
}

message SecuritySchemesOrReferences {
  repeated NamedSecuritySchemeOrReference additional_properties = 1;
}

// An object representing a Server.
message Server {
  string url = 1;
  string description = 2;
  ServerVariables variables = 3;
  repeated NamedAny specification_extension = 4;
}

// An object representing a Server Variable for server URL template substitution.
message ServerVariable {
  repeated string enum = 1;
  string default = 2;
  string description = 3;
  repeated NamedAny specification_extension = 4;
}

message ServerVariables {
  repeated NamedServerVariable additional_properties = 1;
}

// Any property starting with x- is valid.
message SpecificationExtension {
  oneof oneof {
    double number = 1;
    bool boolean = 2;
    string string = 3;
  }
}

message StringArray {
  repeated string value = 1;
}

message Strings {
  repeated NamedString additional_properties = 1;
}

// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
message Tag {
  string name = 1;
  string description = 2;
  ExternalDocs external_docs = 3;
  repeated NamedAny specification_extension = 4;
}

// A metadata object that allows for more fine-tuned XML model definitions.  When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.
message Xml {
  string name = 1;
  string namespace = 2;
  string prefix = 3;
  bool attribute = 4;
  bool wrapped = 5;
  repeated NamedAny specification_extension = 6;
}