extension.proto 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. // Copyright 2017 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. syntax = "proto3";
  15. package gnostic.extension.v1;
  16. import "google/protobuf/any.proto";
  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 = "GnosticExtension";
  26. // The Java package name must be proto package name with proper prefix.
  27. option java_package = "org.gnostic.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. // "Gnostic Extension"
  35. option objc_class_prefix = "GNX";
  36. // The Go package name.
  37. option go_package = "./extensions;gnostic_extension_v1";
  38. // The version number of Gnostic.
  39. message Version {
  40. int32 major = 1;
  41. int32 minor = 2;
  42. int32 patch = 3;
  43. // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
  44. // be empty for mainline stable releases.
  45. string suffix = 4;
  46. }
  47. // An encoded Request is written to the ExtensionHandler's stdin.
  48. message ExtensionHandlerRequest {
  49. // The extension to process.
  50. Wrapper wrapper = 1;
  51. // The version number of Gnostic.
  52. Version compiler_version = 2;
  53. }
  54. // The extensions writes an encoded ExtensionHandlerResponse to stdout.
  55. message ExtensionHandlerResponse {
  56. // true if the extension is handled by the extension handler; false otherwise
  57. bool handled = 1;
  58. // Error message(s). If non-empty, the extension handling failed.
  59. // The extension handler process should exit with status code zero
  60. // even if it reports an error in this way.
  61. //
  62. // This should be used to indicate errors which prevent the extension from
  63. // operating as intended. Errors which indicate a problem in gnostic
  64. // itself -- such as the input Document being unparseable -- should be
  65. // reported by writing a message to stderr and exiting with a non-zero
  66. // status code.
  67. repeated string errors = 2;
  68. // text output
  69. google.protobuf.Any value = 3;
  70. }
  71. message Wrapper {
  72. // version of the OpenAPI specification in which this extension was written.
  73. string version = 1;
  74. // Name of the extension.
  75. string extension_name = 2;
  76. // YAML-formatted extension value.
  77. string yaml = 3;
  78. }