Help us shape the future of Go! Take the 2026 Go Developer Survey

semantics

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package semantics defines implementation-specific serialization profiles.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContractCertainty

type ContractCertainty string
const (
	CertaintyExact   ContractCertainty = "exact"
	CertaintyPartial ContractCertainty = "partial"
	CertaintyOpaque  ContractCertainty = "opaque"
)

type CustomMethods

type CustomMethods struct {
	MarshalJSON   bool `json:"marshal_json"`
	UnmarshalJSON bool `json:"unmarshal_json"`
	MarshalText   bool `json:"marshal_text"`
	UnmarshalText bool `json:"unmarshal_text"`
}

type Finding

type Finding struct {
	ID        string
	Message   string
	FieldPath string
}

type GenericProfile

type GenericProfile string

func (GenericProfile) Available

func (p GenericProfile) Available() bool

func (GenericProfile) Compare

func (GenericProfile) ID

func (p GenericProfile) ID() string

func (GenericProfile) Namespace

func (p GenericProfile) Namespace() string

func (GenericProfile) ResolveStruct

func (GenericProfile) ValidateField

func (p GenericProfile) ValidateField(*contract.FieldContract) []Finding

func (GenericProfile) Version

func (p GenericProfile) Version() string

type Profile

type Profile interface {
	ID() string
	Namespace() string
	Version() string
	Available() bool
	ResolveStruct(*contract.StructContract) (*ResolvedSurface, error)
	ValidateField(*contract.FieldContract) []Finding
	Compare(Profile) []SemanticDifference
}

func NewJSONV1

func NewJSONV1(toolchain string) Profile

func NewJSONV2

func NewJSONV2(toolchain string, available bool) Profile

type Registry

type Registry struct {
	Toolchain       string
	JSONV2Installed bool
	JSONV2Active    bool
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() Registry

func (Registry) Lookup

func (r Registry) Lookup(id string) (Profile, bool)

func (Registry) Select

func (r Registry) Select(value string) ([]Profile, error)

type ResolvedField

type ResolvedField struct {
	GoName     string
	Name       string
	GoType     types.Type
	TypeString string
	Path       []string
	Required   bool
	OmitEmpty  bool
	OmitZero   bool
	Nullable   bool
	Embedded   bool
	Ignored    bool
	Deprecated *contract.Deprecation
	Schema     map[string]string
}

type ResolvedSurface

type ResolvedSurface struct {
	Profile             string
	Namespace           string
	Certainty           ContractCertainty
	Reason              string
	Fields              []ResolvedField
	CaseSensitiveDecode bool
	Available           bool
	Toolchain           string
	CustomMethods       CustomMethods
}

type SemanticDifference

type SemanticDifference struct {
	Kind      string
	FieldPath string
	Before    any
	After     any
	Message   string
}

Jump to

Keyboard shortcuts

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