vitepress-openapi
Version:
Generate VitePress API Documentation from OpenAPI Specification.
41 lines (40 loc) • 1.19 kB
TypeScript
import type { OpenAPI } from '@scalar/openapi-types';
export type JSONSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object' | 'null';
interface Metadata {
isCircularReference?: boolean;
isAdditionalProperties?: boolean;
isOneOf?: boolean;
isOneOfItem?: boolean;
isAnyOf?: boolean;
isAnyOfItem?: boolean;
isConstant?: boolean;
isPrefixItem?: boolean;
prefixItemIndex?: number;
hasPrefixItems?: boolean;
isAdditionalItems?: boolean;
extra?: Record<string, unknown>;
}
interface DocumentationReference {
url?: string;
description?: string;
}
export interface OAProperty {
name: string;
types: JSONSchemaType[];
required: boolean;
examples?: unknown[];
title?: string;
description?: string;
defaultValue?: unknown;
docs?: DocumentationReference;
constraints?: Record<string, unknown>;
properties?: OAProperty[];
items?: OAProperty;
enum?: unknown[];
subtype?: JSONSchemaType;
subexamples?: unknown[];
nullable?: boolean;
meta?: Metadata;
}
export declare function getSchemaUi(jsonSchema: OpenAPI.SchemaObject): OAProperty | OAProperty[];
export {};