Skip to main content

headless_lms_server/
openapi.rs

1use utoipa::OpenApi;
2
3#[derive(OpenApi)]
4#[openapi(
5    nest((path = "/api/v0/cms", api = crate::controllers::cms::CmsRoutesApiDoc)),
6    info(
7        title = "CMS API",
8        version = "0.1.0"
9    )
10)]
11pub struct CmsApiDoc;
12
13#[derive(OpenApi)]
14#[openapi(
15    nest(
16        (
17            path = "/api/v0/main-frontend",
18            api = crate::controllers::main_frontend::MainFrontendRoutesApiDoc
19        ),
20        (path = "/api/v0/files", api = crate::controllers::files::FilesApiDoc)
21    ),
22    components(schemas(
23        headless_lms_models::suspected_cheaters::SuspectedCheaterStatus
24    )),
25    tags(
26        (name = "glossary", description = "Glossary endpoints used by main-frontend")
27    ),
28    info(
29        title = "Main Frontend API",
30        version = "0.1.0"
31    )
32)]
33pub struct MainFrontendApiDoc;
34
35#[derive(OpenApi)]
36#[openapi(
37    nest(
38        (
39            path = "/api/v0/course-material",
40            api = crate::controllers::course_material::CourseMaterialRoutesApiDoc
41        )
42    ),
43    components(schemas(
44        headless_lms_models::teacher_grading_decisions::TeacherDecisionType
45    )),
46    info(
47        title = "Course Material API",
48        version = "0.1.0"
49    )
50)]
51pub struct CourseMaterialApiDoc;
52
53#[derive(OpenApi)]
54#[openapi(
55    nest((path = "/api/v0/auth", api = crate::controllers::auth::AuthRoutesApiDoc)),
56    info(
57        title = "Auth API",
58        version = "0.1.0"
59    )
60)]
61pub struct AuthApiDoc;
62
63#[derive(OpenApi)]
64#[openapi(
65    nest((path = "/api/v0/errors", api = crate::controllers::errors::ErrorsRoutesApiDoc)),
66    info(
67        title = "Errors API",
68        version = "0.1.0"
69    )
70)]
71pub struct ErrorsApiDoc;