Skip to content

Commit

Permalink
Add pointer templates to specification pages
Browse files Browse the repository at this point in the history
  • Loading branch information
gnidan committed Aug 29, 2024
1 parent 78c3833 commit 6be4d2e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
33 changes: 33 additions & 0 deletions packages/web/spec/pointer/templates.mdx
Original file line number Diff line number Diff line change
@@ -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.

<SchemaViewer
schema={{
id: "schema:ethdebug/format/pointer/templates"
}}
pointer="#/$defs/Template"
/>

## Organizing templates {#templates-schema}

The **ethdebug/format/pointer/templates** schema specifies how to represent
a collection of pointer templates by name.

<SchemaViewer
schema={{ id: "schema:ethdebug/format/pointer/templates" }}
/>
9 changes: 9 additions & 0 deletions packages/web/src/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 11 additions & 1 deletion schemas/pointer/templates.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -33,6 +37,12 @@ $defs:

additionalProperties: false

examples:
- expect: ["slot"]
for:
location: storage
slot: "slot"

examples:
- "solidity-string-storage":
expect:
Expand Down

0 comments on commit 6be4d2e

Please sign in to comment.