extschema

package
v1.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package extschema holds the schema for each extension's telemetry attributes, and checks a payload against it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

func Export() ([]byte, error)

Export returns the schema as indented JSON with a final newline. The output is the same on every call.

func Has

func Has(extension string) bool

Has reports whether a schema exists for the extension.

func ShortNames

func ShortNames(extension string) []string

ShortNames returns the extension's short attribute names, sorted. It returns nil for an unknown extension.

Types

type Attribute

type Attribute struct {
	Property string // literal, such as ext_configoptimizer_suggestions
	Value    any    // int, string or bool
}

Attribute is an attribute that passed the check.

type Result

type Result struct {
	Status   Status
	Accepted []Attribute // ordered by short name
}

Result is the outcome of Check.

func Check

func Check(extension string, version int, attributes map[string]json.RawMessage) Result

Check returns the attributes that passed the extension's schema, with their property names, and a status. It returns NotSupported for an extension with no schema, and otherwise only Accepted, PartiallyAccepted and Rejected.

type Status

type Status string

Status says what became of an extension's attribute payload.

const (
	NotSupported      Status = "not_supported"
	SetupFailed       Status = "setup_failed"
	NoPayload         Status = "no_payload"
	Accepted          Status = "accepted"
	PartiallyAccepted Status = "partially_accepted"
	Rejected          Status = "rejected"
	ReadFailed        Status = "read_failed"
)

The values a Status takes.

Jump to

Keyboard shortcuts

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