...

Text file src/github.com/google/gnostic-models/openapiv3/OpenAPIv3.proto

Documentation: github.com/google/gnostic-models/openapiv3

     1// Copyright 2020 Google LLC. All Rights Reserved.
     2//
     3// Licensed under the Apache License, Version 2.0 (the "License");
     4// you may not use this file except in compliance with the License.
     5// You may obtain a copy of the License at
     6//
     7//    http://www.apache.org/licenses/LICENSE-2.0
     8//
     9// Unless required by applicable law or agreed to in writing, software
    10// distributed under the License is distributed on an "AS IS" BASIS,
    11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12// See the License for the specific language governing permissions and
    13// limitations under the License.
    14
    15// THIS FILE IS AUTOMATICALLY GENERATED.
    16
    17syntax = "proto3";
    18
    19package openapi.v3;
    20
    21import "google/protobuf/any.proto";
    22
    23// This option lets the proto compiler generate Java code inside the package
    24// name (see below) instead of inside an outer class. It creates a simpler
    25// developer experience by reducing one-level of name nesting and be
    26// consistent with most programming languages that don't support outer classes.
    27option java_multiple_files = true;
    28
    29// The Java outer classname should be the filename in UpperCamelCase. This
    30// class is only used to hold proto descriptor, so developers don't need to
    31// work with it directly.
    32option java_outer_classname = "OpenAPIProto";
    33
    34// The Java package name must be proto package name with proper prefix.
    35option java_package = "org.openapi_v3";
    36
    37// A reasonable prefix for the Objective-C symbols generated from the package.
    38// It should at a minimum be 3 characters long, all uppercase, and convention
    39// is to use an abbreviation of the package name. Something short, but
    40// hopefully unique enough to not conflict with things that may come along in
    41// the future. 'GPB' is reserved for the protocol buffer implementation itself.
    42option objc_class_prefix = "OAS";
    43
    44// The Go package name.
    45option go_package = "./openapiv3;openapi_v3";
    46
    47message AdditionalPropertiesItem {
    48  oneof oneof {
    49    SchemaOrReference schema_or_reference = 1;
    50    bool boolean = 2;
    51  }
    52}
    53
    54message Any {
    55  google.protobuf.Any value = 1;
    56  string yaml = 2;
    57}
    58
    59message AnyOrExpression {
    60  oneof oneof {
    61    Any any = 1;
    62    Expression expression = 2;
    63  }
    64}
    65
    66// 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.
    67message Callback {
    68  repeated NamedPathItem path = 1;
    69  repeated NamedAny specification_extension = 2;
    70}
    71
    72message CallbackOrReference {
    73  oneof oneof {
    74    Callback callback = 1;
    75    Reference reference = 2;
    76  }
    77}
    78
    79message CallbacksOrReferences {
    80  repeated NamedCallbackOrReference additional_properties = 1;
    81}
    82
    83// 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.
    84message Components {
    85  SchemasOrReferences schemas = 1;
    86  ResponsesOrReferences responses = 2;
    87  ParametersOrReferences parameters = 3;
    88  ExamplesOrReferences examples = 4;
    89  RequestBodiesOrReferences request_bodies = 5;
    90  HeadersOrReferences headers = 6;
    91  SecuritySchemesOrReferences security_schemes = 7;
    92  LinksOrReferences links = 8;
    93  CallbacksOrReferences callbacks = 9;
    94  repeated NamedAny specification_extension = 10;
    95}
    96
    97// Contact information for the exposed API.
    98message Contact {
    99  string name = 1;
   100  string url = 2;
   101  string email = 3;
   102  repeated NamedAny specification_extension = 4;
   103}
   104
   105message DefaultType {
   106  oneof oneof {
   107    double number = 1;
   108    bool boolean = 2;
   109    string string = 3;
   110  }
   111}
   112
   113// 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.
   114message Discriminator {
   115  string property_name = 1;
   116  Strings mapping = 2;
   117  repeated NamedAny specification_extension = 3;
   118}
   119
   120message Document {
   121  string openapi = 1;
   122  Info info = 2;
   123  repeated Server servers = 3;
   124  Paths paths = 4;
   125  Components components = 5;
   126  repeated SecurityRequirement security = 6;
   127  repeated Tag tags = 7;
   128  ExternalDocs external_docs = 8;
   129  repeated NamedAny specification_extension = 9;
   130}
   131
   132// A single encoding definition applied to a single schema property.
   133message Encoding {
   134  string content_type = 1;
   135  HeadersOrReferences headers = 2;
   136  string style = 3;
   137  bool explode = 4;
   138  bool allow_reserved = 5;
   139  repeated NamedAny specification_extension = 6;
   140}
   141
   142message Encodings {
   143  repeated NamedEncoding additional_properties = 1;
   144}
   145
   146message Example {
   147  string summary = 1;
   148  string description = 2;
   149  Any value = 3;
   150  string external_value = 4;
   151  repeated NamedAny specification_extension = 5;
   152}
   153
   154message ExampleOrReference {
   155  oneof oneof {
   156    Example example = 1;
   157    Reference reference = 2;
   158  }
   159}
   160
   161message ExamplesOrReferences {
   162  repeated NamedExampleOrReference additional_properties = 1;
   163}
   164
   165message Expression {
   166  repeated NamedAny additional_properties = 1;
   167}
   168
   169// Allows referencing an external resource for extended documentation.
   170message ExternalDocs {
   171  string description = 1;
   172  string url = 2;
   173  repeated NamedAny specification_extension = 3;
   174}
   175
   176// 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`).
   177message Header {
   178  string description = 1;
   179  bool required = 2;
   180  bool deprecated = 3;
   181  bool allow_empty_value = 4;
   182  string style = 5;
   183  bool explode = 6;
   184  bool allow_reserved = 7;
   185  SchemaOrReference schema = 8;
   186  Any example = 9;
   187  ExamplesOrReferences examples = 10;
   188  MediaTypes content = 11;
   189  repeated NamedAny specification_extension = 12;
   190}
   191
   192message HeaderOrReference {
   193  oneof oneof {
   194    Header header = 1;
   195    Reference reference = 2;
   196  }
   197}
   198
   199message HeadersOrReferences {
   200  repeated NamedHeaderOrReference additional_properties = 1;
   201}
   202
   203// 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.
   204message Info {
   205  string title = 1;
   206  string description = 2;
   207  string terms_of_service = 3;
   208  Contact contact = 4;
   209  License license = 5;
   210  string version = 6;
   211  repeated NamedAny specification_extension = 7;
   212  string summary = 8;
   213}
   214
   215message ItemsItem {
   216  repeated SchemaOrReference schema_or_reference = 1;
   217}
   218
   219// License information for the exposed API.
   220message License {
   221  string name = 1;
   222  string url = 2;
   223  repeated NamedAny specification_extension = 3;
   224}
   225
   226// 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.
   227message Link {
   228  string operation_ref = 1;
   229  string operation_id = 2;
   230  AnyOrExpression parameters = 3;
   231  AnyOrExpression request_body = 4;
   232  string description = 5;
   233  Server server = 6;
   234  repeated NamedAny specification_extension = 7;
   235}
   236
   237message LinkOrReference {
   238  oneof oneof {
   239    Link link = 1;
   240    Reference reference = 2;
   241  }
   242}
   243
   244message LinksOrReferences {
   245  repeated NamedLinkOrReference additional_properties = 1;
   246}
   247
   248// Each Media Type Object provides schema and examples for the media type identified by its key.
   249message MediaType {
   250  SchemaOrReference schema = 1;
   251  Any example = 2;
   252  ExamplesOrReferences examples = 3;
   253  Encodings encoding = 4;
   254  repeated NamedAny specification_extension = 5;
   255}
   256
   257message MediaTypes {
   258  repeated NamedMediaType additional_properties = 1;
   259}
   260
   261// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
   262message NamedAny {
   263  // Map key
   264  string name = 1;
   265  // Mapped value
   266  Any value = 2;
   267}
   268
   269// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs.
   270message NamedCallbackOrReference {
   271  // Map key
   272  string name = 1;
   273  // Mapped value
   274  CallbackOrReference value = 2;
   275}
   276
   277// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs.
   278message NamedEncoding {
   279  // Map key
   280  string name = 1;
   281  // Mapped value
   282  Encoding value = 2;
   283}
   284
   285// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs.
   286message NamedExampleOrReference {
   287  // Map key
   288  string name = 1;
   289  // Mapped value
   290  ExampleOrReference value = 2;
   291}
   292
   293// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs.
   294message NamedHeaderOrReference {
   295  // Map key
   296  string name = 1;
   297  // Mapped value
   298  HeaderOrReference value = 2;
   299}
   300
   301// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs.
   302message NamedLinkOrReference {
   303  // Map key
   304  string name = 1;
   305  // Mapped value
   306  LinkOrReference value = 2;
   307}
   308
   309// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs.
   310message NamedMediaType {
   311  // Map key
   312  string name = 1;
   313  // Mapped value
   314  MediaType value = 2;
   315}
   316
   317// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs.
   318message NamedParameterOrReference {
   319  // Map key
   320  string name = 1;
   321  // Mapped value
   322  ParameterOrReference value = 2;
   323}
   324
   325// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
   326message NamedPathItem {
   327  // Map key
   328  string name = 1;
   329  // Mapped value
   330  PathItem value = 2;
   331}
   332
   333// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs.
   334message NamedRequestBodyOrReference {
   335  // Map key
   336  string name = 1;
   337  // Mapped value
   338  RequestBodyOrReference value = 2;
   339}
   340
   341// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs.
   342message NamedResponseOrReference {
   343  // Map key
   344  string name = 1;
   345  // Mapped value
   346  ResponseOrReference value = 2;
   347}
   348
   349// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs.
   350message NamedSchemaOrReference {
   351  // Map key
   352  string name = 1;
   353  // Mapped value
   354  SchemaOrReference value = 2;
   355}
   356
   357// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs.
   358message NamedSecuritySchemeOrReference {
   359  // Map key
   360  string name = 1;
   361  // Mapped value
   362  SecuritySchemeOrReference value = 2;
   363}
   364
   365// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs.
   366message NamedServerVariable {
   367  // Map key
   368  string name = 1;
   369  // Mapped value
   370  ServerVariable value = 2;
   371}
   372
   373// Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
   374message NamedString {
   375  // Map key
   376  string name = 1;
   377  // Mapped value
   378  string value = 2;
   379}
   380
   381// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
   382message NamedStringArray {
   383  // Map key
   384  string name = 1;
   385  // Mapped value
   386  StringArray value = 2;
   387}
   388
   389// Configuration details for a supported OAuth Flow
   390message OauthFlow {
   391  string authorization_url = 1;
   392  string token_url = 2;
   393  string refresh_url = 3;
   394  Strings scopes = 4;
   395  repeated NamedAny specification_extension = 5;
   396}
   397
   398// Allows configuration of the supported OAuth Flows.
   399message OauthFlows {
   400  OauthFlow implicit = 1;
   401  OauthFlow password = 2;
   402  OauthFlow client_credentials = 3;
   403  OauthFlow authorization_code = 4;
   404  repeated NamedAny specification_extension = 5;
   405}
   406
   407message Object {
   408  repeated NamedAny additional_properties = 1;
   409}
   410
   411// Describes a single API operation on a path.
   412message Operation {
   413  repeated string tags = 1;
   414  string summary = 2;
   415  string description = 3;
   416  ExternalDocs external_docs = 4;
   417  string operation_id = 5;
   418  repeated ParameterOrReference parameters = 6;
   419  RequestBodyOrReference request_body = 7;
   420  Responses responses = 8;
   421  CallbacksOrReferences callbacks = 9;
   422  bool deprecated = 10;
   423  repeated SecurityRequirement security = 11;
   424  repeated Server servers = 12;
   425  repeated NamedAny specification_extension = 13;
   426}
   427
   428// Describes a single operation parameter.  A unique parameter is defined by a combination of a name and location.
   429message Parameter {
   430  string name = 1;
   431  string in = 2;
   432  string description = 3;
   433  bool required = 4;
   434  bool deprecated = 5;
   435  bool allow_empty_value = 6;
   436  string style = 7;
   437  bool explode = 8;
   438  bool allow_reserved = 9;
   439  SchemaOrReference schema = 10;
   440  Any example = 11;
   441  ExamplesOrReferences examples = 12;
   442  MediaTypes content = 13;
   443  repeated NamedAny specification_extension = 14;
   444}
   445
   446message ParameterOrReference {
   447  oneof oneof {
   448    Parameter parameter = 1;
   449    Reference reference = 2;
   450  }
   451}
   452
   453message ParametersOrReferences {
   454  repeated NamedParameterOrReference additional_properties = 1;
   455}
   456
   457// 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.
   458message PathItem {
   459  string _ref = 1;
   460  string summary = 2;
   461  string description = 3;
   462  Operation get = 4;
   463  Operation put = 5;
   464  Operation post = 6;
   465  Operation delete = 7;
   466  Operation options = 8;
   467  Operation head = 9;
   468  Operation patch = 10;
   469  Operation trace = 11;
   470  repeated Server servers = 12;
   471  repeated ParameterOrReference parameters = 13;
   472  repeated NamedAny specification_extension = 14;
   473}
   474
   475// 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.
   476message Paths {
   477  repeated NamedPathItem path = 1;
   478  repeated NamedAny specification_extension = 2;
   479}
   480
   481message Properties {
   482  repeated NamedSchemaOrReference additional_properties = 1;
   483}
   484
   485// 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.
   486message Reference {
   487  string _ref = 1;
   488  string summary = 2;
   489  string description = 3;
   490}
   491
   492message RequestBodiesOrReferences {
   493  repeated NamedRequestBodyOrReference additional_properties = 1;
   494}
   495
   496// Describes a single request body.
   497message RequestBody {
   498  string description = 1;
   499  MediaTypes content = 2;
   500  bool required = 3;
   501  repeated NamedAny specification_extension = 4;
   502}
   503
   504message RequestBodyOrReference {
   505  oneof oneof {
   506    RequestBody request_body = 1;
   507    Reference reference = 2;
   508  }
   509}
   510
   511// Describes a single response from an API Operation, including design-time, static  `links` to operations based on the response.
   512message Response {
   513  string description = 1;
   514  HeadersOrReferences headers = 2;
   515  MediaTypes content = 3;
   516  LinksOrReferences links = 4;
   517  repeated NamedAny specification_extension = 5;
   518}
   519
   520message ResponseOrReference {
   521  oneof oneof {
   522    Response response = 1;
   523    Reference reference = 2;
   524  }
   525}
   526
   527// 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.
   528message Responses {
   529  ResponseOrReference default = 1;
   530  repeated NamedResponseOrReference response_or_reference = 2;
   531  repeated NamedAny specification_extension = 3;
   532}
   533
   534message ResponsesOrReferences {
   535  repeated NamedResponseOrReference additional_properties = 1;
   536}
   537
   538// 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.
   539message Schema {
   540  bool nullable = 1;
   541  Discriminator discriminator = 2;
   542  bool read_only = 3;
   543  bool write_only = 4;
   544  Xml xml = 5;
   545  ExternalDocs external_docs = 6;
   546  Any example = 7;
   547  bool deprecated = 8;
   548  string title = 9;
   549  double multiple_of = 10;
   550  double maximum = 11;
   551  bool exclusive_maximum = 12;
   552  double minimum = 13;
   553  bool exclusive_minimum = 14;
   554  int64 max_length = 15;
   555  int64 min_length = 16;
   556  string pattern = 17;
   557  int64 max_items = 18;
   558  int64 min_items = 19;
   559  bool unique_items = 20;
   560  int64 max_properties = 21;
   561  int64 min_properties = 22;
   562  repeated string required = 23;
   563  repeated Any enum = 24;
   564  string type = 25;
   565  repeated SchemaOrReference all_of = 26;
   566  repeated SchemaOrReference one_of = 27;
   567  repeated SchemaOrReference any_of = 28;
   568  Schema not = 29;
   569  ItemsItem items = 30;
   570  Properties properties = 31;
   571  AdditionalPropertiesItem additional_properties = 32;
   572  DefaultType default = 33;
   573  string description = 34;
   574  string format = 35;
   575  repeated NamedAny specification_extension = 36;
   576}
   577
   578message SchemaOrReference {
   579  oneof oneof {
   580    Schema schema = 1;
   581    Reference reference = 2;
   582  }
   583}
   584
   585message SchemasOrReferences {
   586  repeated NamedSchemaOrReference additional_properties = 1;
   587}
   588
   589// 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.
   590message SecurityRequirement {
   591  repeated NamedStringArray additional_properties = 1;
   592}
   593
   594// 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.
   595message SecurityScheme {
   596  string type = 1;
   597  string description = 2;
   598  string name = 3;
   599  string in = 4;
   600  string scheme = 5;
   601  string bearer_format = 6;
   602  OauthFlows flows = 7;
   603  string open_id_connect_url = 8;
   604  repeated NamedAny specification_extension = 9;
   605}
   606
   607message SecuritySchemeOrReference {
   608  oneof oneof {
   609    SecurityScheme security_scheme = 1;
   610    Reference reference = 2;
   611  }
   612}
   613
   614message SecuritySchemesOrReferences {
   615  repeated NamedSecuritySchemeOrReference additional_properties = 1;
   616}
   617
   618// An object representing a Server.
   619message Server {
   620  string url = 1;
   621  string description = 2;
   622  ServerVariables variables = 3;
   623  repeated NamedAny specification_extension = 4;
   624}
   625
   626// An object representing a Server Variable for server URL template substitution.
   627message ServerVariable {
   628  repeated string enum = 1;
   629  string default = 2;
   630  string description = 3;
   631  repeated NamedAny specification_extension = 4;
   632}
   633
   634message ServerVariables {
   635  repeated NamedServerVariable additional_properties = 1;
   636}
   637
   638// Any property starting with x- is valid.
   639message SpecificationExtension {
   640  oneof oneof {
   641    double number = 1;
   642    bool boolean = 2;
   643    string string = 3;
   644  }
   645}
   646
   647message StringArray {
   648  repeated string value = 1;
   649}
   650
   651message Strings {
   652  repeated NamedString additional_properties = 1;
   653}
   654
   655// 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.
   656message Tag {
   657  string name = 1;
   658  string description = 2;
   659  ExternalDocs external_docs = 3;
   660  repeated NamedAny specification_extension = 4;
   661}
   662
   663// 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.
   664message Xml {
   665  string name = 1;
   666  string namespace = 2;
   667  string prefix = 3;
   668  bool attribute = 4;
   669  bool wrapped = 5;
   670  repeated NamedAny specification_extension = 6;
   671}
   672

View as plain text