OpenAPIv2.proto 17 KB

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