File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
packages/docusaurus-plugin-openapi-docs/src/openapi Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -234,14 +234,27 @@ function primitive(schema: SchemaObject = {}) {
234234 return ;
235235 }
236236
237- let fn = schema . default ? ( ) => schema . default : primitives [ type ] . default ;
237+ // If type is an array, use the first type
238+ if ( Array . isArray ( type ) ) {
239+ type = type [ 0 ] ;
240+ if ( type === undefined ) {
241+ return ;
242+ }
243+ }
238244
239- if ( format !== undefined ) {
240- fn = primitives [ type ] [ format ] || fn ;
245+ // Use schema default if available, otherwise use type default
246+ if ( schema . default !== undefined ) {
247+ return schema . default ;
241248 }
242249
243- if ( fn ) {
244- return fn ( schema ) ;
250+ const typeConfig = primitives [ type ] ;
251+ if ( typeConfig ) {
252+ if ( format !== undefined && typeConfig [ format ] !== undefined ) {
253+ return typeConfig [ format ] ( schema ) ;
254+ }
255+ if ( typeConfig . default !== undefined ) {
256+ return typeConfig . default ( schema ) ;
257+ }
245258 }
246259
247260 return "Unknown Type: " + schema . type ;
You can’t perform that action at this time.
0 commit comments