Skip to main content

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:

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

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

chatfic_validator-0.2.2.tar.gz (23.7 kB view details)

Uploaded Source

Built Distribution

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

chatfic_validator-0.2.2-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file chatfic_validator-0.2.2.tar.gz.

File metadata

  • Download URL: chatfic_validator-0.2.2.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for chatfic_validator-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c709590dea3f84c43ec0a950b03484480308de7ee4d9175a8655fe1a9ecebb76
MD5 0d375b502fae79bbee57622e4128b93f
BLAKE2b-256 d52fba00b7410ed1cd1bd4ea05bd1fb98ebd3c266170d1806b18ee0e972a6c12

See more details on using hashes here.

File details

Details for the file chatfic_validator-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for chatfic_validator-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6117412258935388af6fd508006d940d0f2ae909e800427d49607a30519fe97f
MD5 6f2090e606549e2e87098be51bb49fb2
BLAKE2b-256 a05488c477ab249032bb2c2433c4a849d25b71f88b82ea5346f27d8f5d2d4d75

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