Convert Ethereum consensus spec SSZ types to OpenAPI type schema definitions
Project description
pyspec2openapi
Tool to convert the types defined in the Ethereum python specs https://github.com/ethereum/consensus-specs to an OpenAPI definition, for https://github.com/ethereum/beacon-APIs. This tool facilitates manteinance of the OpenAPI spec and follows the canonical JSON mapping from https://github.com/ethereum/consensus-specs/pull/3506
Usage
Install from PyPI
pip install pyspec2openapi
Create a config.yml file
spec_version: v1.4.0-beta.5
sources:
phase0:
- {spec: beacon-chain.md}
- {spec: validator.md}
- {file: extra_types/phase0.md}
altair:
- {spec: beacon-chain.md}
- {spec: validator.md}
- {spec: light-client/sync-protocol.md}
- {file: extra_types/altair.md}
bellatrix:
- {spec: beacon-chain.md}
- {spec: validator.md}
- {file: extra_types/bellatrix.md}
capella:
- {spec: beacon-chain.md}
- {spec: validator.md}
- {spec: light-client/sync-protocol.md}
deneb:
- {spec: polynomial-commitments.md}
- {spec: beacon-chain.md}
- {spec: validator.md}
- {spec: p2p-interface.md}
- {spec: light-client/sync-protocol.md}
- {file: extra_types/deneb.md}
generate_blinded_types: [bellatrix, capella, deneb]
ignore_classnames:
- LightClientStore
exclude_comments:
- '\[New [^\]]*\]'
- '\[Modified [^\]]*\]'
spec_version: Specific Github tag from theethereum/consensus-specsrepo to fetch sources fromsources: Topologically sorted list of fork and files to fetch types from. This tool can topologically sort types within the same markdown file, but not across them.generate_blinded_types: Auto-generate the typesBlindedBeaconBlockBody,BlindedBeaconBlock, andSignedBlindedBeaconBlockfor a specific set of forks.ignore_classnames: Ignore container code blocks with this list of namesexclude_comments: Ignore comments for container properties that match any of this regex
Generate types spec
pyspec2openapi config.yml out.yml
Review an example output with an example config in ./pyspec2openapi/tests/example_specs_out.yml
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyspec2openapi-0.3.0.tar.gz.
File metadata
- Download URL: pyspec2openapi-0.3.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a033c914791d26e9937c42fde1ec03ae45e121ec34c42c3bb2b0e3035bda5efe
|
|
| MD5 |
a64b38c44b1a0a5135d007acbcca6451
|
|
| BLAKE2b-256 |
c5d9589ee7ef08a98cae51ff8992a5f46f9f8c239c707f8f79bff2ea27742567
|
File details
Details for the file pyspec2openapi-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pyspec2openapi-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81cc27e94cf233158a4e0a54f8b572e562fc853e95f6b05a21498bec6fd1070c
|
|
| MD5 |
3a5e501555e0b0a8076dfae98e296263
|
|
| BLAKE2b-256 |
82f954fe7b14eb61172dae42a6e8f53475e88d2270b27a2d78ace4279517e723
|