Skip to content

Feature/add swagger specifics#360

Merged
LaGodxy merged 3 commits into
MettaChain:mainfrom
Lansa-18:feature/add-swagger-specifics
Apr 24, 2026
Merged

Feature/add swagger specifics#360
LaGodxy merged 3 commits into
MettaChain:mainfrom
Lansa-18:feature/add-swagger-specifics

Conversation

@Lansa-18
Copy link
Copy Markdown
Contributor

Closes #178

✨ Feature: OpenAPI/Swagger Specification for Indexer REST API (#178)

Goal

Add a machine-readable OpenAPI/Swagger specification to the PropChain indexer REST API so consumers can explore, test, and generate clients against the API without relying solely on the markdown README.


🔍 What Was Implemented

The utoipa crate was integrated into the indexer to derive an OpenAPI 3.0 spec at compile time from code annotations. A Swagger UI is served at /swagger-ui/ and the raw JSON spec at /api-docs/openapi.json.

The three documented routes are:

Route Method
/health GET
/events GET
/contracts GET

Note: /metrics is intentionally excluded as it returns Prometheus text, not JSON.


📁 Files Modified

File Change
indexer/Cargo.toml Added utoipa v5 and utoipa-swagger-ui v8 dependencies; declared ingest as a valid feature to fix pre-existing clippy warnings
indexer/src/db.rs Added utoipa::ToSchema derive and doc comments to IndexedEvent
indexer/src/api.rs Added utoipa::IntoParams + utoipa::ToSchema to EventsParams; added #[utoipa::path] annotations to health, list_events, and list_contracts handlers
indexer/src/openapi.rs New fileApiDoc struct that assembles the full OpenAPI spec (paths, schemas, tags, info)
indexer/src/main.rs Added mod openapi; restructured router to merge SwaggerUi as a stateless outer layer alongside the state-bearing API routes
indexer/README.md Added Swagger UI and OpenAPI JSON URLs under a new "API Documentation" section

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 24, 2026

@Lansa-18 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Lansa-18
Copy link
Copy Markdown
Contributor Author

@LaGodxy Kindly go through.

@LaGodxy LaGodxy merged commit 829ba38 into MettaChain:main Apr 24, 2026
14 checks passed
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.

API: Add OpenAPI/Swagger specification

2 participants