@@ -41,6 +41,7 @@ import {
4141
4242export { doc } from './openapi.ts'
4343
44+ // --- Global schemas ---
4445doc . addSchemas ( {
4546 achievements,
4647 anime,
@@ -80,7 +81,7 @@ doc.addSchemas({
8081 videos,
8182} )
8283
83- //////////////////////////////// Responses
84+ // --- Global responses ---
8485// const BadRequestResponse = doc.addResponse('BadRequest', (t) => {
8586// t.describe('The given parameters could not be parsed')
8687// t.content('application/json', z.any())
@@ -108,8 +109,7 @@ const NotFoundResponse = doc.addResponse('NotFound', (t) => {
108109 t . content ( 'application/json' , z . object ( ) )
109110} )
110111
111- //////////////////////////////// Paths
112- //////////////// Achievements
112+ // --- Achievements ---
113113doc . addPath ( '/api/achievements' ) . get ( ( t ) => {
114114 t . tag ( 'achievements' )
115115 t . describe ( 'List user achievements' )
@@ -124,7 +124,7 @@ doc.addPath('/api/achievements').get((t) => {
124124 } )
125125} )
126126
127- //////////////// Animes
127+ // --- Animes ---
128128doc . addPath ( '/api/animes' ) . get ( ( t ) => {
129129 t . tag ( 'anime' )
130130 t . describe ( 'List animes' )
@@ -235,7 +235,7 @@ doc.addPath('/api/animes/{id}/topics', {id: (t) => t.schema(animeID)}).get((t) =
235235 t . response ( 401 , UnauthorizedResponse )
236236} )
237237
238- //////////////// Manga
238+ // --- Manga ---
239239doc . addPath ( '/api/mangas' ) . get ( ( t ) => {
240240 t . tag ( 'manga' )
241241 t . describe ( 'list manga' )
@@ -319,7 +319,7 @@ doc.addPath('/api/mangas/{id}/topics', {id: (t) => t.schema(ID)}).get((t) => {
319319 t . response ( 401 , UnauthorizedResponse )
320320} )
321321
322- //////////////// Ranobe
322+ // --- Ranobe ---
323323doc . addPath ( '/api/ranobe' ) . get ( ( t ) => {
324324 t . tag ( 'ranobe' )
325325 t . describe ( 'List ranobe' )
@@ -401,7 +401,7 @@ doc.addPath('/api/ranobe/{id}/topics', {id: (t) => t.schema(ID)}).get((t) => {
401401 t . response ( 401 , UnauthorizedResponse )
402402} )
403403
404- //////////////// Characters
404+ // --- Characters ---
405405doc . addPath ( '/api/characters/{id}' , { id : ( t ) => t . schema ( ID ) } ) . get ( ( t ) => {
406406 t . tag ( 'characters' )
407407 t . describe ( 'Show a character' )
@@ -422,7 +422,7 @@ doc.addPath('/api/characters/search').get((t) => {
422422 } )
423423} )
424424
425- //////////////// Peoples / Persons
425+ // --- Peoples / Persons ---
426426doc . addPath ( '/api/people/{id}' , { id : ( t ) => t . schema ( ID ) } ) . get ( ( t ) => {
427427 t . tag ( 'people' )
428428 t . describe ( 'Show a person' )
@@ -434,7 +434,7 @@ doc.addPath('/api/people/search').get((t) => {
434434 t . operationId ( 'find_person' )
435435} )
436436
437- //////////////// Constants
437+ // --- Constants ---
438438doc . addPath ( '/api/constants/anime' ) . get ( ( t ) => {
439439 t . tag ( 'constants' )
440440 t . operationId ( 'get_constants_anime' )
@@ -508,7 +508,6 @@ doc.addPath('/api/constants/smileys').get((t) => {
508508 } )
509509} )
510510
511- ////////////////
512511doc . addPath ( '/api/genres' ) . get ( ( t ) => {
513512 t . tag ( 'genres' )
514513 t . operationId ( 'list_genres' )
@@ -528,9 +527,9 @@ doc.addPath('/api/studios').get((t) => {
528527 } )
529528} )
530529
531- //////////////// Users
530+ // --- Users ---
532531doc
533- . addPath ( '/api/users' ) //
532+ . addPath ( '/api/users' )
534533 . parameter ( 'query' , 'page' , ( t ) => {
535534 t . schema ( usersSearchQuery . shape . page )
536535 } )
553552doc
554553 . addPath ( '/api/users/{id}' , {
555554 id : ( t ) => t . schema ( userID ) ,
556- } ) //
555+ } )
557556 . get ( ( t ) => {
558557 t . tag ( 'v1_user' )
559558 t . operationId ( 'get_user' )
565564 } )
566565
567566doc
568- . addPath ( '/api/users/whoami' ) //
567+ . addPath ( '/api/users/whoami' )
569568 . get ( ( t ) => {
570569 t . tag ( 'v1_user' )
571570 t . security ( oauth2 )
578577 t . response ( 401 , UnauthorizedResponse )
579578 } )
580579
581- //////////////// User Rates
580+ // --- User Rates ---
582581doc
583582 . addPath ( '/api/user_rates/{type}/cleanup' , {
584583 type : ( t ) => t . schema ( z . enum ( [ 'anime' , 'manga' ] ) ) ,
607606 } )
608607 } )
609608
610- //////////////// User Rates 2
611- doc
612- . addPath ( '/api/v2/user_rates' ) //
609+ // --- User Rates 2 ---
610+ doc . addPath ( '/api/v2/user_rates' )
613611 . parameter ( 'query' , 'user_id' , ( t ) => t . schema ( userRatesQuery . shape . user_id ) )
614612 . parameter ( 'query' , 'target_id' , ( t ) => t . schema ( userRatesQuery . shape . target_id ) )
615613 . parameter ( 'query' , 'target_type' , ( t ) => t . schema ( userRatesQuery . shape . target_type ) )
724722 t . response ( 401 , UnauthorizedResponse )
725723 } )
726724
727- //////////////// Videos
725+ // --- Videos ---
728726doc
729727 . addPath ( '/api/animes/{anime_id}/videos' , {
730728 anime_id : ( t ) => t . schema ( animeID ) ,
0 commit comments