schema

package
v1.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package schema provides embedded PromptPack schema for offline validation.

Index

Constants

View Source
const DefaultSchemaURL = "https://promptpack.org/schema/latest/promptpack.schema.json"

DefaultSchemaURL is the canonical URL for the PromptPack schema.

View Source
const SchemaSourceEnvVar = "PROMPTKIT_SCHEMA_SOURCE"

SchemaSourceEnvVar is the environment variable to override schema source. Values: "local" (embedded), "remote" (fetch from URL), or a file path.

Variables

This section is empty.

Functions

func ExtractSchemaURL

func ExtractSchemaURL(packJSON []byte) string

ExtractSchemaURL extracts the $schema URL from pack JSON data. Returns empty string if not present or invalid.

func GetEmbeddedSchema

func GetEmbeddedSchema() string

GetEmbeddedSchema returns the embedded schema as a string.

func GetEmbeddedSchemaVersion

func GetEmbeddedSchemaVersion() (string, error)

GetEmbeddedSchemaVersion returns the version from the embedded schema.

func GetSchemaLoader

func GetSchemaLoader(packSchemaURL string) (gojsonschema.JSONLoader, error)

GetSchemaLoader returns a gojsonschema loader for the PromptPack schema. Priority:

  1. If PROMPTKIT_SCHEMA_SOURCE is set to "local", use embedded schema
  2. If PROMPTKIT_SCHEMA_SOURCE is a file path, load from that file
  3. If PROMPTKIT_SCHEMA_SOURCE is "remote" and packSchemaURL is provided, fetch from that URL
  4. Otherwise, use embedded schema (default for offline support)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL