newfieldsdetector

package
v0.0.0-...-1e7835e Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFieldIgnored

func IsFieldIgnored(ignoredFields sets.String, fullyQualifiedMessageName, fieldName string) bool

IsFieldIgnored checks if a field should be ignored based on its fully qualified name

func LoadIgnoredFields

func LoadIgnoredFields(configPath string) (sets.String, error)

LoadIgnoredFields loads and parses the ignored fields YAML file

Types

type DetectorOptions

type DetectorOptions struct {
	TargetMessages sets.String
	IgnoredFields  sets.String
}

type FieldChange

type FieldChange struct {
	OldType    protoreflect.Kind
	NewType    protoreflect.Kind
	IsRepeated bool
}

type FieldDetector

type FieldDetector struct {
	// contains filtered or unexported fields
}

func NewFieldDetector

func NewFieldDetector(opts *DetectorOptions) (*FieldDetector, error)

NewFieldDetector detects any proto field changes between the current pinned and the HEAD.

func (*FieldDetector) DetectNewFields

func (d *FieldDetector) DetectNewFields() ([]MessageDiff, error)

type GenerateTypesFlags

type GenerateTypesFlags struct {
	Service   string
	Resources []ResourceMapping
}

GenerateTypesFlags represents the flags used in "generate-types" command

type IgnoredFieldsConfig

type IgnoredFieldsConfig struct {
	// key is proto package name (e.g., "google.cloud.compute.v1").
	ProtoPackages map[string]MessageFieldIgnores `yaml:",inline"`
}

IgnoredFieldsConfig represents the structure of the ignored fields YAML file.

Example YAML:

google.cloud.bigquery.connection.v1:

  Connection:
	- salesforceDataCloud

google.api.apikeys.v2:

  Key:
	- createTime
	- updateTime

type MessageDiff

type MessageDiff struct {
	MessageName   string
	NewFields     []string               // fields added in the new version
	RemovedFields []string               // fields removed in the new version
	ChangedFields map[string]FieldChange // fields changed in the new version
}

type MessageFieldIgnores

type MessageFieldIgnores struct {
	// key is proto message name (e.g. "Instance")
	// value is list of field names to be ignored in the message.
	Messages map[string][]string `yaml:",inline"`
}

type ResourceMapping

type ResourceMapping struct {
	KRMType      string
	ProtoMessage string
}

Jump to

Keyboard shortcuts

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