Documentation
¶
Overview ¶
Package openview builds the open view of a part of a module and of an instance of a template — what the learner's app receives: the part without its closed fields — from the marks x-open in the schemas of the format, and the digest of the open view of a task and of an instance. api, tutor's eval runner and the CLI's open call it.
Manifest, SkillGraph, Traps, Techniques, SolvingSteps, Lesson and Task take a part as the type of formatv0 holds it and give its open view as the type of formatv0/open holds it. The walk of the schemas is internal/schema's: a mark counts only where its subschema applies and passes, and no list of fields is kept here. The open view of an instance of a template is the open view of a task: Task of what template.Instance gives. TaskDigest gives the digest of the open view of a task or of an instance: sha256: of its canonical text, by internal/canonical. TaskView and ManifestView give the open view as the JSON value before any type holds it, TaskView with the digest of its canonical text, for the CLI's open, which writes the value whose text the digest is of.
Index ¶
- func Lesson(part formatv0.Lesson) (open.Lesson, error)
- func Manifest(part formatv0.Manifest) (open.Manifest, error)
- func ManifestView(part formatv0.Manifest) (any, error)
- func SkillGraph(part formatv0.SkillGraph) (open.SkillGraph, error)
- func SolvingSteps(part formatv0.SolvingSteps) (open.SolvingSteps, error)
- func Task(part formatv0.Task) (open.Task, error)
- func TaskDigest(part formatv0.Task) (formatv0.Digest, error)
- func TaskView(part formatv0.Task) (view any, digest formatv0.Digest, err error)
- func Techniques(part formatv0.Techniques) (open.Techniques, error)
- func Traps(part formatv0.Traps) (open.Traps, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Manifest ¶
Manifest gives the open view of a manifest. It fails when the manifest is not valid against its schema, since the open view is the format's of a valid part alone.
func ManifestView ¶ added in v0.2.1
ManifestView gives the open view of a manifest as a JSON value, as TaskView does of a task.
func SkillGraph ¶
func SkillGraph(part formatv0.SkillGraph) (open.SkillGraph, error)
SkillGraph gives the open view of a skill graph, as Manifest does of a manifest.
func SolvingSteps ¶
func SolvingSteps(part formatv0.SolvingSteps) (open.SolvingSteps, error)
SolvingSteps gives the open view of the solving steps, as Manifest does of a manifest.
func Task ¶
Task gives the open view of a task, as Manifest does of a manifest: without its checks, its solution, its traps, its leak phrases and its template, among the other closed fields.
func TaskDigest ¶ added in v0.1.21
TaskDigest gives the digest of the open view of a task: sha256: and the SHA-256 of its canonical text. Of an instance of a template, the task is what template.Instance gives, with its numbers in place, so that the digest is of the open view the learner's app received. tutor's eval runner finds the task of a sample by it, and the CLI's open writes it beside each open view.
The open view is the one TaskView gives, taken as the JSON value that the walk of the schemas gives, before any type holds it, so that a field is in the text exactly when the open view has it. It fails, as Task does, when the task is not valid against its schema.
func TaskView ¶ added in v0.2.1
TaskView gives the open view of a task as a JSON value — map[string]any, []any, string, int64 or bool, as the reader of YAML gives one — and the digest of its canonical text, TaskDigest's. The value is the open view before any type holds it, so that its canonical text is the one the digest is of: the CLI's open writes it, and a reader that digests the text it reads finds the digest beside it. It fails, as Task does, when the task is not valid against its schema.
func Techniques ¶
func Techniques(part formatv0.Techniques) (open.Techniques, error)
Techniques gives the open view of a technique catalog, as Manifest does of a manifest.
Example ¶
view, err := Techniques(formatv0.Techniques{Techniques: map[formatv0.TechniqueID]formatv0.Technique{
"counting-gaps": {Title: "Count the gaps"},
}})
fmt.Println(view.Techniques["counting-gaps"].Title, err)
Output: Count the gaps <nil>
Types ¶
This section is empty.