Skip to content

fix(api): export JSON schemas from pydantic models and publish schema index (fixes #32) - #46

Closed
evandroribeiro94 wants to merge 1 commit into
devodii:mainfrom
evandroribeiro94:feat/issue-32-json-schema-export
Closed

evandroribeiro94 wants to merge 1 commit into
devodii:mainfrom
evandroribeiro94:feat/issue-32-json-schema-export

Conversation

@evandroribeiro94

Copy link
Copy Markdown

Summary

Fixes #32

This PR implements versioned JSON Schema exports for all public API models and publishes a comprehensive schema catalog index, enabling external builders to find and validate against official HackProof schemas.

What was built

  1. API Schema Generation:
    • Added api_json_schema() in hackproof.export.render generating Draft 2020-12 schemas with canonical $id URLs (https://hackproof.vercel.app/schema/{slug}-{version}.schema.json) for all 10 public API models (Stats, Project, ProjectDetail, Builder, Contract, WasmUpload, FailedTx, TimelinePoint, Integration, CountryCount).
    • Integrated schema generation into export_schemas() in hackproof.export.jobs, writing schemas to apps/web/public/schema/.
  2. Schema Index Catalog:
    • Generates apps/web/public/schema/index.json cataloging all dataset export schema versions (hackathon-export 1.0, 1.1, 1.2) and API model schemas with URLs, model names, and file paths.
  3. CLI Subcommand:
    • Added uv run hackproof export-schemas command to cli.py and hooked it into run_export().
  4. Documentation:
    • Updated README.md Data section documenting export-schemas and linking directly to the new Schema Index.
  5. Testing:
    • Added apps/api/tests/test_api_schemas.py validating sample responses of each API model against its schema using jsonschema.Draft202012Validator and verifying index.json integrity.

Verification

  • uv run ruff check . -> PASS (All checks passed)
  • uv run ruff format --check . -> PASS (78 files formatted)
  • uv run pytest tests/test_api_schemas.py -> PASS (2 passed in 0.54s)

@vercel

vercel Bot commented Oct 31, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Payroutes OSS Team on Vercel.

A member of the Team first needs to authorize it.

@devodii devodii closed this Nov 1, 2026
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.

JSON schema export from pydantic models

2 participants