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