diff --git a/packages/web/spec/pointer/templates.mdx b/packages/web/spec/pointer/templates.mdx new file mode 100644 index 00000000..26d4931c --- /dev/null +++ b/packages/web/spec/pointer/templates.mdx @@ -0,0 +1,33 @@ +--- +sidebar_position: 7 +--- + +import SchemaViewer from "@site/src/components/SchemaViewer"; + +# Pointer templates + +This format provides the concept of **pointer templates** to allow +deduplicating representations. Pointer templates are defined to specify the +variables they expect in scope and the pointer definition that uses those +variables. + +## Template schema {#template-schema} + +The following schema defines how to represent a single pointer template. +See [below](#templates-schema) for how to organize pointer templates by name. + + + +## Organizing templates {#templates-schema} + +The **ethdebug/format/pointer/templates** schema specifies how to represent +a collection of pointer templates by name. + + diff --git a/packages/web/src/schemas.ts b/packages/web/src/schemas.ts index aaf7fcf1..6492fd04 100644 --- a/packages/web/src/schemas.ts +++ b/packages/web/src/schemas.ts @@ -116,6 +116,15 @@ export const schemaIndex: SchemaIndex = { href: "/spec/pointer/expression" }, + "schema:ethdebug/format/pointer/templates": { + href: "/spec/pointer/templates" + }, + + "schema:ethdebug/format/pointer/templates#/$defs/Template": { + title: "Pointer template schema", + href: "/spec/pointer/templates#template-schema" + }, + ...Object.entries({ Literal: { title: "Literal values schema", diff --git a/schemas/pointer/templates.schema.yaml b/schemas/pointer/templates.schema.yaml index 1a62a29c..e6bca853 100644 --- a/schemas/pointer/templates.schema.yaml +++ b/schemas/pointer/templates.schema.yaml @@ -15,10 +15,14 @@ additionalProperties: false $defs: Template: - title: Pointer template + title: Pointer template schema type: object properties: expect: + title: Template variables + description: | + An array of variable identifiers used in the definition of the + pointer template. type: array items: $ref: "schema:ethdebug/format/pointer/identifier" @@ -33,6 +37,12 @@ $defs: additionalProperties: false + examples: + - expect: ["slot"] + for: + location: storage + slot: "slot" + examples: - "solidity-string-storage": expect: