Skip to content

Convert spec to yaml #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26,971 changes: 16,853 additions & 10,118 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"gh-pages": "^4.0.0",
"graphql": "^16.3.0",
"graphql-request": "^4.1.0",
"js-yaml": "^4.1.0",
"json-schema-merge-allof": "^0.8.1"
}
}
5 changes: 3 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from "fs";
import yaml from "js-yaml";
import merger from "json-schema-merge-allof";
import { dereferenceDocument } from "@open-rpc/schema-utils-js";

Expand All @@ -10,7 +11,7 @@ let methodFiles = fs.readdirSync(methodsBase);
methodFiles.forEach(file => {
console.log(file);
let raw = fs.readFileSync(methodsBase + file);
let parsed = JSON.parse(raw);
let parsed = yaml.load(raw);
methods = [
...methods,
...parsed,
Expand All @@ -23,7 +24,7 @@ let schemaFiles = fs.readdirSync(schemasBase);
schemaFiles.forEach(file => {
console.log(file);
let raw = fs.readFileSync(schemasBase + file);
let parsed = JSON.parse(raw);
let parsed = yaml.load(raw);
schemas = {
...schemas,
...parsed,
Expand Down
2 changes: 1 addition & 1 deletion spellcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ matrix:
- pre
- name: json schemas
sources:
- 'src/**/*.json'
- 'src/**/*.yaml'
aspell:
lang: en
d: en_US
Expand Down
144 changes: 0 additions & 144 deletions src/eth/block.json

This file was deleted.

84 changes: 84 additions & 0 deletions src/eth/block.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
- name: eth_getBlockByHash
summary: Returns information about a block by hash.
params:
- name: Block hash
required: true
schema:
$ref: '#/components/schemas/hash32'
- name: Hydrated transactions
required: true
schema:
title: hydrated
type: boolean
result:
name: Block information
schema:
$ref: '#/components/schemas/Block'
- name: eth_getBlockByNumber
summary: Returns information about a block by number.
params:
- name: Block
required: true
schema:
$ref: '#/components/schemas/BlockNumberOrTag'
- name: Hydrated transactions
required: true
schema:
title: hydrated
type: boolean
result:
name: Block information
schema:
$ref: '#/components/schemas/Block'
- name: eth_getBlockTransactionCountByHash
summary: Returns the number of transactions in a block from a block matching the given block hash.
params:
- name: Block hash
schema:
$ref: '#/components/schemas/hash32'
result:
name: Transaction count
schema:
title: Transaction count
type: array
items:
$ref: '#/components/schemas/uint'
- name: eth_getBlockTransactionCountByNumber
summary: Returns the number of transactions in a block matching the given block number.
params:
- name: Block
schema:
$ref: '#/components/schemas/BlockNumberOrTag'
result:
name: Transaction count
schema:
title: Transaction count
type: array
items:
$ref: '#/components/schemas/uint'
- name: eth_getUncleCountByBlockHash
summary: Returns the number of uncles in a block from a block matching the given block hash.
params:
- name: Block hash
schema:
$ref: '#/components/schemas/hash32'
result:
name: Uncle count
schema:
title: Uncle count
type: array
items:
$ref: '#/components/schemas/uint'
- name: eth_getUncleCountByBlockNumber
summary: Returns the number of transactions in a block matching the given block number.
params:
- name: Block
schema:
$ref: '#/components/schemas/BlockNumberOrTag'
result:
name: Uncle count
schema:
title: Uncle count
type: array
items:
$ref: '#/components/schemas/uint'
73 changes: 0 additions & 73 deletions src/eth/client.json

This file was deleted.

46 changes: 46 additions & 0 deletions src/eth/client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
- name: eth_protocolVersion
summary: Returns the current Ethereum protocol version.
params: []
result:
name: Protocol version
schema:
title: version
type: string
- name: eth_chainId
summary: Returns the chain ID of the current network.
params: []
result:
name: Chain ID
schema:
$ref: '#/components/schemas/uint'
- name: eth_syncing
summary: Returns an object with data about the sync status or false.
params: []
result:
name: Syncing status
schema:
$ref: '#/components/schemas/SyncingStatus'
- name: eth_coinbase
summary: Returns the client coinbase address.
params: []
result:
name: Coinbase address
schema:
$ref: '#/components/schemas/address'
- name: eth_accounts
summary: Returns a list of addresses owned by client.
params: []
result:
name: Accounts
schema:
title: Accounts
type: array
items:
$ref: '#/components/schemas/address'
- name: eth_blockNumber
summary: Returns the number of most recent block.
params: []
result:
name: Block number
schema:
$ref: '#/components/schemas/uint'
Loading