schema

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package schema contains the types and functions for generating the schema from the spec and definition files.

Index

Constants

View Source
const CoordinatesVSSDataType = "Types.DIMO.Coordinates"

CoordinatesVSSDataType is a hardcoded reference to a VSS struct type that contains three properties: latitude, longitude, and HDOP.

See the COVESA documentation for more on VSS structs: https://covesa.github.io/vehicle_signal_specification/rule_set/data_entry/data_types_struct/

The type is in the VSS CSV file that we embed, but we are not yet willing to write a general mechanism for translating VSS structs into Go structs.

Variables

This section is empty.

Functions

func DefaultDefinitionsYAML added in v0.4.0

func DefaultDefinitionsYAML() string

DefaultDefinitionsYAML is the embedded YAML file containing information about what signals will be displayed and used by the DIMO Node.

func DefaultEventTagsYAML added in v0.7.3

func DefaultEventTagsYAML() string

DefaultEventTagsYAML is the embedded YAML file containing information about event tags.

func DefinitionsYAML deprecated

func DefinitionsYAML() string

DefinitionsYAML is the embedded YAML file containing the definitions.yaml for the VSS schema.

Deprecated: Use pkg/nativestatus/shema.DefinitionsYAML instead.

func EventTagToGoName added in v0.7.3

func EventTagToGoName(name string) string

func VSSToGoName added in v0.2.11

func VSSToGoName(name string) string

VSSToGoName returns the golang formated name of a VSS signal. This is done by removing the root Prefix and nonAlphaNumeric characters from the name and capitalizes the first letter.

func VSSToJSONName added in v0.2.11

func VSSToJSONName(name string) string

VSSToJSONName returns the JSON formated name of a VSS signal. This is done by removing the root Prefix and nonAlphaNumeric characters from the name and lowercases the first word.

func Validate added in v0.2.1

func Validate(d *DefinitionInfo) error

Validate checks if the definition is valid.

func ValidateEventTag added in v0.7.3

func ValidateEventTag(e *EventTagInfo) error

func VssRel42DIMO

func VssRel42DIMO() string

VssRel42DIMO is the embedded CSV file containing the VSS schema for DIMO.

Types

type ConversionInfo

type ConversionInfo struct {
	OriginalName string `json:"originalName" yaml:"originalName"`
	OriginalType string `json:"originalType" yaml:"originalType"`
	IsArray      bool   `json:"isArray"      yaml:"isArray"`
}

ConversionInfo contains the conversion information for a field.

type DefinitionInfo

type DefinitionInfo struct {
	VspecName          string            `json:"vspecName"          yaml:"vspecName"`
	Conversions        []*ConversionInfo `json:"conversions"        yaml:"conversions"`
	RequiredPrivileges []string          `json:"requiredPrivileges" yaml:"requiredPrivileges"`
}

DefinitionInfo contains the definition information for a field.

type Definitions

type Definitions struct {
	// FromName contains a mapping from VSS name to definition info.
	FromName map[string]*DefinitionInfo
}

Definitions is a map of definitions from clickhouse Name to definition info.

func LoadDefinitionFile

func LoadDefinitionFile(r io.Reader) (*Definitions, error)

LoadDefinitionFile loads the definitions from a definitions.yaml file.

func (*Definitions) DefinedSignal

func (m *Definitions) DefinedSignal(signal []*SignalInfo) []*SignalInfo

DefinedSignal returns a new slice of signals with the definition information applied. excluding signals that are not in the definition file.

type EventTagInfo added in v0.7.3

type EventTagInfo struct {
	// Name is the name of the event tag.
	Name string `json:"name" yaml:"name"`
	// Desc is the description of the event tag.
	Desc string `json:"description" yaml:"description"`
	// JSONName is the name of the event tag in the JSON format this is the same as the Name but defined here for parity with the signals.
	JSONName string `json:"jsonName" yaml:"jsonName"`
	// GOName is the name of the event tag in the Go format this is the same as the Name but defined here for parity with the signals.
	GOName string `json:"goName" yaml:"goName"`
}

EventTagInfo contains the information for an event tag.

func GetDefaultEventTags added in v0.7.3

func GetDefaultEventTags() ([]*EventTagInfo, error)

GetDefaultEventTags reads the default event tags file and returns the event tags.

func LoadEventTags added in v0.7.3

func LoadEventTags(r io.Reader) ([]*EventTagInfo, error)

type InvalidError added in v0.2.15

type InvalidError struct {
	Property string
	Name     string
	Reason   string
}

InvalidError is an error for invalid definitions.

func (InvalidError) Error added in v0.2.15

func (e InvalidError) Error() string

type OriginalNameInfo added in v0.3.0

type OriginalNameInfo struct {
	Name    string
	Signals []*SignalInfo
}

OriginalNameInfo contains the original name and signals that are derived from it.

type SignalDefinitions added in v0.7.3

type SignalDefinitions struct {
	Signals       []*SignalInfo
	OriginalNames []*OriginalNameInfo
}

func GetDefinedSignals

func GetDefinedSignals(specReader, definitionReader io.Reader) (SignalDefinitions, error)

GetDefinedSignals reads the signals and definitions files and merges them.

type SignalInfo

type SignalInfo struct {
	// From spec CSV
	Name       string
	Type       string
	DataType   string
	Unit       string
	Min        string
	Max        string
	Desc       string
	Deprecated bool

	// Derived
	IsArray     bool
	GOName      string
	JSONName    string
	BaseGoType  string
	BaseGQLType string
	Conversions []*ConversionInfo
	Privileges  []string
}

SignalInfo holds information about a signal that is accessed during template execution. This information comes from the combinations of the spec and definition files. The Types defined by this stuct are used to determine what strings to use in the template file.

func GetDefaultSignals added in v0.7.3

func GetDefaultSignals() ([]*SignalInfo, error)

GetDefaultSignals reads the default signals and definitions files and merges them.

func LoadSignalsCSV

func LoadSignalsCSV(r io.Reader) ([]*SignalInfo, error)

LoadSignalsCSV loads the signals from a vss CSV file.

func NewSignalInfo

func NewSignalInfo(record []string) *SignalInfo

NewSignalInfo creates a new SignalInfo from a record from the CSV file.

func (*SignalInfo) GOType

func (s *SignalInfo) GOType() string

GOType returns the golang type of the signal.

func (*SignalInfo) GQLType added in v0.2.1

func (s *SignalInfo) GQLType() string

GQLType returns the graphql type of the signal.

func (*SignalInfo) MergeWithDefinition

func (s *SignalInfo) MergeWithDefinition(definition *DefinitionInfo)

MergeWithDefinition merges the signal with the definition information.

type TemplateData

type TemplateData struct {
	SignalDefinitions
	ModelName string
	EventTags []*EventTagInfo
}

TemplateData contains the data to be used during template execution.

Jump to

Keyboard shortcuts

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