Documentation
¶
Overview ¶
Package citation reads Citation File Format metadata without external dependencies.
Index ¶
- Variables
- type Actor
- type Diagnostic
- type Document
- func (d *Document) Authors() []Actor
- func (d *Document) CFFVersion() string
- func (d *Document) Contact() []Actor
- func (d *Document) Fields() []Field
- func (d *Document) Get(name string) Value
- func (d *Document) PreferredCitation() (Reference, bool)
- func (d *Document) References() []Reference
- func (d *Document) Title() string
- func (d *Document) Validate() []Diagnostic
- func (d *Document) Version() Value
- type Error
- type Field
- type Kind
- type ParseOptions
- type Position
- type Reference
- type Value
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Actor ¶
type Actor struct {
// contains filtered or unexported fields
}
func (Actor) FamilyNames ¶
func (Actor) GivenNames ¶
type Diagnostic ¶
type Diagnostic struct {
Code string `json:"code"`
Path string `json:"path,omitempty"`
Message string `json:"message"`
Position
}
Diagnostic describes a problem without requiring consumers to parse its message.
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document owns the parsed metadata, including unknown and invalid fields.
func ParseWithOptions ¶
func ParseWithOptions(data []byte, opts ParseOptions) (*Document, error)
func (*Document) CFFVersion ¶
func (*Document) PreferredCitation ¶
func (*Document) References ¶
func (*Document) Validate ¶
func (d *Document) Validate() []Diagnostic
Validate checks the declared schema without modifying metadata. Unsupported versions receive a diagnostic rather than current-version rules.
type Error ¶
type Error struct {
Diagnostic
Cause error
}
Error wraps a parse failure and its category for errors.Is and errors.As.
type Kind ¶
type Kind uint8
Kind distinguishes YAML scalar types and collections. A zero Value is missing.
type ParseOptions ¶
type ParseOptions struct {
MaxBytes int64
MaxDepth int
MaxNodes int
MaxScalarBytes int
MaxNumberBytes int
MaxDiagnostics int
}
ParseOptions bounds work for untrusted inputs. Zero fields select defaults.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
read
command
Command read demonstrates parsing a file or a Git blob supplied on standard input.
|
Command read demonstrates parsing a file or a Git blob supplied on standard input. |
|
internal
|
|
|
generate
command
Command generate compiles the pinned CFF schema into Go validation rules.
|
Command generate compiles the pinned CFF schema into Go validation rules. |
Click to show internal directories.
Click to hide internal directories.