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