A Python package for validating chatfic-format data
Project description
Chatfic Validator
Description
The Chatfic Validator is a Python package for validating chatfic data. It checks the format and structure of chatfic data to ensure it conforms to the specified schema.
Installation
To install the Chatfic Validator, you can use pip:
pip install chatfic-validator
Usage
Here's an example of how to use the Chatfic Validator:
from chatfic_validator import ChatficValidator as validator
# Load the chatfic data from a file
with open('storybasic.json', 'r', encoding="utf-8") as file:
json_text = file.read()
# Validate the chatfic data
result = validator.validate_json_text(
json_text=json_text,
chatfic_format=ChatficFormat.BASIC_JSON,
multimedia_list=["time.jpeg"]
)
# Check if the validation was successful
if result.is_valid:
print("Chatfic data is valid!")
else:
print("Chatfic data is invalid.")
for error in result.errors:
print(error)
for warning in result.warnings:
print(warning)
ChatficFormat
enums: BASIC_JSON and COMPILED_JSON. These represent the storybasic.json and story.json file contents, respectively.
The multimedia_list
parameter takes a list of the multimedia files that are expected to referenced within the story data.
validate_json_text
method returns a ChatficValidationResult
instance with 3 attributes:
is_valid:bool
errors: List[ChatficValidationError]
warnings: List[str]
validate_json_text
method loads json text and runs validate_dict
method. This second method can be used directly with the same parameters (chatfic_format and multimedia_list)
More information about the chatfic-format can be found here:
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 Distribution
File details
Details for the file chatfic_validator-0.2.1.tar.gz
.
File metadata
- Download URL: chatfic_validator-0.2.1.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1325389eb9e02d43ba62ef5ed27ef3482f8bcda7934b041a003a3c36b234cc7 |
|
MD5 | 0e273de857b23199cd709709373c3a8a |
|
BLAKE2b-256 | c49252e5153edff7b015680ede293e0c206eaf06ce73281197a3ce18017e1ca1 |
File details
Details for the file chatfic_validator-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: chatfic_validator-0.2.1-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11b919d8cd6f28677f99e597528cbccf6b8d36016fc97448d283c0b6903200b5 |
|
MD5 | 021a7c72e078c1b632dfeb531e64e748 |
|
BLAKE2b-256 | 2a9b1b613e48477c9adab524d1a65a9cd3d3dde7257f0148785a693e847c45db |