MCPcopy Index your code
hub / github.com/GitbookIO/gitbook / shouldDisplayExample

Function shouldDisplayExample

packages/react-openapi/src/utils.ts:144–154  ·  view source on GitHub ↗

* Check if an example should be displayed.

(schema: OpenAPIV3.SchemaObject)

Source from the content-addressed store, hash-verified

142 * Check if an example should be displayed.
143 */
144function shouldDisplayExample(schema: OpenAPIV3.SchemaObject): boolean {
145 return (
146 (typeof schema.example === 'string' && !!schema.example) ||
147 typeof schema.example === 'number' ||
148 typeof schema.example === 'boolean' ||
149 (Array.isArray(schema.example) && schema.example.length > 0) ||
150 (typeof schema.example === 'object' &&
151 schema.example !== null &&
152 Object.keys(schema.example).length > 0)
153 );
154}
155
156/**
157 * Get the class name for a status code.

Callers 1

resolveFirstExampleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected