loom_rpc_handler/
openapi.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::dto::block::BlockHeader;
use crate::dto::pool::MarketStats;
use crate::dto::pool::Pool;
use crate::dto::pool::PoolClass;
use crate::dto::pool::PoolDetailsResponse;
use crate::dto::pool::PoolProtocol;
use crate::dto::pool::PoolResponse;
use crate::dto::quote::QuoteRequest;
use crate::dto::quote::QuoteResponse;
use crate::handler::blocks::__path_latest_block;
use crate::handler::pools::__path_market_stats;
use crate::handler::pools::__path_pool;
use crate::handler::pools::__path_pool_quote;
use crate::handler::pools::__path_pools;
use utoipa::OpenApi;

#[derive(OpenApi)]
#[openapi(
    paths(latest_block),
    tags(
        (name = "block", description = "Blockchain")
    ),
    components(schemas(BlockHeader))
)]
pub struct BlockApi;

#[derive(OpenApi)]
#[openapi(
    paths(pool, pools, pool_quote, market_stats),
    tags(
        (name = "market", description = "Market")
    ),
    components(schemas(PoolResponse, PoolDetailsResponse, Pool, PoolClass, PoolProtocol, MarketStats, QuoteRequest, QuoteResponse))
)]
pub struct MarketApi;

#[derive(OpenApi)]
#[openapi(
    nest(
        (path = "/api/v1/block/", api = BlockApi),
        (path = "/api/v1/markets", api = MarketApi)
    )
)]
pub struct ApiDoc;