@@ -55,9 +55,7 @@ export const ArrayTypeLoader: TypeLoaderFn = async (context, value) => {
55
55
56
56
// TODO: Better warn stack trace
57
57
if ( ! itemsSchema ) {
58
- context . logger . warn (
59
- "You tried to specify an array type with an item that resolves to undefined." ,
60
- ) ;
58
+ context . logger . warn ( "You tried to specify an array type with an item that resolves to undefined." ) ;
61
59
return ;
62
60
}
63
61
@@ -81,32 +79,22 @@ export const ClassTypeLoader: TypeLoaderFn = async (context, value) => {
81
79
return { $ref : getSchemaPath ( model ) } ;
82
80
}
83
81
84
- const schema : SetRequired < OpenAPIV3 . SchemaObject , "properties" | "required" > =
85
- {
86
- type : "object" ,
87
- properties : { } ,
88
- required : [ ] ,
89
- } ;
82
+ const schema : SetRequired < OpenAPIV3 . SchemaObject , "properties" | "required" > = {
83
+ type : "object" ,
84
+ properties : { } ,
85
+ required : [ ] ,
86
+ } ;
90
87
91
88
const properties = PropertyMetadataStorage . getMetadata ( value . prototype ) ;
92
89
93
90
if ( ! properties ) {
94
- context . logger . warn (
95
- `You tried to use '${ model } ' as a type but it does not contain any ApiProperty.` ,
96
- ) ;
91
+ context . logger . warn ( `You tried to use '${ model } ' as a type but it does not contain any ApiProperty.` ) ;
97
92
}
98
93
99
94
context . schemas [ model ] = schema ;
100
95
101
96
for ( const [ key , property ] of Object . entries ( properties ) ) {
102
- const {
103
- required,
104
- type,
105
- name,
106
- enum : e ,
107
- schema : s ,
108
- ...metadata
109
- } = property as any ;
97
+ const { required, type, name, enum : e , schema : s , ...metadata } = property as any ;
110
98
schema . properties [ key ] = {
111
99
...( await loadType ( context , property ) ) ,
112
100
...metadata ,
@@ -149,18 +137,12 @@ export async function loadType(
149
137
const thunk = isThunk ( options . type ) ;
150
138
const value = thunk ? ( options . type as Function ) ( context ) : options . type ;
151
139
152
- for ( const loader of [
153
- PrimitiveTypeLoader ,
154
- ...context . typeLoaders ,
155
- ClassTypeLoader ,
156
- ] ) {
140
+ for ( const loader of [ PrimitiveTypeLoader , ...context . typeLoaders , ClassTypeLoader ] ) {
157
141
const result = await loader ( context , value , options . type ) ;
158
142
if ( result ) {
159
143
return result ;
160
144
}
161
145
}
162
146
163
- context . logger . warn (
164
- `You tried to use '${ options . type . toString ( ) } ' as a type but no loader supports it ${ thunk } ` ,
165
- ) ;
147
+ context . logger . warn ( `You tried to use '${ options . type . toString ( ) } ' as a type but no loader supports it ${ thunk } ` ) ;
166
148
}
0 commit comments