datavalidator

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2025 License: MIT

README ΒΆ

DataValidator

Go Version Release CI Status Go Report Card License Go Reference

A blazing-fast, privacy-focused data format validator with zero dependencies

Features β€’ Installation β€’ Usage β€’ Live Demo β€’ Documentation

Overview

DataValidator is a high-performance, privacy-first validator for JSON, YAML, XML, and TOML. Built with Go, it processes all data locally with zero logging, zero tracking, and zero data retention. Your data never leaves your machine.

πŸš€ Quick Start
# Install
go install github.com/akhilesharora/datavalidator/cmd/datavalidator@latest

# Validate a file
datavalidator validate config.json

# Start web interface
datavalidator web

🌐 Try it online: https://freedatavalidator.xyz

Features

  • πŸ”’ 100% Private - No data ever leaves your machine
  • ⚑ Lightning Fast - Built in Go for maximum performance
  • 🎯 Multi-Format - JSON, YAML, XML, and TOML support
  • πŸ” Auto-Detection - Automatically identifies data formats
  • πŸ“¦ Zero Dependencies - No external runtime dependencies
  • 🌍 Cross-Platform - Works on Linux, macOS, and Windows
  • πŸ› οΈ Dual Mode - Use as CLI tool or Go library
  • 🌐 Web Interface - Built-in web UI for browser-based validation

Installation

Using Go
# As a CLI tool
go install github.com/akhilesharora/datavalidator/cmd/datavalidator@latest

# As a library
go get github.com/akhilesharora/datavalidator/pkg/validator
Pre-built Binaries

Download the latest binary for your platform from the releases page.

From Source
Linux/macOS
git clone https://github.com/akhilesharora/datavalidator
cd datavalidator
make build
Windows
git clone https://github.com/akhilesharora/datavalidator
cd datavalidator
go build -o datavalidator.exe ./cmd/datavalidator
Development Setup

For contributors, set up pre-commit hooks to ensure code quality:

# Install pre-commit hooks
make pre-commit

# Or manually
./scripts/setup-hooks.sh

This will install hooks that:

  • Format code automatically
  • Run tests before push
  • Check for linting issues
  • Prevent commits with formatting errors

Usage

Command Line Interface
# Validate a single file
datavalidator validate config.json

# Validate multiple files
datavalidator validate config.json data.yaml settings.toml

# Validate all files in a directory
datavalidator validate ./configs/

# Pipe data through stdin
echo '{"name": "test"}' | datavalidator validate

# Specify format explicitly
datavalidator validate --format json config.txt

# Output as JSON for CI/CD pipelines
datavalidator validate --json config.json

# Start web interface
datavalidator web --port 8080

# Windows examples
datavalidator.exe validate config.json
type config.json | datavalidator.exe validate
Go Library
package main

import (
    "fmt"
    "log"
    
    "github.com/akhilesharora/datavalidator/pkg/validator"
)

func main() {
    // Auto-detect format
    data := []byte(`{"name": "John", "age": 30}`)
    result := validator.ValidateAuto(data)
    
    if result.Valid {
        fmt.Printf("Valid %s data\n", result.Format)
    } else {
        log.Fatalf("Invalid data: %s", result.Error)
    }
    
    // Validate specific format
    v, _ := validator.NewValidator(validator.FormatJSON)
    result = v.ValidateString(`{"test": true}`)
    fmt.Printf("Valid: %v\n", result.Valid)
}
Web Interface

Start the built-in web server:

datavalidator web
# Server starts at http://localhost:8080

The web interface provides:

  • Real-time validation as you type
  • Format auto-detection
  • Syntax error highlighting
  • One-click formatting
  • 100% client-side processing

Supported Formats

Format Extensions Auto-Detection Description
JSON .json βœ… JavaScript Object Notation
YAML .yaml, .yml βœ… YAML Ain't Markup Language
XML .xml βœ… Extensible Markup Language
TOML .toml βœ… Tom's Obvious, Minimal Language

Privacy & Security

DataValidator is designed with privacy as the core principle:

  • No Network Calls - The tool works completely offline
  • No Data Storage - No temporary files, logs, or caches
  • No Tracking - Zero analytics, telemetry, or usage tracking
  • Memory Only - Data is processed in memory and immediately discarded
  • Open Source - Full source code available for security audits

Performance

DataValidator is optimized for speed:

  • Written in Go for native performance
  • Zero-allocation design for common operations
  • Streaming support for large files
  • Minimal memory footprint
  • No external dependencies

Use Cases

  • CI/CD Pipelines - Validate configs before deployment
  • Development - Quick validation during development
  • Data Processing - Pre-validate input files
  • API Testing - Validate API responses
  • Configuration Management - Ensure configs are well-formed

Contributing

We welcome contributions! Please see our Contributing Guidelines.

Development Setup
# Clone the repository
git clone https://github.com/akhilesharora/datavalidator
cd datavalidator

# Install dependencies
go mod download

# Run tests
make test

# Run linter
make lint

# Build binary
make build

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Built with ❀️ by Akhilesh Arora and contributors.


⬆ back to top

If you find this project useful, please consider giving it a ⭐

Directories ΒΆ

Path Synopsis
cmd
datavalidator command
Command datavalidator provides a CLI for validating JSON, YAML, XML, and TOML files.
Command datavalidator provides a CLI for validating JSON, YAML, XML, and TOML files.
pkg
validator
Package validator provides a privacy-focused data format validation library for Go.
Package validator provides a privacy-focused data format validation library for Go.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL