Source schema
- Explore
- View source
- Playground
Loading ....
- YAML
- JSON
ethdebug/format/materials/source
$schema: "https://json-schema.org/draft/2020-12/schema"
$id: "schema:ethdebug/format/materials/source"
title: ethdebug/format/materials/source
description: |
An object representing one unit of compiler input, the raw text contents and
identifying metadata (such as file path) that were given to the compiler as
part of a compilation.
type: object
properties:
id:
description: |
Source identifier. This field **must** be unique for all sources
within a single compiler invocation (compilation).
$ref: "schema:ethdebug/format/materials/id"
path:
type: string
description: |
Hierarchical file-system-like path to this source. This value may
be an absolute path, a path relative to some root directory, a path
to some resource within a package, etc.
This value does not need to correspond to any file on disk (either
physical or virtual), and might instead refer to a path identifier
for a source that was generated by a compiler or other development tool.
This format makes no specific restrictions on how paths should be
specified (e.g., no restriction on path separators, etc.), other than
that values for this field should match what users observe elsewhere for
the inputs/outputs of this particular compiler invocation.
If no path information is available for a particular source, e.g. if the
source was provided to the compiler via shell standard input, this field
should indicate that somehow (e.g., specifying `"path": "stdin"` or
similar).
This field's value **should** be unique across all sources within the
same compilation.
contents:
description: |
The full contents of the source, possibly re-encoded as UTF-8 to
match parent JSON encoding.
In cases where input source used a different encoding, this object
**must** also specify an `encoding` property to indicate the
encoding originally used. Where relevant, debuggers **must** also
convert these `contents` back to the specified original encoding so
as to match code author expectations.
type: string
encoding:
description: |
Character encoding of original source `contents`. This property
is **required** if this encoding does not match the JSON transmission
encoding (UTF-8), since the value of the `contents` property will
represent the text of the source of this JSON encoding.
This property **must not** appear in objects that do not specify
a `contents` property.
type: string
language:
description: |
The high-level language that the source contents are written in.
type: string
required:
- id
- path
- contents
- language
examples:
- id: 5
path: ./contracts/SimpleStorage.sol
contents: |
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;
contract SimpleStorage {
uint storedData;
function set(uint x) public {
storedData = x;
}
function get() public view returns (uint) {
return storedData;
}
}
language:
Solidity
ethdebug/format/materials/source
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema:ethdebug/format/materials/source",
"title": "ethdebug/format/materials/source",
"description": "An object representing one unit of compiler input, the raw text contents and\nidentifying metadata (such as file path) that were given to the compiler as\npart of a compilation.\n",
"type": "object",
"properties": {
"id": {
"description": "Source identifier. This field **must** be unique for all sources\nwithin a single compiler invocation (compilation).\n",
"$ref": "schema:ethdebug/format/materials/id"
},
"path": {
"type": "string",
"description": "Hierarchical file-system-like path to this source. This value may\nbe an absolute path, a path relative to some root directory, a path\nto some resource within a package, etc.\n\nThis value does not need to correspond to any file on disk (either\nphysical or virtual), and might instead refer to a path identifier\nfor a source that was generated by a compiler or other development tool.\n\nThis format makes no specific restrictions on how paths should be\nspecified (e.g., no restriction on path separators, etc.), other than\nthat values for this field should match what users observe elsewhere for\nthe inputs/outputs of this particular compiler invocation.\n\nIf no path information is available for a particular source, e.g. if the\nsource was provided to the compiler via shell standard input, this field\nshould indicate that somehow (e.g., specifying `\"path\": \"stdin\"` or\nsimilar).\n\nThis field's value **should** be unique across all sources within the\nsame compilation.\n"
},
"contents": {
"description": "The full contents of the source, possibly re-encoded as UTF-8 to\nmatch parent JSON encoding.\n\nIn cases where input source used a different encoding, this object\n**must** also specify an `encoding` property to indicate the\nencoding originally used. Where relevant, debuggers **must** also\nconvert these `contents` back to the specified original encoding so\nas to match code author expectations.\n",
"type": "string"
},
"encoding": {
"description": "Character encoding of original source `contents`. This property\nis **required** if this encoding does not match the JSON transmission\nencoding (UTF-8), since the value of the `contents` property will\nrepresent the text of the source of this JSON encoding.\n\nThis property **must not** appear in objects that do not specify\na `contents` property.\n",
"type": "string"
},
"language": {
"description": "The high-level language that the source contents are written in.\n",
"type": "string"
}
},
"required": [
"id",
"path",
"contents",
"language"
],
"examples": [
{
"id": 5,
"path": "./contracts/SimpleStorage.sol",
"contents": "// SPDX-License-Identifier: GPL-3.0\npragma solidity >=0.4.16 <0.9.0;\n\ncontract SimpleStorage {\n uint storedData;\n\n function set(uint x) public {\n storedData = x;\n }\n\n function get() public view returns (uint) {\n return storedData;\n }\n}\n",
"language": "Solidity"
}
]
}
Loading...