Documentation
¶
Overview ¶
Package yamlcodec reads and writes Flow-I files as YAML.
Decoding walks the parsed syntax tree instead of reflecting into structs, so that it can report every problem with its line and column, keep keys exactly as written, and preserve the order of user-ordered maps. Encoding produces the canonical form that `flowi fmt` writes.
Index ¶
- func HasComments(data []byte) bool
- type Codec
- func (c *Codec) DecodeBlueprint(file, path string, data []byte) (model.Blueprint, diag.List)
- func (c *Codec) DecodeEnvironment(file string, data []byte) (model.Environment, diag.List)
- func (c *Codec) DecodeFlow(file, path string, data []byte) (model.Flow, diag.List)
- func (c *Codec) DecodeFolder(file, dir string, data []byte) (model.Folder, diag.List)
- func (c *Codec) DecodeLayout(file string, data []byte) (model.Layout, diag.List)
- func (c *Codec) DecodeManifest(file string, data []byte) (model.Manifest, diag.List)
- func (c *Codec) DecodeRequest(file, path string, data []byte) (model.Request, diag.List)
- func (c *Codec) DecodeSettingsFile(file string, data []byte) (map[string]any, diag.List)
- func (c *Codec) DecodeWorkspace(file string, data []byte) (model.Workspace, diag.List)
- func (c *Codec) EncodeBlueprint(bp model.Blueprint) ([]byte, error)
- func (c *Codec) EncodeEnvironment(env model.Environment) ([]byte, error)
- func (c *Codec) EncodeFlow(f model.Flow) ([]byte, error)
- func (c *Codec) EncodeFolder(f model.Folder) ([]byte, error)
- func (c *Codec) EncodeLayout(l model.Layout) ([]byte, error)
- func (c *Codec) EncodeManifest(man model.Manifest) ([]byte, error)
- func (c *Codec) EncodeRequest(r model.Request) ([]byte, error)
- func (c *Codec) EncodeSettingsFile(s model.Settings) ([]byte, error)
- func (c *Codec) EncodeWorkspace(ws model.Workspace) ([]byte, error)
- func (c *Codec) HasComments(data []byte) bool
- func (c *Codec) Locate(data []byte, yamlPath string) (diag.Position, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasComments ¶
HasComments reports whether data contains YAML comments, which the canonical form does not keep.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec decodes and encodes Flow-I files.
func (*Codec) DecodeBlueprint ¶
DecodeBlueprint reads a *.blueprint.yaml file: a flow body plus declared parameters, where a request or subflow reference may be {param: name}. path is relative to blueprints/ without the suffix.
func (*Codec) DecodeEnvironment ¶
DecodeEnvironment reads an environments/*.yaml file. Each variable is a scalar value or {secret: true}; secret values never live in the file.
func (*Codec) DecodeFlow ¶
DecodeFlow reads a *.flow.yaml file. path is relative to flows/ without the suffix.
func (*Codec) DecodeFolder ¶
DecodeFolder reads a _folder.yaml. dir is the folder's path relative to the collection root, e.g. "requests/auth".
func (*Codec) DecodeLayout ¶
DecodeLayout reads a *.layout.yaml file. Problems are diagnostics; what could be read is returned (a layout is only a convenience).
func (*Codec) DecodeManifest ¶
DecodeManifest reads a collection's flowi.yaml.
func (*Codec) DecodeRequest ¶
DecodeRequest reads a *.req.yaml file. path is the request's path relative to requests/ without the suffix, e.g. "auth/login".
func (*Codec) DecodeSettingsFile ¶
DecodeSettingsFile reads the user settings file into flattened, not yet validated values.
func (*Codec) DecodeWorkspace ¶
DecodeWorkspace reads workspace.yaml.
func (*Codec) EncodeBlueprint ¶
EncodeBlueprint writes a blueprint in canonical form.
func (*Codec) EncodeEnvironment ¶
func (c *Codec) EncodeEnvironment(env model.Environment) ([]byte, error)
EncodeEnvironment writes an environment in canonical form.
func (*Codec) EncodeFlow ¶
EncodeFlow writes a flow in canonical form.
func (*Codec) EncodeFolder ¶
EncodeFolder writes a _folder.yaml in canonical form.
func (*Codec) EncodeLayout ¶
EncodeLayout writes a layout in canonical form: positions sorted by node id.
func (*Codec) EncodeManifest ¶
EncodeManifest writes flowi.yaml in canonical form.
func (*Codec) EncodeRequest ¶
EncodeRequest writes a request in canonical form, versions sorted by version order (invalid labels last, in text order).
func (*Codec) EncodeSettingsFile ¶
EncodeSettingsFile writes validated user settings in schema order.
func (*Codec) EncodeWorkspace ¶
EncodeWorkspace writes workspace.yaml in canonical form.
func (*Codec) HasComments ¶
HasComments is HasComments as a method, so the codec satisfies interfaces that need it.