跳至主要内容

API Reference

<SchemaEditor /> Props​

PropTypeDefaultDescription
valuestringrequiredThe editor content
onChange(value: string) => void—Called when content changes
language"json" | "yaml" | "javascript"requiredContent language
schemaJsonSchema—JSON Schema driving completion and diagnostics (json/yaml)
snippetsstring[]—Snippet strings for JavaScript ghost completion
theme"light" | "dark""light"Visual theme
readOnlybooleanfalseDisable editing
placeholderstring—Placeholder text when empty
showDiagnosticsbooleantrueShow diagnostics status bar
enableInlineSuggestionsbooleantrueEnable ghost text
enableCompletionbooleantrueEnable popup completion
diagnosticsDebounceMsnumber250Diagnostics debounce delay

Core exports (@powerduck/schema-editor)​

FunctionDescription
resolveSchemas(document)Resolve $ref pointers in a schema document
validateSchema(data, schema)Validate data against a schema
generateSample(schema)Generate example data from a JSON Schema
getCompletionItems(model, position)Get completion items at a cursor position

Types​

import type { SchemaEditorProps } from "@powerduck/schema-editor/react";