Documentation
¶
Overview ¶
Package schemedecl implements the CLC-1.19 scheme declaration pilot: the `quantity` domain and the declaration validation it depends on.
The pilot deliberately stays outside the core comparison code. A declaration is applied as a *normalization layer*: each declared `quantity` value is checked against the declaration's fixed unit and rewritten as its normalized number before the ordinary CLC relations run. That keeps `Entails` and `Contains` untouched while making the new domain testable end to end.
Index ¶
- func DigestOf(raw []byte) (string, error)
- type Capability
- type Declaration
- func (d *Declaration) Authorize(capability string, grants []semantics.Grant, op semantics.Operation) semantics.Decision
- func (d *Declaration) Contains(capability string, parent, child semantics.Grant) (bool, string)
- func (d *Declaration) DomainMap(capability string) semantics.DomainMap
- func (d *Declaration) Validate() error
- type Param
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Capability ¶
Capability is one capability's parameter declarations.
type Declaration ¶
type Declaration struct {
Version string `json:"@version"`
Scheme string `json:"scheme"`
DeclarationID string `json:"declaration_id"`
CLCRevision string `json:"clc_revision"`
Digest string `json:"digest"`
Capabilities map[string]Capability `json:"capabilities"`
ConstraintTypes []string `json:"constraint_types,omitempty"`
}
Declaration is a CLC-SCHEME-v1 artifact.
func (*Declaration) Authorize ¶
func (d *Declaration) Authorize(capability string, grants []semantics.Grant, op semantics.Operation) semantics.Decision
Authorize applies the declaration's quantity normalization, then runs the ordinary multi-grant authorization.
func (*Declaration) Contains ¶
Contains applies the same normalization and then the ordinary relation. A unit mismatch is a containment failure (`params_not_narrower`), per §13.4.3.
func (*Declaration) DomainMap ¶
func (d *Declaration) DomainMap(capability string) semantics.DomainMap
DomainMap exposes the declaration's per-parameter domain spec for one capability. Callers outside this package use it to drive the CLC-1.19 `*WithDomains` relations; an unknown capability yields nil, which restores the shape-inferred default.
func (*Declaration) Validate ¶
func (d *Declaration) Validate() error
Validate checks the closed shape, the known domains, the quantity unit rule and the digest.