Skip to content

Add miner OpenAPI spec generation#30

Open
go165 wants to merge 1 commit into
Dipraise1:mainfrom
go165:bounty-23-openapi-spec
Open

Add miner OpenAPI spec generation#30
go165 wants to merge 1 commit into
Dipraise1:mainfrom
go165:bounty-23-openapi-spec

Conversation

@go165

@go165 go165 commented Jun 12, 2026

Copy link
Copy Markdown

Closes #23

Summary

  • Adds a shared miner HTTP route registry used by both neurons/miner.py and the OpenAPI generator.
  • Generates docs/openapi.json for the miner API and docs/miner-openapi.html as a Redoc viewer.
  • Documents sr25519 signed-body auth fields (hotkey, nonce, signature) and namespace signature fields in the OpenAPI schemas.
  • Adds sync tests and docs showing how to regenerate/check the spec.

Validation

python3 scripts/generate_openapi.py --check
python3 -m py_compile engram/miner/openapi.py scripts/generate_openapi.py neurons/miner.py tests/test_openapi.py
git diff --check
python3 - <<'PY'
import json
from engram.miner.openapi import MINER_HTTP_ROUTES, build_openapi_spec
spec = build_openapi_spec()
assert spec['openapi'] == '3.1.0'
assert len(MINER_HTTP_ROUTES) == spec['x-engram-route-count']
assert {(r.method, r.path) for r in MINER_HTTP_ROUTES} == {
    (method, path) for path, methods in spec['paths'].items() for method in methods
}
assert 'sr25519' in spec['components']['securitySchemes']['Sr25519SignedBody']['description']
assert json.loads(open('docs/openapi.json', encoding='utf-8').read()) == spec
print('openapi smoke checks passed')
PY

pytest was not available in this environment, and the configured PyPI mirror did not provide it, so I validated the new checks with the direct smoke command above plus bytecode compilation.

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

@go165 is attempting to deploy a commit to the praise's projects Team on Vercel.

A member of the Team first needs to authorize it.

@go165

go165 commented Jun 13, 2026

Copy link
Copy Markdown
Author

Payout address if reward-eligible: 0x1f0130669ca6fd02e025a984cc038f139df19a2f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs] OpenAPI spec for miner HTTP endpoints

1 participant