On this page
- Subjects
- Pack configuration metadata
- Generation metadata context
- Structural metadata contexts
- Core rule
- Context composition rule
- Proposed template-normalization rules
- Absence
- Named maps become arrays
- Raw JSON pointers are not the template API
- Shared contexts
- TypeContext
- ValuePortContext
- First-class metadata consistency
- Audit standard
- Collector metadata rule
Context overview
This directory documents the renderer-facing context that pack templates can request.
Use this folder in this order:
| Need | File |
|---|---|
Find a concrete template path such as schema.fields[].name.snake | catalog.md |
Understand derived helper facts such as is, has_*, *_json, path segments and generated representations | derived.md |
Understand a selectable semantic subject such as schema or operation | the subject files below |
Understand reusable nested contracts such as NameContext | shared/ |
Context discovery through dryv context list|show is documented in derived.md.
Subjects
| Subject | File |
|---|---|
property.primitive | property.primitive.md |
property.enum | property.enum.md |
property.composite | property.composite.md |
property.literal | property.literal.md |
property.union | property.union.md |
property.record | property.record.md |
property.tuple | property.tuple.md |
property.generic | property.generic.md |
property.temporal | property.temporal.md |
schema | schema.md |
expression | expression.md |
policy | policy.md |
failure | failure.md |
event | event.md |
operation | operation.md |
view | view.md |
view.part | view.part.md |
workflow | workflow.md |
surface | surface.md |
Pack configuration metadata
| Context | File | Availability |
|---|---|---|
pack | metadata/pack.md | Bounded values declared by the active pack's typed inputs contract. |
Generation metadata context
file is separate from semantic/structural metadata.
| Context | File | Availability |
|---|---|---|
file | metadata/file.md | One 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.
| Context | File | Availability |
|---|---|---|
application | metadata/application.md | Global bounded metadata for every invocation. |
group | metadata/group.md | Collector metadata for collects.group; also owner metadata alongside collects.feature. |
feature | metadata/feature.md | Collector metadata for collects.feature. |
They deliberately omit declaration-membership arrays such as all schemas, operations, features, groups, or views.
Core rule
generation metadata + global metadata + selected subject + scope
→ renderer context
Every rendered concrete file may request:
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:
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:
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:
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:
#/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:
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
| Path | Type | Meaning |
|---|---|---|
index | integer | Stable order/binding index. |
name | NameContext | Semantic parameter/result name. |
value | SemanticValueContext | Full 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:
- Can a real pack generate useful code without parsing raw refs or map keys?
- Is the context renderer-neutral?
- Are relationships resolved but bounded?
- Are target-language details kept out of semantic context?
- Does the example prove the context is actually usable?
- What Runtime IR changes does this imply?
- 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:
application: ApplicationContext
group: GroupContext
schemas: SchemaContext[]
For collects.feature:
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.