Skip to main content

GASP (Gee Another Schema Parser) - A validator for WAIL (Widely Applicable Interface Language) schemas and JSON

Project description

GASP - Gee Another Schema Parser

GASP (Gee Another Schema Parser) is a Python package for validating WAIL (Widely Applicable Interface Language) schemas and JSON data. GASP helps ensure your WAIL schemas are correctly formatted, all types are properly defined, and your JSON data conforms to the schema.

Installation

pip install gasp

Usage

WAIL Schema Validation

from gasp import WAILValidator

# Create a validator
validator = WAILValidator()

# Load a WAIL schema
wail_schema = '''
object Person {
    name: String
    age: Number
}

template GetPersonFromDescription(description: String) -> Person {
    prompt: """
    Given this description of a person: {{description}}
    Create a Person object with their name and age.
    Return in this format: {{return_type}}
    """
}
'''

validator.load_wail(wail_schema)

# Validate the schema
warnings, errors = validator.validate()

print("Validation Results:")
print("\nWarnings:")
for warning in warnings:
    print(f"- {warning}")

print("\nErrors:")
for error in errors:
    print(f"- {error}")

JSON Validation

# Load JSON to validate against the schema
json_data = '''
{
    "name": "John Doe",
    "age": 30
}
'''
validator.load_json(json_data)

# Validate both schema and JSON
warnings, errors = validator.validate()

Features

  • Validates WAIL schema syntax
  • Detects undefined types
  • Provides helpful warnings for potential typos
  • Validates type references in templates
  • Validates array types and their element types
  • Validates JSON data against WAIL schemas

Requirements

  • Python 3.7 or higher

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gasp_py-0.1.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gasp_py-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (235.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

gasp_py-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl (323.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

File details

Details for the file gasp_py-0.1.0.tar.gz.

File metadata

  • Download URL: gasp_py-0.1.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.0

File hashes

Hashes for gasp_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 96b7a83a69e37829529bb599126e35d8cb20a4e33ba6566f115f0ef68f6d9c87
MD5 9df758d6c45a85932965dfbe3257db8e
BLAKE2b-256 6a3d1ee39adb113a8e95c4f190a1ef25b1ed92d1c8a1a18bf8bcf4ee38f3cbdd

See more details on using hashes here.

File details

Details for the file gasp_py-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gasp_py-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1e71f0a020187907c894ddbbc8f6e06541c3c6c8b6ba1f8c1afa422eb3f5542c
MD5 45c58bdb30719c20466016285c87da09
BLAKE2b-256 b43bccac5bcbb619ef7d5979a5970abbbc7bd2572adab4a944e314852ea5365e

See more details on using hashes here.

File details

Details for the file gasp_py-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for gasp_py-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f43513ed055b8ad0b36c7eecf9876076b6e431bf0dd7345e5e30bd022927e66f
MD5 ccf22f0990ff0eafd41991ddd0d2c8b3
BLAKE2b-256 2b12b5ac1438032e897d54037f2c3343e76ae53cf603b09e3abed896bae64239

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page