converter

package
v1.7.12-integrations Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum

type Enum struct {
	Reserved  []*Reserved                 `json:"reserved,omitempty"`
	EnumField map[string]EnumValue        `json:"field,omitempty"`
	Options   map[string]Option           `json:"options,omitempty"`
	Lines     map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Enum is a JSON representation of a proto enum

type EnumValue

type EnumValue struct {
	Value   int                         `json:"value,omitempty"`
	Options Option                      `json:"options,omitempty"`
	Lines   map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

EnumValue is a JSON representation of a proto enum value

type Field

type Field struct {
	Type     string                      `json:"type,omitempty"`
	Sequence int                         `json:"sequence,omitempty"`
	Repeated bool                        `json:"repeated,omitempty"`
	Required bool                        `json:"required,omitempty"`
	Optional bool                        `json:"optional,omitempty"`
	Options  []Option                    `json:"options,omitempty"`
	Lines    map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Field is a JSON representation of a proto field

type Import

type Import struct {
	Kind  string                      `json:"kind,omitempty"`
	Lines map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Import is a JSON representation of a proto import

type JSONProto

type JSONProto struct {
	Syntax      string                      `json:"syntax"`
	PackageName string                      `json:"package"`
	Messages    map[string]interface{}      `json:"messages"`
	Enum        map[string]interface{}      `json:"enum"`
	Services    map[string]interface{}      `json:"services"`
	Imports     map[string]interface{}      `json:"imports"`
	Options     []Option                    `json:"options"`
	Lines       map[string]model.LineObject `json:"_kics_lines"`
	// contains filtered or unexported fields
}

JSONProto is a JSON representation of a proto file

func Convert

func Convert(nodes *proto.Proto) (file *JSONProto, linesIgnore []int)

Convert converts a proto file to a JSONProto struct

type Map

type Map struct {
	*Field  `json:"field,omitempty"`
	KeyType string                      `json:"key_type,omitempty"`
	Lines   map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Map is a JSON representation of a proto map

type Message

type Message struct {
	Field        map[string]*Field           `json:"field,omitempty"`
	Reserved     []*Reserved                 `json:"reserved,omitempty"`
	OneOf        map[string]OneOf            `json:"oneof,omitempty"`
	Enum         map[string]Enum             `json:"enum,omitempty"`
	Map          map[string]*Map             `json:"map,omitempty"`
	InnerMessage map[string]Message          `json:"inner_message,omitempty"`
	Options      map[string]Option           `json:"options,omitempty"`
	Lines        map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Message is a JSON representation of a proto message

type OneOf

type OneOf struct {
	Field   map[string]*Field           `json:"fields,omitempty"`
	Options map[string]Option           `json:"options,omitempty"`
	Lines   map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

OneOf is a JSON representation of a proto oneof

type Option

type Option struct {
	Name                string                      `json:"name,omitempty"`
	Constant            OptionLiteral               `json:"constant,omitempty"`
	IsEmbedded          bool                        `json:"isEmbedded,omitempty"`
	AggregatedConstants []*OptionLiteral            `json:"aggregatedConstants,omitempty"`
	Lines               map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Option is a JSON representation of a proto option

type OptionLiteral

type OptionLiteral struct {
	Name       string                      `json:"name,omitempty"`
	Source     string                      `json:"source,omitempty"`
	IsString   bool                        `json:"isString,omitempty"`
	QuoteRune  rune                        `json:"quoteRune,omitempty"`
	Array      []OptionLiteral             `json:"array,omitempty"`
	Map        map[string]OptionLiteral    `json:"map,omitempty"`
	OrderedMap []OptionLiteral             `json:"orderedMap,omitempty"`
	Lines      map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

OptionLiteral is a JSON representation of a proto option literal

type RPC

type RPC struct {
	RequestType    string                      `json:"requestType,omitempty"`
	StreamsRequest bool                        `json:"streamsRequest,omitempty"`
	ReturnsType    string                      `json:"returnsType,omitempty"`
	StreamsReturns bool                        `json:"streamsReturns,omitempty"`
	Options        []Option                    `json:"options,omitempty"`
	Lines          map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

RPC is a JSON representation of a proto service RPC

type Reserved

type Reserved struct {
	Ranges     []proto.Range               `json:"ranges,omitempty"`
	FieldNames []string                    `json:"fieldNames,omitempty"`
	Lines      map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Reserved is a JSON representation of a proto reserved

type Service

type Service struct {
	RPC     map[string]RPC              `json:"rpc,omitempty"`
	Options map[string]Option           `json:"options,omitempty"`
	Lines   map[string]model.LineObject `json:"_kics_lines,omitempty"`
}

Service is a JSON representation of a proto service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL