Overview
ethdebug/format/type defines how to write data types as JSON.
Debuggers critically rely on having representations of the data types used by a piece of code. This information is used to highlight code display, offer links to where user-defined types are defined, and to render runtime values correctly.
For a quick introduction to type representations, please see these example JSON values:
A valid type representation
{
"kind": "uint",
"bits": 256
}
An invalid type representation
"uh, some kind of number"
See additional examples below for a sample of valid type representations according to this schema.
This format defines schemas for representing the data types allowable in a supporting high-level language.
JSON values that adhere to this schema may (for example) represent a particular
uint
type (like uint256
), a struct
type with a particular set of member
fields, a particular mapping
type from a certain key type to a certain value
type, and so on.
Reading this schema
The ethdebug/format/type schema is a root schema that conditionally defers to one or more other related schemas in the ethdebug/format/type/* namespace.
These schemas (like all schemas in this format) are specified as JSON Schema, draft 2020-12.
Please refer to one or more of the following resources in this section:
-
Key concepts introduces how types are represented in this schema.
-
Schema presents the root ethdebug/format/type schema, which aggregates links to all relevant subschemas.
-
The categories Elementary types and Complex types comprise individual subschemas for all known kinds of types.
-
The Base schema defines the mimimum overall structure of ethdebug/format/type objects for purposes of schema extension.
Example valid representations
Here are some example ethdebug/format/type type representations.
- address
- mapping
- struct
{
"kind": "address"
}
{
"kind": "mapping",
"contains": {
"key": {
"type": {
"kind": "address"
}
},
"value": {
"type": {
"kind": "uint",
"bits": 256
}
}
}
}
{
"kind": "struct",
"contains": [
{
"name": "x",
"type": {
"kind": "uint",
"bits": 128
}
},
{
"name": "y",
"type": {
"kind": "uint",
"bits": 128
}
}
]
}