Documentation
¶
Overview ¶
Package license validates source-data terms. Declarations describe terms; they neither grant access nor certify that derived output may be published.
Index ¶
- Constants
- func ValidateSPDX(value string, profile Profile) error
- func ValidateURL(value string) error
- type Declaration
- func (d Declaration) Legacy() bool
- func (d Declaration) MarshalJSON() ([]byte, error)
- func (d Declaration) MarshalYAML() (any, error)
- func (d Declaration) Normalized() Declaration
- func (d *Declaration) UnmarshalJSON(data []byte) error
- func (d *Declaration) UnmarshalYAML(node *yaml.Node) error
- func (d Declaration) Validate(profile Profile) error
- type Identity
- type Notice
- type Pin
- type Profile
- type Scope
- type SourceRight
Constants ¶
const Format = "ovdb-data-rights/1"
const MaxEvidenceBytes = 256 << 10
Variables ¶
This section is empty.
Functions ¶
func ValidateSPDX ¶
func ValidateURL ¶
ValidateURL accepts HTTPS terms links, including fragments. It never fetches them.
Types ¶
type Declaration ¶
type Declaration struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
SPDX string `json:"spdx,omitempty" yaml:"spdx,omitempty"`
URL string `json:"url,omitempty" yaml:"url,omitempty"`
Text string `json:"text,omitempty" yaml:"text,omitempty"`
// contains filtered or unexported fields
}
Declaration retains the author's legacy scalar representation on marshaling. A nil *Declaration means omitted/inherit. A nonnil zero value is invalid. Use Normalized for resolved evidence, which always has an object shape.
func ParseJSON ¶
func ParseJSON(data []byte, profile Profile) (Declaration, error)
ParseJSON validates a closed declaration, including supplied empty/null fields.
func (Declaration) Legacy ¶
func (d Declaration) Legacy() bool
func (Declaration) MarshalJSON ¶
func (d Declaration) MarshalJSON() ([]byte, error)
func (Declaration) MarshalYAML ¶
func (d Declaration) MarshalYAML() (any, error)
func (Declaration) Normalized ¶
func (d Declaration) Normalized() Declaration
func (*Declaration) UnmarshalJSON ¶
func (d *Declaration) UnmarshalJSON(data []byte) error
func (*Declaration) UnmarshalYAML ¶
func (d *Declaration) UnmarshalYAML(node *yaml.Node) error
func (Declaration) Validate ¶
func (d Declaration) Validate(profile Profile) error
type Identity ¶
type Profile ¶
type Profile uint8
Profile preserves the existing Directory and Publisher SPDX policies.
type SourceRight ¶
type SourceRight struct {
SourceID string `json:"sourceId"`
Source Identity `json:"source"`
Declaration Declaration `json:"declaration"`
DeclarationScope Scope `json:"declarationScope"`
DeclaredAt Identity `json:"declaredAt"`
EvidenceOrigin string `json:"evidenceOrigin"`
Pins []Pin `json:"pins"`
Attribution *Notice `json:"attribution,omitempty"`
FreeSource *Notice `json:"freeSource,omitempty"`
Transformations []string `json:"transformations"`
}
SourceRight is a source-data terms inventory entry, not an output license. This reader foundation emits only unpinned author declarations. Publisher evidence must be verified by publication/preparation before attaching pins.
func Inventory ¶
func Inventory(rights []SourceRight) ([]SourceRight, int, error)
Inventory returns deterministic distinct source identities and rejects stale conflicting evidence. Its encoded size is reserved before releasing data.
func Resolve ¶
func Resolve(source Identity, server, database, recordset *Declaration) (*SourceRight, error)
Resolve validates every supplied override. It chooses one whole declaration; fields of parent and child declarations are never combined.