Skip to content

feat(server): add OpenAPI schema and Swagger UI (#28) - #67

Open
ocakciomursel-pixel wants to merge 1 commit into
BetterMoneyLabs:masterfrom
ocakciomursel-pixel:feat-28-openapi-swagger
Open

ocakciomursel-pixel wants to merge 1 commit into
BetterMoneyLabs:masterfrom
ocakciomursel-pixel:feat-28-openapi-swagger

Conversation

@ocakciomursel-pixel

Copy link
Copy Markdown

Resolves #28

Summary

  • OpenAPI 3.0 Schema (utoipa):
    • Added crates/chaincash_server/src/openapi.rs defining OpenApiDoc and response schemas (HealthcheckResponse, ApiErrorDetail, ApiErrorResponse, TxIdResponse, MintNoteApiResponse, MintReserveApiResponse).
    • Annotated all server endpoints with #[utoipa::path] across healthcheck, acceptance (/api/v1/acceptance), notes (/api/v1/notes/wallet, /api/v1/notes/byPubkey/{pubkey}, /api/v1/notes/mint, /api/v1/notes/spend, /api/v1/notes/redeem), and reserves (/api/v1/reserves/mint, /api/v1/reserves/topup, /api/v1/reserves/wallet).
    • Derived utoipa::ToSchema directly on existing request/response and domain types (MintNoteRequest, SpendNoteRequest, RedeemNoteRequest, Note, OwnershipEntry, NoteWithHistory, MintReserveRequest, TopUpReserveRequest, ReserveBoxSpec, and Predicate variants) without duplicating domain structs.
  • Swagger UI (utoipa-swagger-ui):
    • Mounted SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", OpenApiDoc::openapi()) in Server::router().
  • Tests:
    • Added unit tests test_openapi_json and test_swagger_ui in crates/chaincash_server/src/app.rs verifying /api-docs/openapi.json and /swagger-ui/ responses and registered path coverage.

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.

Add openapi schema and swagger ui

1 participant