openview

package
v0.2.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 (format/README.md, section 6; R05 spec; R93 spec). 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 (R72 spec). 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 (R45 spec). The open view of an instance of a template is the open view of a task: Task of what template.Instance gives (format/README.md, section 23; R32). TaskDigest gives the digest of the open view of a task or of an instance: sha256: of its canonical text, by internal/canonical (R34). 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 (R43).

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lesson

func Lesson(part formatv0.Lesson) (open.Lesson, error)

Lesson gives the open view of a lesson, as Manifest does of a manifest.

func Manifest

func Manifest(part formatv0.Manifest) (open.Manifest, error)

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

func ManifestView(part formatv0.Manifest) (any, error)

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

func Task(part formatv0.Task) (open.Task, error)

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

func TaskDigest(part formatv0.Task) (formatv0.Digest, error)

TaskDigest gives the digest of the open view of a task: sha256: and the SHA-256 of its canonical text (format/README.md, section 25; R93 spec). 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 (contracts/README.md, section 11).

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

func TaskView(part formatv0.Task) (view any, digest formatv0.Digest, err error)

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 (R43). 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>

func Traps

func Traps(part formatv0.Traps) (open.Traps, error)

Traps gives the open view of a trap catalog, as Manifest does of a manifest: every field of the catalog is closed, so its open view is an empty object.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL