mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
config: json,script,schema (4 files)
This commit is contained in:
316
packages/json_script_example/seed/components.schema.json
Normal file
316
packages/json_script_example/seed/components.schema.json
Normal file
@@ -0,0 +1,316 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://metabuilder.dev/schemas/json-script-components.schema.json",
|
||||
"title": "JSON Script Components",
|
||||
"description": "Declarative UI component definitions for JSON scripts",
|
||||
"type": "object",
|
||||
"required": ["schema_version", "package"],
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"description": "JSON Schema reference"
|
||||
},
|
||||
"schema_version": {
|
||||
"type": "string",
|
||||
"description": "Schema version",
|
||||
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
||||
},
|
||||
"package": {
|
||||
"type": "string",
|
||||
"description": "Package identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Component file description"
|
||||
},
|
||||
"exports": {
|
||||
"type": "object",
|
||||
"description": "Exported components",
|
||||
"properties": {
|
||||
"components": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"type": "array",
|
||||
"description": "Component definitions",
|
||||
"items": {
|
||||
"$ref": "#/definitions/component"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"component": {
|
||||
"type": "object",
|
||||
"required": ["id", "name", "render"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Unique component identifier (snake_case)"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Component name (PascalCase)"
|
||||
},
|
||||
"exported": {
|
||||
"type": "boolean",
|
||||
"description": "Whether component is exported",
|
||||
"default": false
|
||||
},
|
||||
"docstring": {
|
||||
"$ref": "#/definitions/docstring"
|
||||
},
|
||||
"props": {
|
||||
"type": "array",
|
||||
"description": "Component prop definitions",
|
||||
"items": {
|
||||
"$ref": "#/definitions/prop"
|
||||
}
|
||||
},
|
||||
"state": {
|
||||
"type": "object",
|
||||
"description": "Component state with initial values",
|
||||
"additionalProperties": true
|
||||
},
|
||||
"handlers": {
|
||||
"type": "object",
|
||||
"description": "Event handler definitions",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/handler"
|
||||
}
|
||||
},
|
||||
"computed": {
|
||||
"type": "object",
|
||||
"description": "Computed property definitions",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/computedProperty"
|
||||
}
|
||||
},
|
||||
"render": {
|
||||
"$ref": "#/definitions/renderDefinition"
|
||||
}
|
||||
}
|
||||
},
|
||||
"prop": {
|
||||
"type": "object",
|
||||
"required": ["name", "type"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Prop name"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Prop type",
|
||||
"enum": ["string", "number", "boolean", "object", "array", "function", "any"]
|
||||
},
|
||||
"optional": {
|
||||
"type": "boolean",
|
||||
"description": "Whether prop is optional",
|
||||
"default": false
|
||||
},
|
||||
"default": {
|
||||
"description": "Default prop value"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Prop description"
|
||||
}
|
||||
}
|
||||
},
|
||||
"handler": {
|
||||
"type": "object",
|
||||
"required": ["body"],
|
||||
"properties": {
|
||||
"params": {
|
||||
"type": "array",
|
||||
"description": "Handler parameter names",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"body": {
|
||||
"type": "array",
|
||||
"description": "Handler statements",
|
||||
"items": {
|
||||
"$ref": "#/definitions/statement"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"computedProperty": {
|
||||
"type": "object",
|
||||
"required": ["deps", "compute"],
|
||||
"properties": {
|
||||
"deps": {
|
||||
"type": "array",
|
||||
"description": "Dependencies to watch",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"compute": {
|
||||
"description": "Computation expression or call"
|
||||
}
|
||||
}
|
||||
},
|
||||
"renderDefinition": {
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Render type",
|
||||
"enum": ["component", "element"]
|
||||
},
|
||||
"template": {
|
||||
"$ref": "#/definitions/templateNode"
|
||||
}
|
||||
}
|
||||
},
|
||||
"templateNode": {
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "HTML element type or 'component'"
|
||||
},
|
||||
"className": {
|
||||
"type": "string",
|
||||
"description": "CSS class name"
|
||||
},
|
||||
"style": {
|
||||
"type": "object",
|
||||
"description": "Inline styles"
|
||||
},
|
||||
"children": {
|
||||
"oneOf": [
|
||||
{ "type": "string" },
|
||||
{ "type": "array", "items": { "$ref": "#/definitions/templateNodeOrString" } }
|
||||
]
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Component name (when type is 'component')"
|
||||
},
|
||||
"props": {
|
||||
"type": "object",
|
||||
"description": "Component props"
|
||||
},
|
||||
"inputType": {
|
||||
"type": "string",
|
||||
"description": "Input type (for input elements)"
|
||||
},
|
||||
"value": {
|
||||
"description": "Input value"
|
||||
},
|
||||
"onChange": {
|
||||
"description": "Change handler reference"
|
||||
},
|
||||
"onClick": {
|
||||
"description": "Click handler reference"
|
||||
},
|
||||
"if": {
|
||||
"description": "Conditional rendering expression"
|
||||
},
|
||||
"each": {
|
||||
"type": "string",
|
||||
"description": "Array reference for iteration"
|
||||
},
|
||||
"as": {
|
||||
"type": "string",
|
||||
"description": "Item variable name for iteration"
|
||||
}
|
||||
}
|
||||
},
|
||||
"templateNodeOrString": {
|
||||
"oneOf": [
|
||||
{ "type": "string" },
|
||||
{ "$ref": "#/definitions/templateNode" }
|
||||
]
|
||||
},
|
||||
"statement": {
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Statement type",
|
||||
"enum": [
|
||||
"setState",
|
||||
"call_expression",
|
||||
"if",
|
||||
"return",
|
||||
"const_declaration",
|
||||
"let_declaration",
|
||||
"assignment",
|
||||
"comment"
|
||||
]
|
||||
},
|
||||
"updates": {
|
||||
"type": "object",
|
||||
"description": "State updates (for setState)"
|
||||
},
|
||||
"callee": {
|
||||
"type": "string",
|
||||
"description": "Function to call"
|
||||
},
|
||||
"args": {
|
||||
"type": "array",
|
||||
"description": "Function arguments"
|
||||
}
|
||||
}
|
||||
},
|
||||
"docstring": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"description": "Brief summary"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Detailed description"
|
||||
},
|
||||
"props": {
|
||||
"type": "array",
|
||||
"description": "Prop documentation",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"description": { "type": "string" },
|
||||
"optional": { "type": "boolean" },
|
||||
"default": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"type": "array",
|
||||
"description": "Usage examples",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": { "type": "string" },
|
||||
"code": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"since": {
|
||||
"type": "string",
|
||||
"description": "Version when added"
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"description": "Documentation tags",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"see": {
|
||||
"type": "array",
|
||||
"description": "Related references",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
297
packages/json_script_example/seed/metadata.schema.json
Normal file
297
packages/json_script_example/seed/metadata.schema.json
Normal file
@@ -0,0 +1,297 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://metabuilder.dev/schemas/package-metadata.schema.json",
|
||||
"title": "Package Metadata",
|
||||
"description": "MetaBuilder package metadata definition",
|
||||
"type": "object",
|
||||
"required": ["packageId", "name", "version", "description"],
|
||||
"properties": {
|
||||
"packageId": {
|
||||
"type": "string",
|
||||
"description": "Unique package identifier (snake_case)",
|
||||
"pattern": "^[a-z][a-z0-9_]*$"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Human-readable package name"
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "Package version (semver)",
|
||||
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Package description"
|
||||
},
|
||||
"author": {
|
||||
"type": "string",
|
||||
"description": "Package author"
|
||||
},
|
||||
"category": {
|
||||
"type": "string",
|
||||
"description": "Package category",
|
||||
"enum": ["ui", "data", "examples", "tools", "admin", "auth", "social", "media", "dev"]
|
||||
},
|
||||
"icon": {
|
||||
"type": "string",
|
||||
"description": "Path to package icon"
|
||||
},
|
||||
"minLevel": {
|
||||
"type": "integer",
|
||||
"description": "Minimum permission level required (0-6)",
|
||||
"minimum": 0,
|
||||
"maximum": 6,
|
||||
"default": 0
|
||||
},
|
||||
"primary": {
|
||||
"type": "boolean",
|
||||
"description": "Whether this is a primary/featured package",
|
||||
"default": false
|
||||
},
|
||||
"dependencies": {
|
||||
"type": "array",
|
||||
"description": "Required package dependencies",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9_]*$"
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"type": "array",
|
||||
"description": "Development-only dependencies",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z][a-z0-9_]*$"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
"type": "object",
|
||||
"description": "Exported items from this package",
|
||||
"properties": {
|
||||
"scripts": {
|
||||
"type": "array",
|
||||
"description": "Exported script/function names",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"types": {
|
||||
"type": "array",
|
||||
"description": "Exported type definitions",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"components": {
|
||||
"type": "array",
|
||||
"description": "Exported UI components",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"constants": {
|
||||
"type": "array",
|
||||
"description": "Exported constants",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests": {
|
||||
"type": "object",
|
||||
"description": "Test configuration",
|
||||
"properties": {
|
||||
"scripts": {
|
||||
"type": "array",
|
||||
"description": "Test script files",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"cases": {
|
||||
"type": "array",
|
||||
"description": "Test case files",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"parameterized": {
|
||||
"type": "array",
|
||||
"description": "Parameterized test definitions",
|
||||
"items": {
|
||||
"$ref": "#/definitions/parameterizedTest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"permissions": {
|
||||
"type": "object",
|
||||
"description": "Permission definitions",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/permission"
|
||||
}
|
||||
},
|
||||
"seed": {
|
||||
"type": "object",
|
||||
"description": "Seed data file references",
|
||||
"properties": {
|
||||
"styles": {
|
||||
"type": "string",
|
||||
"description": "Path to styles JSON file"
|
||||
},
|
||||
"types": {
|
||||
"type": "string",
|
||||
"description": "Path to types JSON file"
|
||||
},
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"description": "Path to entity schema file"
|
||||
}
|
||||
}
|
||||
},
|
||||
"storybook": {
|
||||
"type": "object",
|
||||
"description": "Storybook configuration",
|
||||
"properties": {
|
||||
"stories": {
|
||||
"type": "array",
|
||||
"description": "Story definitions",
|
||||
"items": {
|
||||
"$ref": "#/definitions/story"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"runtime": {
|
||||
"type": "object",
|
||||
"description": "Runtime configuration",
|
||||
"properties": {
|
||||
"scripts": {
|
||||
"type": "array",
|
||||
"description": "Script files to load",
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"main": {
|
||||
"type": "string",
|
||||
"description": "Main entry script file"
|
||||
},
|
||||
"executor": {
|
||||
"type": "object",
|
||||
"description": "Script executor paths",
|
||||
"properties": {
|
||||
"lua": { "type": "string" },
|
||||
"javascript": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"permission": {
|
||||
"type": "object",
|
||||
"required": ["minLevel", "description"],
|
||||
"properties": {
|
||||
"minLevel": {
|
||||
"type": "integer",
|
||||
"description": "Minimum level required",
|
||||
"minimum": 0,
|
||||
"maximum": 6
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Permission description"
|
||||
},
|
||||
"storybook": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"stories": {
|
||||
"type": "array",
|
||||
"items": { "type": "object" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameterizedTest": {
|
||||
"type": "object",
|
||||
"required": ["logic", "parameters"],
|
||||
"properties": {
|
||||
"logic": {
|
||||
"type": "string",
|
||||
"description": "Path to test logic file"
|
||||
},
|
||||
"parameters": {
|
||||
"type": "string",
|
||||
"description": "Path to test parameters file"
|
||||
}
|
||||
}
|
||||
},
|
||||
"story": {
|
||||
"type": "object",
|
||||
"required": ["name", "type"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Story display name"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Story type",
|
||||
"enum": ["function", "component"]
|
||||
},
|
||||
"function": {
|
||||
"type": "string",
|
||||
"description": "Function name (for function stories)"
|
||||
},
|
||||
"component": {
|
||||
"type": "string",
|
||||
"description": "Component name (for component stories)"
|
||||
},
|
||||
"args": {
|
||||
"type": "array",
|
||||
"description": "Function arguments"
|
||||
},
|
||||
"props": {
|
||||
"type": "object",
|
||||
"description": "Component props"
|
||||
},
|
||||
"argControls": {
|
||||
"type": "object",
|
||||
"description": "Storybook controls for arguments",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/control"
|
||||
}
|
||||
},
|
||||
"propControls": {
|
||||
"type": "object",
|
||||
"description": "Storybook controls for props",
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/control"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"control": {
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": ["number", "string", "boolean", "select", "object", "array"]
|
||||
},
|
||||
"default": {
|
||||
"description": "Default value"
|
||||
},
|
||||
"min": {
|
||||
"type": "number",
|
||||
"description": "Minimum value (for number)"
|
||||
},
|
||||
"max": {
|
||||
"type": "number",
|
||||
"description": "Maximum value (for number)"
|
||||
},
|
||||
"step": {
|
||||
"type": "number",
|
||||
"description": "Step value (for number)"
|
||||
},
|
||||
"options": {
|
||||
"type": "array",
|
||||
"description": "Options (for select)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
199
packages/json_script_example/seed/styles.schema.json
Normal file
199
packages/json_script_example/seed/styles.schema.json
Normal file
@@ -0,0 +1,199 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://metabuilder.dev/schemas/package-styles.schema.json",
|
||||
"title": "Package Styles",
|
||||
"description": "Design tokens and style definitions for MetaBuilder packages",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"description": "JSON Schema reference"
|
||||
},
|
||||
"colors": {
|
||||
"type": "object",
|
||||
"description": "Color palette definitions",
|
||||
"properties": {
|
||||
"primary": {
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"secondary": {
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"success": {
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"error": {
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"warning": {
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"info": {
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"background": {
|
||||
"$ref": "#/definitions/color"
|
||||
},
|
||||
"text": {
|
||||
"$ref": "#/definitions/color"
|
||||
}
|
||||
},
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/color"
|
||||
}
|
||||
},
|
||||
"spacing": {
|
||||
"type": "object",
|
||||
"description": "Spacing scale definitions",
|
||||
"properties": {
|
||||
"xs": { "$ref": "#/definitions/size" },
|
||||
"sm": { "$ref": "#/definitions/size" },
|
||||
"md": { "$ref": "#/definitions/size" },
|
||||
"lg": { "$ref": "#/definitions/size" },
|
||||
"xl": { "$ref": "#/definitions/size" },
|
||||
"xxl": { "$ref": "#/definitions/size" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/size"
|
||||
}
|
||||
},
|
||||
"typography": {
|
||||
"type": "object",
|
||||
"description": "Typography definitions",
|
||||
"properties": {
|
||||
"fontFamily": {
|
||||
"type": "string",
|
||||
"description": "Default font family stack"
|
||||
},
|
||||
"fontFamilyMono": {
|
||||
"type": "string",
|
||||
"description": "Monospace font family stack"
|
||||
},
|
||||
"fontFamilyHeading": {
|
||||
"type": "string",
|
||||
"description": "Heading font family stack"
|
||||
},
|
||||
"fontSize": {
|
||||
"type": "object",
|
||||
"description": "Font size scale",
|
||||
"properties": {
|
||||
"small": { "$ref": "#/definitions/size" },
|
||||
"medium": { "$ref": "#/definitions/size" },
|
||||
"large": { "$ref": "#/definitions/size" },
|
||||
"xlarge": { "$ref": "#/definitions/size" },
|
||||
"xxlarge": { "$ref": "#/definitions/size" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/size"
|
||||
}
|
||||
},
|
||||
"fontWeight": {
|
||||
"type": "object",
|
||||
"description": "Font weight scale",
|
||||
"properties": {
|
||||
"light": { "type": "integer" },
|
||||
"normal": { "type": "integer" },
|
||||
"medium": { "type": "integer" },
|
||||
"semibold": { "type": "integer" },
|
||||
"bold": { "type": "integer" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"lineHeight": {
|
||||
"type": "object",
|
||||
"description": "Line height scale",
|
||||
"properties": {
|
||||
"tight": { "type": "number" },
|
||||
"normal": { "type": "number" },
|
||||
"relaxed": { "type": "number" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"borderRadius": {
|
||||
"type": "object",
|
||||
"description": "Border radius scale",
|
||||
"properties": {
|
||||
"none": { "$ref": "#/definitions/size" },
|
||||
"small": { "$ref": "#/definitions/size" },
|
||||
"medium": { "$ref": "#/definitions/size" },
|
||||
"large": { "$ref": "#/definitions/size" },
|
||||
"full": { "$ref": "#/definitions/size" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/size"
|
||||
}
|
||||
},
|
||||
"shadows": {
|
||||
"type": "object",
|
||||
"description": "Box shadow definitions",
|
||||
"properties": {
|
||||
"none": { "type": "string" },
|
||||
"small": { "type": "string" },
|
||||
"medium": { "type": "string" },
|
||||
"large": { "type": "string" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"breakpoints": {
|
||||
"type": "object",
|
||||
"description": "Responsive breakpoints",
|
||||
"properties": {
|
||||
"xs": { "$ref": "#/definitions/size" },
|
||||
"sm": { "$ref": "#/definitions/size" },
|
||||
"md": { "$ref": "#/definitions/size" },
|
||||
"lg": { "$ref": "#/definitions/size" },
|
||||
"xl": { "$ref": "#/definitions/size" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"$ref": "#/definitions/size"
|
||||
}
|
||||
},
|
||||
"transitions": {
|
||||
"type": "object",
|
||||
"description": "Transition timing definitions",
|
||||
"properties": {
|
||||
"fast": { "type": "string" },
|
||||
"normal": { "type": "string" },
|
||||
"slow": { "type": "string" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"zIndex": {
|
||||
"type": "object",
|
||||
"description": "Z-index scale",
|
||||
"properties": {
|
||||
"base": { "type": "integer" },
|
||||
"dropdown": { "type": "integer" },
|
||||
"sticky": { "type": "integer" },
|
||||
"modal": { "type": "integer" },
|
||||
"popover": { "type": "integer" },
|
||||
"tooltip": { "type": "integer" }
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"color": {
|
||||
"type": "string",
|
||||
"description": "CSS color value",
|
||||
"pattern": "^(#[0-9A-Fa-f]{3,8}|rgb\\(|rgba\\(|hsl\\(|hsla\\(|var\\(--)"
|
||||
},
|
||||
"size": {
|
||||
"type": "string",
|
||||
"description": "CSS size value (px, rem, em, %, etc.)",
|
||||
"pattern": "^(-?\\d+(\\.\\d+)?(px|rem|em|%|vh|vw|ch|ex)?|0)$"
|
||||
}
|
||||
}
|
||||
}
|
||||
249
packages/json_script_example/seed/validation.schema.json
Normal file
249
packages/json_script_example/seed/validation.schema.json
Normal file
@@ -0,0 +1,249 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://metabuilder.dev/schemas/json-script-validation.schema.json",
|
||||
"title": "JSON Script Validation Functions",
|
||||
"description": "Validation utility function definitions for JSON scripts",
|
||||
"type": "object",
|
||||
"required": ["schema_version", "package"],
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"description": "JSON Schema reference"
|
||||
},
|
||||
"schema_version": {
|
||||
"type": "string",
|
||||
"description": "Schema version",
|
||||
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
||||
},
|
||||
"package": {
|
||||
"type": "string",
|
||||
"description": "Package identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Validation module description"
|
||||
},
|
||||
"imports": {
|
||||
"type": "array",
|
||||
"description": "Module imports",
|
||||
"items": {
|
||||
"$ref": "#/definitions/import"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
"type": "object",
|
||||
"description": "Exported validation functions",
|
||||
"properties": {
|
||||
"functions": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"functions": {
|
||||
"type": "array",
|
||||
"description": "Validation function definitions",
|
||||
"items": {
|
||||
"$ref": "#/definitions/validationFunction"
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"import": {
|
||||
"type": "object",
|
||||
"required": ["from", "import"],
|
||||
"properties": {
|
||||
"from": {
|
||||
"type": "string",
|
||||
"description": "Module to import from"
|
||||
},
|
||||
"import": {
|
||||
"type": "array",
|
||||
"description": "Items to import",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"validationFunction": {
|
||||
"type": "object",
|
||||
"required": ["id", "name", "params", "returnType", "body"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"description": "Unique function identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Function name (camelCase)"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Function description"
|
||||
},
|
||||
"exported": {
|
||||
"type": "boolean",
|
||||
"description": "Whether function is exported",
|
||||
"default": false
|
||||
},
|
||||
"docstring": {
|
||||
"$ref": "#/definitions/docstring"
|
||||
},
|
||||
"params": {
|
||||
"type": "array",
|
||||
"description": "Function parameters",
|
||||
"items": {
|
||||
"$ref": "#/definitions/param"
|
||||
}
|
||||
},
|
||||
"returnType": {
|
||||
"type": "string",
|
||||
"description": "Return type",
|
||||
"enum": ["boolean", "string", "number", "object", "array", "void", "ValidationResult"]
|
||||
},
|
||||
"body": {
|
||||
"type": "array",
|
||||
"description": "Function body statements",
|
||||
"items": {
|
||||
"$ref": "#/definitions/statement"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"param": {
|
||||
"type": "object",
|
||||
"required": ["name", "type"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Parameter name"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Parameter type",
|
||||
"enum": ["string", "number", "boolean", "object", "array", "any"]
|
||||
},
|
||||
"optional": {
|
||||
"type": "boolean",
|
||||
"description": "Whether parameter is optional",
|
||||
"default": false
|
||||
},
|
||||
"default": {
|
||||
"description": "Default value"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Parameter description"
|
||||
}
|
||||
}
|
||||
},
|
||||
"statement": {
|
||||
"type": "object",
|
||||
"required": ["type"],
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"description": "Statement type",
|
||||
"enum": [
|
||||
"comment",
|
||||
"const_declaration",
|
||||
"let_declaration",
|
||||
"assignment",
|
||||
"if",
|
||||
"return",
|
||||
"call_expression",
|
||||
"throw"
|
||||
]
|
||||
},
|
||||
"text": {
|
||||
"type": "string",
|
||||
"description": "Comment text (for comment type)"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Variable name (for declarations)"
|
||||
},
|
||||
"value": {
|
||||
"description": "Value or expression"
|
||||
},
|
||||
"condition": {
|
||||
"description": "Condition expression (for if)"
|
||||
},
|
||||
"then": {
|
||||
"type": "array",
|
||||
"description": "Then branch statements",
|
||||
"items": { "$ref": "#/definitions/statement" }
|
||||
},
|
||||
"else": {
|
||||
"type": "array",
|
||||
"description": "Else branch statements",
|
||||
"items": { "$ref": "#/definitions/statement" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"docstring": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"summary": {
|
||||
"type": "string",
|
||||
"description": "Brief summary"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Detailed description"
|
||||
},
|
||||
"params": {
|
||||
"type": "array",
|
||||
"description": "Parameter documentation",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": { "type": "string" },
|
||||
"type": { "type": "string" },
|
||||
"description": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"returns": {
|
||||
"type": "object",
|
||||
"description": "Return value documentation",
|
||||
"properties": {
|
||||
"type": { "type": "string" },
|
||||
"description": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"examples": {
|
||||
"type": "array",
|
||||
"description": "Usage examples",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": { "type": "string" },
|
||||
"code": { "type": "string" },
|
||||
"output": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"throws": {
|
||||
"type": "array",
|
||||
"description": "Exception documentation",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": { "type": "string" },
|
||||
"description": { "type": "string" }
|
||||
}
|
||||
}
|
||||
},
|
||||
"since": {
|
||||
"type": "string",
|
||||
"description": "Version when added"
|
||||
},
|
||||
"see": {
|
||||
"type": "array",
|
||||
"description": "Related references",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user