Skip to Content
zjkm-ui-ai-elements

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-elements
import {  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

MethodColor
GETGreen
POSTBlue
PUTOrange
PATCHYellow
DELETERed

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 container
  • SchemaDisplayMethod - Color-coded method badge
  • SchemaDisplayPath - Path with highlighted parameters
  • SchemaDisplayDescription - Description text
  • SchemaDisplayContent - Content container
  • SchemaDisplayParameters - Collapsible parameters section
  • SchemaDisplayParameter - Individual parameter
  • SchemaDisplayRequest - Collapsible request body
  • SchemaDisplayResponse - Collapsible response body
  • SchemaDisplayProperty - Schema property (recursive)
  • SchemaDisplayExample - Code example block

On this page