File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
packages/react-openapi/src Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @gitbook/react-openapi ' : patch
3
+ ---
4
+
5
+ Show additional fields in OpenAPI block
Original file line number Diff line number Diff line change @@ -397,7 +397,7 @@ export function getSchemaTitle(
397
397
let type = 'any' ;
398
398
399
399
if ( schema . enum ) {
400
- type = ' enum' ;
400
+ type = ` ${ schema . type } · enum` ;
401
401
// check array AND schema.items as this is sometimes null despite what the type indicates
402
402
} else if ( schema . type === 'array' && ! ! schema . items ) {
403
403
type = `${ getSchemaTitle ( schema . items ) } []` ;
@@ -407,7 +407,7 @@ export function getSchemaTitle(
407
407
type = schema . type ?? 'object' ;
408
408
409
409
if ( schema . format ) {
410
- type += ` ${ schema . format } ` ;
410
+ type += ` · ${ schema . format } ` ;
411
411
}
412
412
} else if ( 'anyOf' in schema ) {
413
413
type = 'any of' ;
@@ -419,8 +419,20 @@ export function getSchemaTitle(
419
419
type = 'not' ;
420
420
}
421
421
422
+ if ( schema . minimum || schema . minLength ) {
423
+ type += ` · min: ${ schema . minimum || schema . minLength } ` ;
424
+ }
425
+
426
+ if ( schema . maximum || schema . maxLength ) {
427
+ type += ` · max: ${ schema . maximum || schema . maxLength } ` ;
428
+ }
429
+
430
+ if ( schema . default ) {
431
+ type += ` · default: ${ schema . default } ` ;
432
+ }
433
+
422
434
if ( schema . nullable ) {
423
- type = `nullable ${ type } ` ;
435
+ type = `${ type } | nullable ` ;
424
436
}
425
437
426
438
return type ;
You can’t perform that action at this time.
0 commit comments