OpenAPIv2.proto 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  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. // THIS FILE IS AUTOMATICALLY GENERATED.
  15. syntax = "proto3";
  16. package openapi.v2;
  17. import "google/protobuf/any.proto";
  18. // This option lets the proto compiler generate Java code inside the package
  19. // name (see below) instead of inside an outer class. It creates a simpler
  20. // developer experience by reducing one-level of name nesting and be
  21. // consistent with most programming languages that don't support outer classes.
  22. option java_multiple_files = true;
  23. // The Java outer classname should be the filename in UpperCamelCase. This
  24. // class is only used to hold proto descriptor, so developers don't need to
  25. // work with it directly.
  26. option java_outer_classname = "OpenAPIProto";
  27. // The Java package name must be proto package name with proper prefix.
  28. option java_package = "org.openapi_v2";
  29. // A reasonable prefix for the Objective-C symbols generated from the package.
  30. // It should at a minimum be 3 characters long, all uppercase, and convention
  31. // is to use an abbreviation of the package name. Something short, but
  32. // hopefully unique enough to not conflict with things that may come along in
  33. // the future. 'GPB' is reserved for the protocol buffer implementation itself.
  34. option objc_class_prefix = "OAS";
  35. // The Go package name.
  36. option go_package = "./openapiv2;openapi_v2";
  37. message AdditionalPropertiesItem {
  38. oneof oneof {
  39. Schema schema = 1;
  40. bool boolean = 2;
  41. }
  42. }
  43. message Any {
  44. google.protobuf.Any value = 1;
  45. string yaml = 2;
  46. }
  47. message ApiKeySecurity {
  48. string type = 1;
  49. string name = 2;
  50. string in = 3;
  51. string description = 4;
  52. repeated NamedAny vendor_extension = 5;
  53. }
  54. message BasicAuthenticationSecurity {
  55. string type = 1;
  56. string description = 2;
  57. repeated NamedAny vendor_extension = 3;
  58. }
  59. message BodyParameter {
  60. // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
  61. string description = 1;
  62. // The name of the parameter.
  63. string name = 2;
  64. // Determines the location of the parameter.
  65. string in = 3;
  66. // Determines whether or not this parameter is required or optional.
  67. bool required = 4;
  68. Schema schema = 5;
  69. repeated NamedAny vendor_extension = 6;
  70. }
  71. // Contact information for the owners of the API.
  72. message Contact {
  73. // The identifying name of the contact person/organization.
  74. string name = 1;
  75. // The URL pointing to the contact information.
  76. string url = 2;
  77. // The email address of the contact person/organization.
  78. string email = 3;
  79. repeated NamedAny vendor_extension = 4;
  80. }
  81. message Default {
  82. repeated NamedAny additional_properties = 1;
  83. }
  84. // One or more JSON objects describing the schemas being consumed and produced by the API.
  85. message Definitions {
  86. repeated NamedSchema additional_properties = 1;
  87. }
  88. message Document {
  89. // The Swagger version of this document.
  90. string swagger = 1;
  91. Info info = 2;
  92. // The host (name or ip) of the API. Example: 'swagger.io'
  93. string host = 3;
  94. // The base path to the API. Example: '/api'.
  95. string base_path = 4;
  96. // The transfer protocol of the API.
  97. repeated string schemes = 5;
  98. // A list of MIME types accepted by the API.
  99. repeated string consumes = 6;
  100. // A list of MIME types the API can produce.
  101. repeated string produces = 7;
  102. Paths paths = 8;
  103. Definitions definitions = 9;
  104. ParameterDefinitions parameters = 10;
  105. ResponseDefinitions responses = 11;
  106. repeated SecurityRequirement security = 12;
  107. SecurityDefinitions security_definitions = 13;
  108. repeated Tag tags = 14;
  109. ExternalDocs external_docs = 15;
  110. repeated NamedAny vendor_extension = 16;
  111. }
  112. message Examples {
  113. repeated NamedAny additional_properties = 1;
  114. }
  115. // information about external documentation
  116. message ExternalDocs {
  117. string description = 1;
  118. string url = 2;
  119. repeated NamedAny vendor_extension = 3;
  120. }
  121. // A deterministic version of a JSON Schema object.
  122. message FileSchema {
  123. string format = 1;
  124. string title = 2;
  125. string description = 3;
  126. Any default = 4;
  127. repeated string required = 5;
  128. string type = 6;
  129. bool read_only = 7;
  130. ExternalDocs external_docs = 8;
  131. Any example = 9;
  132. repeated NamedAny vendor_extension = 10;
  133. }
  134. message FormDataParameterSubSchema {
  135. // Determines whether or not this parameter is required or optional.
  136. bool required = 1;
  137. // Determines the location of the parameter.
  138. string in = 2;
  139. // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
  140. string description = 3;
  141. // The name of the parameter.
  142. string name = 4;
  143. // allows sending a parameter by name only or with an empty value.
  144. bool allow_empty_value = 5;
  145. string type = 6;
  146. string format = 7;
  147. PrimitivesItems items = 8;
  148. string collection_format = 9;
  149. Any default = 10;
  150. double maximum = 11;
  151. bool exclusive_maximum = 12;
  152. double minimum = 13;
  153. bool exclusive_minimum = 14;
  154. int64 max_length = 15;
  155. int64 min_length = 16;
  156. string pattern = 17;
  157. int64 max_items = 18;
  158. int64 min_items = 19;
  159. bool unique_items = 20;
  160. repeated Any enum = 21;
  161. double multiple_of = 22;
  162. repeated NamedAny vendor_extension = 23;
  163. }
  164. message Header {
  165. string type = 1;
  166. string format = 2;
  167. PrimitivesItems items = 3;
  168. string collection_format = 4;
  169. Any default = 5;
  170. double maximum = 6;
  171. bool exclusive_maximum = 7;
  172. double minimum = 8;
  173. bool exclusive_minimum = 9;
  174. int64 max_length = 10;
  175. int64 min_length = 11;
  176. string pattern = 12;
  177. int64 max_items = 13;
  178. int64 min_items = 14;
  179. bool unique_items = 15;
  180. repeated Any enum = 16;
  181. double multiple_of = 17;
  182. string description = 18;
  183. repeated NamedAny vendor_extension = 19;
  184. }
  185. message HeaderParameterSubSchema {
  186. // Determines whether or not this parameter is required or optional.
  187. bool required = 1;
  188. // Determines the location of the parameter.
  189. string in = 2;
  190. // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
  191. string description = 3;
  192. // The name of the parameter.
  193. string name = 4;
  194. string type = 5;
  195. string format = 6;
  196. PrimitivesItems items = 7;
  197. string collection_format = 8;
  198. Any default = 9;
  199. double maximum = 10;
  200. bool exclusive_maximum = 11;
  201. double minimum = 12;
  202. bool exclusive_minimum = 13;
  203. int64 max_length = 14;
  204. int64 min_length = 15;
  205. string pattern = 16;
  206. int64 max_items = 17;
  207. int64 min_items = 18;
  208. bool unique_items = 19;
  209. repeated Any enum = 20;
  210. double multiple_of = 21;
  211. repeated NamedAny vendor_extension = 22;
  212. }
  213. message Headers {
  214. repeated NamedHeader additional_properties = 1;
  215. }
  216. // General information about the API.
  217. message Info {
  218. // A unique and precise title of the API.
  219. string title = 1;
  220. // A semantic version number of the API.
  221. string version = 2;
  222. // A longer description of the API. Should be different from the title. GitHub Flavored Markdown is allowed.
  223. string description = 3;
  224. // The terms of service for the API.
  225. string terms_of_service = 4;
  226. Contact contact = 5;
  227. License license = 6;
  228. repeated NamedAny vendor_extension = 7;
  229. }
  230. message ItemsItem {
  231. repeated Schema schema = 1;
  232. }
  233. message JsonReference {
  234. string _ref = 1;
  235. string description = 2;
  236. }
  237. message License {
  238. // The name of the license type. It's encouraged to use an OSI compatible license.
  239. string name = 1;
  240. // The URL pointing to the license.
  241. string url = 2;
  242. repeated NamedAny vendor_extension = 3;
  243. }
  244. // Automatically-generated message used to represent maps of Any as ordered (name,value) pairs.
  245. message NamedAny {
  246. // Map key
  247. string name = 1;
  248. // Mapped value
  249. Any value = 2;
  250. }
  251. // Automatically-generated message used to represent maps of Header as ordered (name,value) pairs.
  252. message NamedHeader {
  253. // Map key
  254. string name = 1;
  255. // Mapped value
  256. Header value = 2;
  257. }
  258. // Automatically-generated message used to represent maps of Parameter as ordered (name,value) pairs.
  259. message NamedParameter {
  260. // Map key
  261. string name = 1;
  262. // Mapped value
  263. Parameter value = 2;
  264. }
  265. // Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs.
  266. message NamedPathItem {
  267. // Map key
  268. string name = 1;
  269. // Mapped value
  270. PathItem value = 2;
  271. }
  272. // Automatically-generated message used to represent maps of Response as ordered (name,value) pairs.
  273. message NamedResponse {
  274. // Map key
  275. string name = 1;
  276. // Mapped value
  277. Response value = 2;
  278. }
  279. // Automatically-generated message used to represent maps of ResponseValue as ordered (name,value) pairs.
  280. message NamedResponseValue {
  281. // Map key
  282. string name = 1;
  283. // Mapped value
  284. ResponseValue value = 2;
  285. }
  286. // Automatically-generated message used to represent maps of Schema as ordered (name,value) pairs.
  287. message NamedSchema {
  288. // Map key
  289. string name = 1;
  290. // Mapped value
  291. Schema value = 2;
  292. }
  293. // Automatically-generated message used to represent maps of SecurityDefinitionsItem as ordered (name,value) pairs.
  294. message NamedSecurityDefinitionsItem {
  295. // Map key
  296. string name = 1;
  297. // Mapped value
  298. SecurityDefinitionsItem value = 2;
  299. }
  300. // Automatically-generated message used to represent maps of string as ordered (name,value) pairs.
  301. message NamedString {
  302. // Map key
  303. string name = 1;
  304. // Mapped value
  305. string value = 2;
  306. }
  307. // Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs.
  308. message NamedStringArray {
  309. // Map key
  310. string name = 1;
  311. // Mapped value
  312. StringArray value = 2;
  313. }
  314. message NonBodyParameter {
  315. oneof oneof {
  316. HeaderParameterSubSchema header_parameter_sub_schema = 1;
  317. FormDataParameterSubSchema form_data_parameter_sub_schema = 2;
  318. QueryParameterSubSchema query_parameter_sub_schema = 3;
  319. PathParameterSubSchema path_parameter_sub_schema = 4;
  320. }
  321. }
  322. message Oauth2AccessCodeSecurity {
  323. string type = 1;
  324. string flow = 2;
  325. Oauth2Scopes scopes = 3;
  326. string authorization_url = 4;
  327. string token_url = 5;
  328. string description = 6;
  329. repeated NamedAny vendor_extension = 7;
  330. }
  331. message Oauth2ApplicationSecurity {
  332. string type = 1;
  333. string flow = 2;
  334. Oauth2Scopes scopes = 3;
  335. string token_url = 4;
  336. string description = 5;
  337. repeated NamedAny vendor_extension = 6;
  338. }
  339. message Oauth2ImplicitSecurity {
  340. string type = 1;
  341. string flow = 2;
  342. Oauth2Scopes scopes = 3;
  343. string authorization_url = 4;
  344. string description = 5;
  345. repeated NamedAny vendor_extension = 6;
  346. }
  347. message Oauth2PasswordSecurity {
  348. string type = 1;
  349. string flow = 2;
  350. Oauth2Scopes scopes = 3;
  351. string token_url = 4;
  352. string description = 5;
  353. repeated NamedAny vendor_extension = 6;
  354. }
  355. message Oauth2Scopes {
  356. repeated NamedString additional_properties = 1;
  357. }
  358. message Operation {
  359. repeated string tags = 1;
  360. // A brief summary of the operation.
  361. string summary = 2;
  362. // A longer description of the operation, GitHub Flavored Markdown is allowed.
  363. string description = 3;
  364. ExternalDocs external_docs = 4;
  365. // A unique identifier of the operation.
  366. string operation_id = 5;
  367. // A list of MIME types the API can produce.
  368. repeated string produces = 6;
  369. // A list of MIME types the API can consume.
  370. repeated string consumes = 7;
  371. // The parameters needed to send a valid API call.
  372. repeated ParametersItem parameters = 8;
  373. Responses responses = 9;
  374. // The transfer protocol of the API.
  375. repeated string schemes = 10;
  376. bool deprecated = 11;
  377. repeated SecurityRequirement security = 12;
  378. repeated NamedAny vendor_extension = 13;
  379. }
  380. message Parameter {
  381. oneof oneof {
  382. BodyParameter body_parameter = 1;
  383. NonBodyParameter non_body_parameter = 2;
  384. }
  385. }
  386. // One or more JSON representations for parameters
  387. message ParameterDefinitions {
  388. repeated NamedParameter additional_properties = 1;
  389. }
  390. message ParametersItem {
  391. oneof oneof {
  392. Parameter parameter = 1;
  393. JsonReference json_reference = 2;
  394. }
  395. }
  396. message PathItem {
  397. string _ref = 1;
  398. Operation get = 2;
  399. Operation put = 3;
  400. Operation post = 4;
  401. Operation delete = 5;
  402. Operation options = 6;
  403. Operation head = 7;
  404. Operation patch = 8;
  405. // The parameters needed to send a valid API call.
  406. repeated ParametersItem parameters = 9;
  407. repeated NamedAny vendor_extension = 10;
  408. }
  409. message PathParameterSubSchema {
  410. // Determines whether or not this parameter is required or optional.
  411. bool required = 1;
  412. // Determines the location of the parameter.
  413. string in = 2;
  414. // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
  415. string description = 3;
  416. // The name of the parameter.
  417. string name = 4;
  418. string type = 5;
  419. string format = 6;
  420. PrimitivesItems items = 7;
  421. string collection_format = 8;
  422. Any default = 9;
  423. double maximum = 10;
  424. bool exclusive_maximum = 11;
  425. double minimum = 12;
  426. bool exclusive_minimum = 13;
  427. int64 max_length = 14;
  428. int64 min_length = 15;
  429. string pattern = 16;
  430. int64 max_items = 17;
  431. int64 min_items = 18;
  432. bool unique_items = 19;
  433. repeated Any enum = 20;
  434. double multiple_of = 21;
  435. repeated NamedAny vendor_extension = 22;
  436. }
  437. // Relative paths to the individual endpoints. They must be relative to the 'basePath'.
  438. message Paths {
  439. repeated NamedAny vendor_extension = 1;
  440. repeated NamedPathItem path = 2;
  441. }
  442. message PrimitivesItems {
  443. string type = 1;
  444. string format = 2;
  445. PrimitivesItems items = 3;
  446. string collection_format = 4;
  447. Any default = 5;
  448. double maximum = 6;
  449. bool exclusive_maximum = 7;
  450. double minimum = 8;
  451. bool exclusive_minimum = 9;
  452. int64 max_length = 10;
  453. int64 min_length = 11;
  454. string pattern = 12;
  455. int64 max_items = 13;
  456. int64 min_items = 14;
  457. bool unique_items = 15;
  458. repeated Any enum = 16;
  459. double multiple_of = 17;
  460. repeated NamedAny vendor_extension = 18;
  461. }
  462. message Properties {
  463. repeated NamedSchema additional_properties = 1;
  464. }
  465. message QueryParameterSubSchema {
  466. // Determines whether or not this parameter is required or optional.
  467. bool required = 1;
  468. // Determines the location of the parameter.
  469. string in = 2;
  470. // A brief description of the parameter. This could contain examples of use. GitHub Flavored Markdown is allowed.
  471. string description = 3;
  472. // The name of the parameter.
  473. string name = 4;
  474. // allows sending a parameter by name only or with an empty value.
  475. bool allow_empty_value = 5;
  476. string type = 6;
  477. string format = 7;
  478. PrimitivesItems items = 8;
  479. string collection_format = 9;
  480. Any default = 10;
  481. double maximum = 11;
  482. bool exclusive_maximum = 12;
  483. double minimum = 13;
  484. bool exclusive_minimum = 14;
  485. int64 max_length = 15;
  486. int64 min_length = 16;
  487. string pattern = 17;
  488. int64 max_items = 18;
  489. int64 min_items = 19;
  490. bool unique_items = 20;
  491. repeated Any enum = 21;
  492. double multiple_of = 22;
  493. repeated NamedAny vendor_extension = 23;
  494. }
  495. message Response {
  496. string description = 1;
  497. SchemaItem schema = 2;
  498. Headers headers = 3;
  499. Examples examples = 4;
  500. repeated NamedAny vendor_extension = 5;
  501. }
  502. // One or more JSON representations for responses
  503. message ResponseDefinitions {
  504. repeated NamedResponse additional_properties = 1;
  505. }
  506. message ResponseValue {
  507. oneof oneof {
  508. Response response = 1;
  509. JsonReference json_reference = 2;
  510. }
  511. }
  512. // Response objects names can either be any valid HTTP status code or 'default'.
  513. message Responses {
  514. repeated NamedResponseValue response_code = 1;
  515. repeated NamedAny vendor_extension = 2;
  516. }
  517. // A deterministic version of a JSON Schema object.
  518. message Schema {
  519. string _ref = 1;
  520. string format = 2;
  521. string title = 3;
  522. string description = 4;
  523. Any default = 5;
  524. double multiple_of = 6;
  525. double maximum = 7;
  526. bool exclusive_maximum = 8;
  527. double minimum = 9;
  528. bool exclusive_minimum = 10;
  529. int64 max_length = 11;
  530. int64 min_length = 12;
  531. string pattern = 13;
  532. int64 max_items = 14;
  533. int64 min_items = 15;
  534. bool unique_items = 16;
  535. int64 max_properties = 17;
  536. int64 min_properties = 18;
  537. repeated string required = 19;
  538. repeated Any enum = 20;
  539. AdditionalPropertiesItem additional_properties = 21;
  540. TypeItem type = 22;
  541. ItemsItem items = 23;
  542. repeated Schema all_of = 24;
  543. Properties properties = 25;
  544. string discriminator = 26;
  545. bool read_only = 27;
  546. Xml xml = 28;
  547. ExternalDocs external_docs = 29;
  548. Any example = 30;
  549. repeated NamedAny vendor_extension = 31;
  550. }
  551. message SchemaItem {
  552. oneof oneof {
  553. Schema schema = 1;
  554. FileSchema file_schema = 2;
  555. }
  556. }
  557. message SecurityDefinitions {
  558. repeated NamedSecurityDefinitionsItem additional_properties = 1;
  559. }
  560. message SecurityDefinitionsItem {
  561. oneof oneof {
  562. BasicAuthenticationSecurity basic_authentication_security = 1;
  563. ApiKeySecurity api_key_security = 2;
  564. Oauth2ImplicitSecurity oauth2_implicit_security = 3;
  565. Oauth2PasswordSecurity oauth2_password_security = 4;
  566. Oauth2ApplicationSecurity oauth2_application_security = 5;
  567. Oauth2AccessCodeSecurity oauth2_access_code_security = 6;
  568. }
  569. }
  570. message SecurityRequirement {
  571. repeated NamedStringArray additional_properties = 1;
  572. }
  573. message StringArray {
  574. repeated string value = 1;
  575. }
  576. message Tag {
  577. string name = 1;
  578. string description = 2;
  579. ExternalDocs external_docs = 3;
  580. repeated NamedAny vendor_extension = 4;
  581. }
  582. message TypeItem {
  583. repeated string value = 1;
  584. }
  585. // Any property starting with x- is valid.
  586. message VendorExtension {
  587. repeated NamedAny additional_properties = 1;
  588. }
  589. message Xml {
  590. string name = 1;
  591. string namespace = 2;
  592. string prefix = 3;
  593. bool attribute = 4;
  594. bool wrapped = 5;
  595. repeated NamedAny vendor_extension = 6;
  596. }