An Open Snippet Registry (OSR) catalogues versioned pieces of source code and data templates for reuse. Each entry contains the material itself and an execution profile describing how it is intended to be used. This gives another team enough context to inspect a particular revision and judge whether it fits its own project.
Scope and reuse
The publisher identifies the language, distinguishes executable code from a data template, and records the relevant environment and prerequisites. Source references explain where those declarations came from, so a consumer can inspect the basis for a compatibility claim. An OFR describes the operation a caller can request. An OSR entry supplies implementation material a developer can examine and reuse.
The catalogue records what the source declares or what inspection established. Installing dependencies, running the code and verifying its behaviour on a target machine belong to the consumer's build and test process. The execution profile makes that boundary explicit through its verification value, not-executed-by-catalogue.
Field reference
Read each table within its named object. A required field must be present whenever that object is supplied. Brackets ([]) denote one array entry. Each object in the tables accepts only its listed fields.
Document
Field
JSON type
Required
Meaning and constraints
osr
string
Yes
Format version of the snippet registry. Use three dot-separated numbers.
id
string
Yes
Catalogue identifier for the registry. Use at least four dot-separated segments. Each starts with a lowercase letter and continues with lowercase letters or digits.
name
string
Yes
Human-readable name of this registry. Must be nonempty.
description
string
Yes
What this collection of implementations is for. Must be nonempty.
snippets
array of objects
Yes
Versioned snippets available for reuse. At least one entry is required.
metadata
object
No
Additional information about this collection.
snippets[]
Field
JSON type
Required
Meaning and constraints
id
string
Yes
Catalogue identifier of this snippet. Use at least four dot-separated segments. Each starts with a lowercase letter and continues with lowercase letters or digits.
name
string
Yes
Human-readable name of the implementation. Must be nonempty.
version
string
Yes
Version of this implementation. Use three dot-separated numbers.
language
string
Yes
Language of the source or template. Must be nonempty.
content
string or object
Yes
Source text, either directly as a string or as an object with a format and body.
execution
object
Yes
Describes the environment and the evidence for the declaration.
compatibility
array of strings
No
Compatibility information supplied by the publisher.
dependencies
array of strings
No
Dependencies named by the publisher.
description
string
No
What the implementation does.
license
string
No
Licence under which the implementation is offered.
tags
array of strings
No
Terms for finding this snippet.
snippets[].content
Field
JSON type
Required
Meaning and constraints
format
string
Yes
Format of the source text.
body
string
Yes
Source text in the declared format.
snippets[].execution
Field
JSON type
Required
Meaning and constraints
typeRef
string
Yes
Identifier of the execution profile type. Use okham.engineering.type.execution.profile.
languageRef
string
Yes
Catalogue identifier for the implementation language. Use at least four dot-separated segments. Each starts with a lowercase letter and continues with lowercase letters or digits.
mode
string
Yes
Whether the content is executable code or a data template. Allowed values are executable, data-template.
runtime
object
Yes
Runtime needed to execute the snippet.
operatingSystems
object
Yes
Operating systems covered by the declaration.
platforms
object
Yes
Target platforms covered by the declaration.
architectures
object
Yes
Processor architectures covered by the declaration.
requirements
array of objects
Yes
Prerequisites for use in the declared environment.
evidence
object
Yes
Source material supporting the environment declaration.
verification
string
Yes
Records the catalogue's verification boundary. Use not-executed-by-catalogue.
For a data template, all four environment declarations must have status not-applicable. For executable code, the runtime status must be declared or not-declared.
Whether targets are declared, unspecified or inapplicable. Allowed values are declared, not-declared, not-applicable.
refs
array of strings
Yes
Catalogue identifiers. A declared status requires at least one. Other statuses require an empty list. Entries must be distinct. Each entry is a qualified catalogue identifier of at least four segments.
snippets[].execution.evidence
Field
JSON type
Required
Meaning and constraints
basis
string
Yes
How the publisher obtained the environment information. Allowed values are source-declaration, source-inspection.
pointers
array of objects
Yes
Locations in the source that support the declaration. At least one entry is required.
note
string
Yes
What the source establishes. Must be nonempty.
snippets[].execution.evidence.pointers[]
Field
JSON type
Required
Meaning and constraints
path
string
Yes
Path to the source file. Must be nonempty.
pointer
string
Yes
Location within that file.
snippets[].execution.requirements[]
Field
JSON type
Required
Meaning and constraints
name
string
Yes
Name of the prerequisite. Must be nonempty.
note
string
Yes
What the consumer must provide. Must be nonempty.
versionConstraint
string
No
Acceptable version or range for this prerequisite. Must be nonempty.
Example: reusing the OKHAM Docs search snippet
The Python snippet calls the local OKHAM Docs search tool. It lists Python 3.10+ and the local launcher in its requirements. Its evidence points to the declaration inspected by the catalogue. To establish that the snippet works on a particular machine, a consumer needs an execution result from that environment.