Documentation
¶
Index ¶
- Constants
- func Apply(properties gvas.Properties, document *Document, options ApplyOptions) (*Output, []Diagnostic, error)
- func IsInvalidDocument(err error) bool
- type ApplyOptions
- type Diagnostic
- type DiagnosticKind
- type Document
- type Field
- type InvalidDocumentError
- type Kind
- type Output
- type Preset
- type ResolutionError
- type Severity
- type Shape
Constants ¶
const (
FormatVersion = 1
)
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(properties gvas.Properties, document *Document, options ApplyOptions) (*Output, []Diagnostic, error)
Apply resolves document against one decoded save and returns ordered output.
func IsInvalidDocument ¶
IsInvalidDocument reports whether err is a projection-document validation error rather than a save decoding or matching error.
Types ¶
type ApplyOptions ¶
ApplyOptions controls projection resolution.
type Diagnostic ¶
type Diagnostic struct {
Severity Severity `json:"severity"`
Kind DiagnosticKind `json:"kind"`
OutputPath string `json:"outputPath,omitempty"`
SourcePath string `json:"sourcePath,omitempty"`
Message string `json:"message"`
Candidates []string `json:"candidates,omitempty"`
Score int `json:"score,omitempty"`
}
Diagnostic is one machine-readable matching decision or problem.
type DiagnosticKind ¶
type DiagnosticKind string
DiagnosticKind names what a Diagnostic reports. The set is closed, so a consumer can switch on it exhaustively. It is spelled DiagnosticKind rather than Kind because Kind already names the shape kinds.
const ( // DiagnosticMissing reports a requested field with no match. DiagnosticMissing DiagnosticKind = "missing" // DiagnosticAmbiguous reports more than one equally good match. DiagnosticAmbiguous DiagnosticKind = "ambiguous" // DiagnosticIncompatible reports a match whose kind differs from the shape. DiagnosticIncompatible DiagnosticKind = "incompatible" // DiagnosticSelected records a match that was taken. DiagnosticSelected DiagnosticKind = "selected" // DiagnosticRejected records a candidate that lost to the selected one. DiagnosticRejected DiagnosticKind = "rejected" // DiagnosticRoot records which candidate became the projection root. DiagnosticRoot DiagnosticKind = "root" )
type Document ¶
type Document struct {
Schema string
ProjectionVersion int
Name string
GameVersion string
SaveType string
Shape *Shape
}
Document is one validated projection document.
func ParseReader ¶
ParseReader reads and parses a projection document without reading more than the document-size limit into memory.
func ResolvePreset ¶
ResolvePreset finds a bundled projection by its exact name.
type InvalidDocumentError ¶
InvalidDocumentError reports a projection contract violation.
func (*InvalidDocumentError) Error ¶
func (err *InvalidDocumentError) Error() string
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output is the third of the package's three parallel trees, all keyed by the same Kind: documentNode is what the caller asked for, sourceNode is what the save contains, and Output is the result of matching one against the other.
Its custom marshaler preserves projection object key order.
func (*Output) MarshalJSON ¶
MarshalJSON preserves the ordering in the projection shape.
type Preset ¶
type Preset struct {
Name string `json:"name"`
GameVersion string `json:"gameVersion"`
SaveType string `json:"saveType"`
}
Preset describes one bundled projection. GameVersion records the Palworld build the document was verified against; it is provenance reported to the caller, not part of the preset's identity.
type ResolutionError ¶
ResolutionError reports that no unique, complete projection could be resolved.
func (*ResolutionError) Error ¶
func (err *ResolutionError) Error() string