odcs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package odcs preserves admitted ODCS documents and derives restricted executable shapes.

Index

Constants

View Source
const (
	ProjectionCompilerID = "braidplane/odcs-structure/v1"
	MaxProjectionInputs  = 64
)
View Source
const CompilerID = "braidplane/odcs-flat-port/v2"
View Source
const DecimalCompilerID = "braidplane/odcs-flat-port-decimal/v1"
View Source
const MaxCoverageEntries = 16384
View Source
const (
	MaxDocumentBytes = 1 << 20
)
View Source
const MaxProjectionBytes = 8 << 20

MaxProjectionBytes also bounds aggregate pins and ODCS Proof inputs/claims.

View Source
const PinnedVersion = "v3.2.0"

Variables

View Source
var ErrDocument = xerror.New(xerror.KindInvalidInput, "ODCS_DOCUMENT_INVALID", "invalid ODCS catalog document")

Functions

func CheckRequestJSON

func CheckRequestJSON(raw []byte) error

CheckRequestJSON allows the request envelope around a document's 64-level bound.

func IsFlatCompiler

func IsFlatCompiler(id string) bool

IsFlatCompiler accepts retained shapes without recompiling their documents.

func ParseArtifact

func ParseArtifact(raw []byte, format string) (json.RawMessage, error)

ParseArtifact validates JSON or converts a restricted YAML document to canonical JSON. It only parses submitted bytes; admission remains the caller's responsibility.

func Record

func Record(raw json.RawMessage, expectedID string) (*model.ODCSRevision, error)

Record validates admission before deriving a digest; no declaration is removed.

Types

type ConversionResult

type ConversionResult struct {
	CompilerID       string                                  `json:"compiler_id"`
	Coverage         []internalmodel.ODCSDeclarationCoverage `json:"coverage,omitempty"`
	CoverageComplete bool                                    `json:"coverage_complete"`
	Properties       []PropertyIdentity                      `json:"properties,omitempty"`
	ODCSVersion      string                                  `json:"odcs_version"`
	Digest           string                                  `json:"digest,omitempty"`
	SchemaObjectID   string                                  `json:"schema_object_id"`
	DocumentValid    bool                                    `json:"document_valid"`
	Shape            *payload.Contract                       `json:"shape,omitempty"`
	Diagnostics      []Diagnostic                            `json:"diagnostics,omitempty"`
	// contains filtered or unexported fields
}

func Convert

func Convert(raw json.RawMessage, objectID string) (*ConversionResult, error)

Convert validates the entire document and converts exactly one stable object ID. Unsupported selected structure returns diagnostics without a partial shape. Preserved metadata and unevaluated checks are reported separately as coverage.

type Diagnostic

type Diagnostic struct {
	Code    string `json:"code"`
	Path    string `json:"path"`
	Message string `json:"message"`
}

Diagnostic never includes submitted values or arbitrary property names.

type PhysicalTypeMapping

type PhysicalTypeMapping struct {
	LogicalType            string
	Kind                   payload.StructuralKind
	Bits, Precision, Scale int
}

type ProjectedInput

type ProjectedInput struct {
	Contract, Revision, ObjectID, Digest, ResolvedDigest string
	ObjectName                                           string
	Mapping                                              ProjectionMapping
	Structure                                            *payload.Structure
	Defaults                                             []ProjectionDefault
	Resolutions                                          []ProjectionResolution
	Declarations                                         []ProjectionDeclaration
	Coverage                                             []internalmodel.ODCSDeclarationCoverage
}

type ProjectedKey

type ProjectedKey struct {
	Path payload.StructuralPath
	IDs  []string
}

type ProjectedKeyPair

type ProjectedKeyPair struct{ From, To ProjectedKey }

type ProjectedRelationship

type ProjectedRelationship struct {
	Input, Target int
	Path          string
	Pairs         []ProjectedKeyPair
}

type ProjectionDeclaration

type ProjectionDeclaration struct {
	Path, LogicalType, PhysicalType string
	Options                         map[string]any
}

type ProjectionDefault

type ProjectionDefault struct {
	Path, Source string
	Value        any
}

type ProjectionDiagnostic

type ProjectionDiagnostic struct {
	Input int
	Phase string
	Diagnostic
}

type ProjectionInput

type ProjectionInput struct {
	Contract, Revision, ObjectID, Digest string
	Document                             json.RawMessage
	Mapping                              ProjectionMapping
	Variables                            map[string]ResolutionValue
}

ProjectionInput must already be authorized in one project by the caller. No resolver, catalog, provider or credentials capability enters this compiler.

type ProjectionMapping

type ProjectionMapping struct {
	ID             string
	Representation model.ContractRepresentation
	RootShape      model.ContractRootShape
	Types          map[payload.StructuralKind]bool
	Physical       map[string]PhysicalTypeMapping
}

ProjectionMapping is a connector-owned capability snapshot, not an inferred provider conversion. Its identity and contents participate in the plan digest.

type ProjectionPlan

type ProjectionPlan struct {
	CompilerID    string
	Inputs        []ProjectedInput
	Relationships []ProjectedRelationship
}

type ProjectionRequest

type ProjectionRequest struct {
	Inputs        []ProjectionInput
	Relationships []RelationshipSelection
}

type ProjectionResolution

type ProjectionResolution struct {
	Path, Token, Value, Revision string
	Default                      bool
}

type ProjectionResult

type ProjectionResult struct {
	Plan        *ProjectionPlan
	Digest      string
	Coverage    [][]internalmodel.ODCSDeclarationCoverage
	Diagnostics []ProjectionDiagnostic
}

func CompileProjection

func CompileProjection(request ProjectionRequest) (*ProjectionResult, error)

CompileProjection is hermetic. Executable admission binds selected structures to exact ports in versioned immutable contract plans. Any selected failure returns coverage/diagnostics but no partial plan/digest.

type PropertyIdentity

type PropertyIdentity struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name"`
}

type RelationshipSelection

type RelationshipSelection struct {
	Input, Target int
	Path          string
}

RelationshipSelection explicitly maps one declaration to an input containing an exact, caller-authorized project-owned revision. URLs never select inputs.

type ResolutionValue

type ResolutionValue struct {
	Value    string
	Revision string
}

ResolutionValue is explicitly supplied non-secret string data. Revision names its authoring snapshot; this compiler never consults environment or secrets.

Jump to

Keyboard shortcuts

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