Skip to main content

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, ChatficFormat

# 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:

https://gokhanmeteerturk.github.io/chatfic-format/

Metadata

Release files for chatfic-validator 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chatfic-validator 0.2.4
File Size Uploaded
chatfic_validator-0.2.4.tar.gz 23.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for chatfic-validator 0.2.4
File Interpreter ABI Platform
chatfic_validator-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 48.1 kB

Release files / chatfic_validator-0.2.4.tar.gz

Download URL chatfic_validator-0.2.4.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
582e7ff87c5d84f1e6bebccc7120a8345a9ce13c8a1a77ec6b9e5c9115e38b2c
BLAKE2b-256 checksum
How to use checksums
4edd2ce16b285e0140f0b9e180c21bedff71b134e558a9dfc0b3b06261097394
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.6

Release files / chatfic_validator-0.2.4-py3-none-any.whl

Download URL chatfic_validator-0.2.4-py3-none-any.whl
Size 24.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3df8aad2acaf8a2679847eb3f9d579aa4e330a55ef2e4e2518bf987cf3a29c88
BLAKE2b-256 checksum
How to use checksums
17e95b8dde1cd4a012058d8971cfee3b91d9ac693c507ac2fee56f9c93be798e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.6

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page