extension.proto 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. syntax = "proto3";
  15. import "google/protobuf/any.proto";
  16. package openapiextension.v1;
  17. // This option lets the proto compiler generate Java code inside the package
  18. // name (see below) instead of inside an outer class. It creates a simpler
  19. // developer experience by reducing one-level of name nesting and be
  20. // consistent with most programming languages that don't support outer classes.
  21. option java_multiple_files = true;
  22. // The Java outer classname should be the filename in UpperCamelCase. This
  23. // class is only used to hold proto descriptor, so developers don't need to
  24. // work with it directly.
  25. option java_outer_classname = "OpenAPIExtensionV1";
  26. // The Java package name must be proto package name with proper prefix.
  27. option java_package = "org.openapic.v1";
  28. // A reasonable prefix for the Objective-C symbols generated from the package.
  29. // It should at a minimum be 3 characters long, all uppercase, and convention
  30. // is to use an abbreviation of the package name. Something short, but
  31. // hopefully unique enough to not conflict with things that may come along in
  32. // the future. 'GPB' is reserved for the protocol buffer implementation itself.
  33. //
  34. option objc_class_prefix = "OAE"; // "OpenAPI Extension"
  35. // The version number of OpenAPI compiler.
  36. message Version {
  37. int32 major = 1;
  38. int32 minor = 2;
  39. int32 patch = 3;
  40. // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
  41. // be empty for mainline stable releases.
  42. string suffix = 4;
  43. }
  44. // An encoded Request is written to the ExtensionHandler's stdin.
  45. message ExtensionHandlerRequest {
  46. // The OpenAPI descriptions that were explicitly listed on the command line.
  47. // The specifications will appear in the order they are specified to openapic.
  48. Wrapper wrapper = 1;
  49. // The version number of openapi compiler.
  50. Version compiler_version = 3;
  51. }
  52. // The extensions writes an encoded ExtensionHandlerResponse to stdout.
  53. message ExtensionHandlerResponse {
  54. // true if the extension is handled by the extension handler; false otherwise
  55. bool handled = 1;
  56. // Error message. If non-empty, the extension handling failed.
  57. // The extension handler process should exit with status code zero
  58. // even if it reports an error in this way.
  59. //
  60. // This should be used to indicate errors which prevent the extension from
  61. // operating as intended. Errors which indicate a problem in gnostic
  62. // itself -- such as the input Document being unparseable -- should be
  63. // reported by writing a message to stderr and exiting with a non-zero
  64. // status code.
  65. repeated string error = 2;
  66. // text output
  67. google.protobuf.Any value = 3;
  68. }
  69. message Wrapper {
  70. // version of the OpenAPI specification in which this extension was written.
  71. string version = 1;
  72. // Name of the extension
  73. string extension_name = 2;
  74. // Must be a valid yaml for the proto
  75. string yaml = 3;
  76. }