mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 02:44:34 -05:00
Docs improvements (#359)
* Use Array since Javalin OpenAPI requires it to read the list generics * Use custom Pager class for documentation
This commit is contained in:
@@ -30,7 +30,7 @@ object CategoryController {
|
|||||||
ctx.json(Category.getCategoryList())
|
ctx.json(Category.getCategoryList())
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<CategoryDataClass>>(HttpCode.OK)
|
json<Array<CategoryDataClass>>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -107,7 +107,7 @@ object CategoryController {
|
|||||||
ctx.json(CategoryManga.getCategoryMangaList(categoryId))
|
ctx.json(CategoryManga.getCategoryMangaList(categoryId))
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<MangaDataClass>>(HttpCode.OK)
|
json<Array<MangaDataClass>>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ object ExtensionController {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<ExtensionDataClass>>(HttpCode.OK)
|
json<Array<ExtensionDataClass>>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ object MangaController {
|
|||||||
ctx.json(CategoryManga.getMangaCategories(mangaId))
|
ctx.json(CategoryManga.getMangaCategories(mangaId))
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<CategoryDataClass>>(HttpCode.OK)
|
json<Array<CategoryDataClass>>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ object MangaController {
|
|||||||
ctx.future(future { Chapter.getChapterList(mangaId, onlineFetch) })
|
ctx.future(future { Chapter.getChapterList(mangaId, onlineFetch) })
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<ChapterDataClass>>(HttpCode.OK)
|
json<Array<ChapterDataClass>>(HttpCode.OK)
|
||||||
httpCode(HttpCode.NOT_FOUND)
|
httpCode(HttpCode.NOT_FOUND)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ object SourceController {
|
|||||||
ctx.json(Source.getSourceList())
|
ctx.json(Source.getSourceList())
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<SourceDataClass>>(HttpCode.OK)
|
json<Array<SourceDataClass>>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ object SourceController {
|
|||||||
ctx.json(Source.getSourcePreferences(sourceId))
|
ctx.json(Source.getSourcePreferences(sourceId))
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<Source.PreferenceObject>>(HttpCode.OK)
|
json<Array<Source.PreferenceObject>>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ object SourceController {
|
|||||||
ctx.json(Search.getFilterList(sourceId, reset))
|
ctx.json(Search.getFilterList(sourceId, reset))
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<List<Search.FilterObject>>(HttpCode.OK)
|
json<Array<Search.FilterObject>>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import suwayomi.tachidesk.manga.impl.update.IUpdater
|
|||||||
import suwayomi.tachidesk.manga.impl.update.UpdateStatus
|
import suwayomi.tachidesk.manga.impl.update.UpdateStatus
|
||||||
import suwayomi.tachidesk.manga.impl.update.UpdaterSocket
|
import suwayomi.tachidesk.manga.impl.update.UpdaterSocket
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.CategoryDataClass
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.MangaDataClass
|
import suwayomi.tachidesk.manga.model.dataclass.MangaChapterDataClass
|
||||||
import suwayomi.tachidesk.manga.model.dataclass.PaginatedList
|
import suwayomi.tachidesk.manga.model.dataclass.PaginatedList
|
||||||
import suwayomi.tachidesk.server.JavalinSetup.future
|
import suwayomi.tachidesk.server.JavalinSetup.future
|
||||||
import suwayomi.tachidesk.server.util.formParam
|
import suwayomi.tachidesk.server.util.formParam
|
||||||
@@ -49,10 +49,16 @@ object UpdateController {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
withResults = {
|
withResults = {
|
||||||
json<PaginatedList<MangaDataClass>>(HttpCode.OK)
|
json<PagedMangaChapterListDataClass>(HttpCode.OK)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class made for handling return type in the documentation for [recentChapters],
|
||||||
|
* since OpenApi cannot handle runtime generics.
|
||||||
|
*/
|
||||||
|
private class PagedMangaChapterListDataClass : PaginatedList<MangaChapterDataClass>(emptyList(), false)
|
||||||
|
|
||||||
val categoryUpdate = handler(
|
val categoryUpdate = handler(
|
||||||
formParam<Int?>("categoryId"),
|
formParam<Int?>("categoryId"),
|
||||||
documentWith = {
|
documentWith = {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ package suwayomi.tachidesk.manga.model.dataclass
|
|||||||
|
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
|
|
||||||
data class PaginatedList<T>(
|
open class PaginatedList<T>(
|
||||||
val page: List<T>,
|
val page: List<T>,
|
||||||
val hasNextPage: Boolean,
|
val hasNextPage: Boolean,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user