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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96b7a83a69e37829529bb599126e35d8cb20a4e33ba6566f115f0ef68f6d9c87
|
|
| MD5 |
9df758d6c45a85932965dfbe3257db8e
|
|
| BLAKE2b-256 |
6a3d1ee39adb113a8e95c4f190a1ef25b1ed92d1c8a1a18bf8bcf4ee38f3cbdd
|
File details
Details for the file gasp_py-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: gasp_py-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 235.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e71f0a020187907c894ddbbc8f6e06541c3c6c8b6ba1f8c1afa422eb3f5542c
|
|
| MD5 |
45c58bdb30719c20466016285c87da09
|
|
| BLAKE2b-256 |
b43bccac5bcbb619ef7d5979a5970abbbc7bd2572adab4a944e314852ea5365e
|
File details
Details for the file gasp_py-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: gasp_py-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 323.4 kB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f43513ed055b8ad0b36c7eecf9876076b6e431bf0dd7345e5e30bd022927e66f
|
|
| MD5 |
ccf22f0990ff0eafd41991ddd0d2c8b3
|
|
| BLAKE2b-256 |
2b12b5ac1438032e897d54037f2c3343e76ae53cf603b09e3abed896bae64239
|