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(
397397 let type = 'any' ;
398398
399399 if ( schema . enum ) {
400- type = ' enum' ;
400+ type = ` ${ schema . type } · enum` ;
401401 // check array AND schema.items as this is sometimes null despite what the type indicates
402402 } else if ( schema . type === 'array' && ! ! schema . items ) {
403403 type = `${ getSchemaTitle ( schema . items ) } []` ;
@@ -407,7 +407,7 @@ export function getSchemaTitle(
407407 type = schema . type ?? 'object' ;
408408
409409 if ( schema . format ) {
410- type += ` ${ schema . format } ` ;
410+ type += ` · ${ schema . format } ` ;
411411 }
412412 } else if ( 'anyOf' in schema ) {
413413 type = 'any of' ;
@@ -419,8 +419,20 @@ export function getSchemaTitle(
419419 type = 'not' ;
420420 }
421421
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+
422434 if ( schema . nullable ) {
423- type = `nullable ${ type } ` ;
435+ type = `${ type } | nullable ` ;
424436 }
425437
426438 return type ;
You can’t perform that action at this time.
0 commit comments