Documentation ¶
Overview ¶
Copyright 2019 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
descriptor_renderer generates a FileDescriptorSet from a gnostic output file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdjustSurfaceModel ¶
func AdjustSurfaceModel(model *surface_v1.Model, inputDocumentType string)
AdjustSurfaceModel simplifies and prettifies the types and fields of the surface model in order to get a better looking output file. Related to: https://github.com/googleapis/gnostic-grpc/issues/11
func CleanName ¶
Removes characters which are not allowed for message names or field names inside .proto files.
func RunProtoGenerator ¶
func RunProtoGenerator()
This is the main function for the code generation plugin.
Types ¶
type GrpcChecker ¶
type GrpcChecker struct {
// contains filtered or unexported fields
}
func NewGrpcChecker ¶
func NewGrpcChecker(document *openapiv3.Document) *GrpcChecker
Creates a new checker.
func (*GrpcChecker) Run ¶
func (c *GrpcChecker) Run() []*plugins.Message
Runs the checker. It is a top-down approach.
type LineWriter ¶
func NewLineWriter ¶
func NewLineWriter() *LineWriter
func (*LineWriter) WriteLine ¶
func (w *LineWriter) WriteLine(line string)
type ProtoLanguageModel ¶
type ProtoLanguageModel struct{}
func NewProtoLanguageModel ¶
func NewProtoLanguageModel() *ProtoLanguageModel
func (*ProtoLanguageModel) Prepare ¶
func (language *ProtoLanguageModel) Prepare(model *surface_v1.Model, inputDocumentType string)
Prepare sets language-specific properties for all types and methods.
type Renderer ¶
type Renderer struct { // The model holds the necessary information from the OpenAPI description. Model *surface.Model // The FileDescriptorSet that will be printed with protoreflect FdSet *dpb.FileDescriptorSet SymbolicFdSets []*dpb.FileDescriptorSet Package string // package name }
Renderer generates a .proto file based on the information inside Model.
func NewRenderer ¶
NewRenderer creates a renderer.