Schema Display
Display REST API endpoint documentation with parameters, request/response bodies.
The SchemaDisplay component visualizes REST API endpoints with HTTP methods, paths, parameters, and request/response schemas.
Loading preview…
Installation
npm i zjkm-ui-ai-elementsimport { SchemaDisplayHeader, SchemaDisplayMethod, SchemaDisplayPath, SchemaDisplayDescription, SchemaDisplayContent, SchemaDisplayParameter, SchemaDisplayParameters, SchemaDisplayProperty, SchemaDisplayRequest, SchemaDisplayResponse, SchemaDisplay, SchemaDisplayBody, SchemaDisplayExample,} from "zjkm-ui-ai-elements/schema-display";First time? Add the package's styles: see Setup.
Features
- Color-coded HTTP methods
- Path parameter highlighting
- Collapsible parameters section
- Request/response body schemas
- Nested object property display
- Required field indicators
Method Colors
| Method | Color |
|---|---|
GET | Green |
POST | Blue |
PUT | Orange |
PATCH | Yellow |
DELETE | Red |
Examples
Basic Usage
Loading preview…
With Parameters
Loading preview…
With Request/Response Bodies
Loading preview…
Nested Properties
Loading preview…
Props
<SchemaDisplay />
Prop
Type
SchemaParameter
interface SchemaParameter {
name: string;
type: string;
required?: boolean;
description?: string;
location?: "path" | "query" | "header";
}SchemaProperty
interface SchemaProperty {
name: string;
type: string;
required?: boolean;
description?: string;
properties?: SchemaProperty[]; // For objects
items?: SchemaProperty; // For arrays
}Subcomponents
SchemaDisplayHeader- Header containerSchemaDisplayMethod- Color-coded method badgeSchemaDisplayPath- Path with highlighted parametersSchemaDisplayDescription- Description textSchemaDisplayContent- Content containerSchemaDisplayParameters- Collapsible parameters sectionSchemaDisplayParameter- Individual parameterSchemaDisplayRequest- Collapsible request bodySchemaDisplayResponse- Collapsible response bodySchemaDisplayProperty- Schema property (recursive)SchemaDisplayExample- Code example block