On this page

Context overview

This directory documents the renderer-facing context that pack templates can request.

Use this folder in this order:

NeedFile
Find a concrete template path such as schema.fields[].name.snakecatalog.md
Understand derived helper facts such as is, has_*, *_json, path segments and generated representationsderived.md
Understand a selectable semantic subject such as schema or operationthe subject files below
Understand reusable nested contracts such as NameContextshared/

Context discovery through dryv context list|show is documented in derived.md.

Subjects

SubjectFile
property.primitiveproperty.primitive.md
property.enumproperty.enum.md
property.compositeproperty.composite.md
property.literalproperty.literal.md
property.unionproperty.union.md
property.recordproperty.record.md
property.tupleproperty.tuple.md
property.genericproperty.generic.md
property.temporalproperty.temporal.md
schemaschema.md
expressionexpression.md
policypolicy.md
failurefailure.md
eventevent.md
operationoperation.md
viewview.md
view.partview.part.md
workflowworkflow.md
surfacesurface.md

Pack configuration metadata

ContextFileAvailability
packmetadata/pack.mdBounded values declared by the active pack's typed inputs contract.

Generation metadata context

file is separate from semantic/structural metadata.

ContextFileAvailability
filemetadata/file.mdOne concrete rendered PlannedFileArtifact; carries planned symbols, paths, generated dependencies, exports, and renderer-useful artifact metadata.

A symbol-bearing template should use file.symbol or file.symbols.<key> for the exported declaration name. Semantic names remain semantic identity and must not be recomposed to guess the generated symbol.

Structural metadata contexts

These are not selectable subjects.

ContextFileAvailability
applicationmetadata/application.mdGlobal bounded metadata for every invocation.
groupmetadata/group.mdCollector metadata for collects.group; also owner metadata alongside collects.feature.
featuremetadata/feature.mdCollector metadata for collects.feature.

They deliberately omit declaration-membership arrays such as all schemas, operations, features, groups, or views.

Core rule

text
generation metadata + global metadata + selected subject + scope
→ renderer context

Every rendered concrete file may request:

text
file: FileContext
application: ApplicationContext

file is defined in metadata/file.md and is derived from artifact planning planning, not Runtime IR.

Every invocation may additionally request:

The application root is deliberately bounded metadata, not an aggregate semantic graph.

Filters only change membership. They never change the item context contract.

Examples:

text
schema + each
→ schema: SchemaContext

schema + all
→ schemas: SchemaContext[]

property.enum + each
→ property.enum: EnumPropertyContext

property.enum + all
→ properties.enums: EnumPropertyContext[]

view.part + each
→ view.part: ViewPartContext

view.part + all
→ views.parts: ViewPartContext[]

Context composition rule

Each context contract has exactly one authoritative definition.

A subject file documents only:

  • the context fields unique to that subject;
  • relationships to shared contexts;
  • relationships to another subject's full context;
  • any local constraints on how that borrowed context is used.

Do not copy an existing context tree into another subject file.

Use references such as:

text
NameContext
    → shared/name.md

SemanticLinkContext
    → shared/semantic-link.md

SemanticValueContext
    → shared/semantic-value.md

ExplanationContext
    → shared/explanation.md

LifecycleContext
    → shared/lifecycle.md

SemanticPathContext
    → shared/semantic-path.md

schema.fields[].value.property.primitive
    → full PrimitivePropertyContext from property.primitive.md

schema.fields[].value.property.enum
    → full EnumPropertyContext from property.enum.md

schema.fields[].value.schema
    → full SchemaContext from schema.md

"Full context" means the exact same typed contract. It does not mean Dryv eagerly materializes the entire subtree. Template analysis and context resolution still request/materialize only paths actually used by the template.

This rule is important because one semantic concept must not slowly acquire several almost-identical template contracts.

Proposed template-normalization rules

Absence

When a requested semantic value is absent:

  • optional scalar/object → null;
  • collection → [].

Template analysis and context resolution still control whether a path is materialized at all.

Named maps become arrays

Canonical IR may store dictionaries for efficient lookup, but template context should expose named members as deterministic arrays:

text
IR map key
→ item.name + deterministic array entry

This avoids renderer-specific map-key tricks such as Handlebars @key and makes the same context usable from Jinja, Liquid, Mustache, etc.

Raw JSON pointers are not the template API

Templates should not parse:

text
#/schemas/users.User
#/operations/users.CreateUser

References resolve to bounded semantic links.

Shared contexts

Shared nested contracts live in shared/. They are not selectable roots, but they appear inside many subject and metadata contexts.

Every first-class semantic subject context exposes id: string. id is semantic identity and is deliberately separate from NameContext.

TypeContext

TypeContext remains the renderer-neutral recursive type-expression contract used where Dryv meaning is itself a type expression, for example union members, record keys/values, tuple items, and generic bodies/arguments.

Schema/composite fields do not use an ambiguous generic TypeContext for their primary value. They use SemanticValueContext, because a field specifically distinguishes:

text
property
schema
unknown
dynamic

This preserves the canonical difference between "field uses another schema" and "field uses a reusable property with its complete constraints/meaning."

Target-language spellings never belong in either contract.

ValuePortContext

PathTypeMeaning
indexintegerStable order/binding index.
nameNameContextSemantic parameter/result name.
valueSemanticValueContextFull reusable semantic value carried by the port; see shared/semantic-value.md.

Ports carry an optional canonical name; unnamed ports project as input_0, output_0 (decision 0012).

First-class metadata consistency

The pack contract allows tags on every selectable subject. Therefore every selectable subject context should consistently expose id, name, description, tags, and explanations where meaningful.

Owned semantic items expose at most one canonical feature: SemanticLinkContext|null. Cross-feature usage is represented through normal semantic references, not features[].

Every selectable subject inherits SemanticMetadata (decision 0012).

Audit standard

For every subject file ask:

  1. Can a real pack generate useful code without parsing raw refs or map keys?
  2. Is the context renderer-neutral?
  3. Are relationships resolved but bounded?
  4. Are target-language details kept out of semantic context?
  5. Does the example prove the context is actually usable?
  6. What Runtime IR changes does this imply?
  7. Does any nested unit independently cause artifacts and deserve a subject?

Collector metadata rule

Structural scope metadata never carries full membership trees.

For collects.group:

text
application: ApplicationContext
group: GroupContext
schemas: SchemaContext[]

For collects.feature:

text
application: ApplicationContext
group: GroupContext
feature: FeatureContext
operations: OperationContext[]

A selected item may still contain bounded owner links such as schema.group or schema.feature, but those links do not recursively expand into the metadata roots.

For each and all, Dryv does not invent a singular group or feature root from collection contents. Scope controls those roots explicitly.

Search in