File tree Expand file tree Collapse file tree 5 files changed +288
-290
lines changed Expand file tree Collapse file tree 5 files changed +288
-290
lines changed Original file line number Diff line number Diff line change @@ -14,20 +14,20 @@ export const app = new Elysia()
1414 } )
1515 } )
1616 )
17+ . model ( {
18+ 'character.name' : t . String ( ) ,
19+ 'character.thing' : t . Object ( {
20+ name : t . String ( )
21+ } )
22+ } )
1723 . get (
1824 '/const' ,
1925 ( ) =>
2026 ( {
2127 name : 'Lilith' ,
2228 friends : [ 'Sartre' , 'Fouco' ]
23- } ) as const
29+ } )
2430 )
25- . model ( {
26- 'character.name' : t . String ( ) ,
27- 'character.thing' : t . Object ( {
28- name : t . String ( )
29- } )
30- } )
3131 . get (
3232 '/' ,
3333 ( ) =>
Original file line number Diff line number Diff line change 11{
22 "name" : " @elysiajs/openapi" ,
3- "version" : " 1.4.8" ,
3+ "version" : " 1.4.8-beta.0 " ,
44 "description" : " Plugin for Elysia to auto-generate API documentation" ,
55 "author" : {
66 "name" : " saltyAom" ,
Original file line number Diff line number Diff line change @@ -321,15 +321,14 @@ export const fromTypes =
321321 )
322322 )
323323
324- const routesString = extractRootObjects ( instance ) [ 0 ] . replace (
325- matchStatus ,
326- '"$1":'
324+ const routesString = extractRootObjects (
325+ instance . replace ( matchStatus , '"$1":' )
327326 )
328327
329328 const routes : AdditionalReference = { }
330329
331330 // Treaty is a collection of { ... } & { ... } & { ... }
332- for ( const route of extractRootObjects ( routesString ) ) {
331+ for ( const route of routesString ) {
333332 let schema = TypeBox ( route . replaceAll ( / r e a d o n l y / g, '' ) )
334333 if ( schema . type !== 'object' ) continue
335334
Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ import type {
1010 ElysiaOpenAPIConfig ,
1111 MapJsonSchema
1212} from './types'
13- import { DefaultErrorFunction } from '@sinclair/typebox/errors'
1413
1514export const capitalize = ( word : string ) =>
1615 word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 )
@@ -534,7 +533,7 @@ export function toOpenAPISchema(
534533 type === 'void' ||
535534 type === 'null' ||
536535 type === 'undefined'
537- ? ( response as any )
536+ ? ( { type , description } as any )
538537 : type === 'string' ||
539538 type === 'number' ||
540539 type === 'integer' ||
@@ -570,7 +569,7 @@ export function toOpenAPISchema(
570569 type === 'void' ||
571570 type === 'null' ||
572571 type === 'undefined'
573- ? ( response as any )
572+ ? ( { type , description } as any )
574573 : type === 'string' ||
575574 type === 'number' ||
576575 type === 'integer' ||
You can’t perform that action at this time.
0 commit comments