File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed
gitbook/src/components/DocumentView/OpenAPI Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @gitbook/react-openapi ' : patch
3
+ ---
4
+
5
+ Support non primitive examples in OpenAPI block
Original file line number Diff line number Diff line change 176
176
177
177
.openapi-schema-example ,
178
178
.openapi-schema-pattern {
179
- @apply prose-sm mt-2 text-tint-strong;
179
+ @apply prose-sm mt-1 text-tint-strong;
180
180
}
181
181
182
182
/** Authentication */
Original file line number Diff line number Diff line change @@ -51,7 +51,9 @@ export function OpenAPISchemaProperty(
51
51
return (
52
52
typeof schema . example === 'string' ||
53
53
typeof schema . example === 'number' ||
54
- typeof schema . example === 'boolean'
54
+ typeof schema . example === 'boolean' ||
55
+ ( Array . isArray ( schema . example ) && schema . example . length > 0 ) ||
56
+ ( typeof schema . example === 'object' && Object . keys ( schema . example ) . length > 0 )
55
57
) ;
56
58
} ;
57
59
return (
@@ -100,9 +102,9 @@ export function OpenAPISchemaProperty(
100
102
/>
101
103
) : null }
102
104
{ shouldDisplayExample ( schema ) ? (
103
- < span className = "openapi-schema-example" >
105
+ < div className = "openapi-schema-example" >
104
106
Example: < code > { stringifyOpenAPI ( schema . example ) } </ code >
105
- </ span >
107
+ </ div >
106
108
) : null }
107
109
{ schema . pattern ? (
108
110
< div className = "openapi-schema-pattern" >
You can’t perform that action at this time.
0 commit comments