serdeval

module
v0.1.1 Latest Latest
Warning

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

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

README ΒΆ

SerdeVal

SerdeVal Banner Go Report Card Go Reference CI codecov Go Version License

A privacy-focused, blazingly fast data format validator for JSON, YAML, XML, and TOML. 100% offline with zero data retention.

πŸ”’ Privacy Guarantee: Your data never leaves your machine - no logging, no tracking, no retention.

🌐 Live Demo

freedatavalidator.xyz - Try it online (client-side validation)

πŸš€ Features

  • πŸ”’ Privacy-First: No logging, tracking, or data retention
  • ⚑ Blazingly Fast: Zero-dependency Go implementation
  • 🎯 Auto-Detection: Automatically detects data formats
  • πŸ“± Multiple Interfaces: CLI, Go library, and web interface
  • 🌐 Cross-Platform: Windows, macOS, and Linux support
  • 🧠 Smart Formatting: Beautifies and validates in one step
  • πŸ“Š Developer-Friendly: JSON output for CI/CD pipelines
Supported Formats
Format Extension Auto-Detection Validation Formatting
JSON .json βœ… βœ… βœ…
YAML .yaml, .yml βœ… βœ… βœ…
XML .xml βœ… βœ… βœ…
TOML .toml βœ… βœ… βœ…

πŸ“¦ Installation

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

# As a library
go get github.com/akhilesharora/serdeval/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/serdeval
cd serdeval
make build
Windows
git clone https://github.com/akhilesharora/serdeval
cd serdeval
go build -o serdeval.exe ./cmd/serdeval
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
Deployment

For server deployment, copy deploy.example.sh to deploy.sh and customize it with your specific configuration:

cp deploy.example.sh deploy.sh
# Edit deploy.sh with your server details

πŸ–₯️ Usage

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

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

# Validate from stdin
echo '{"name": "John", "age": 30}' | serdeval validate

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

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

# Start web interface
serdeval web --port 8080

# Check version
serdeval version

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

import (
    "fmt"
    "log"
    
    "github.com/akhilesharora/serdeval/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:

serdeval web --port 8080

Then visit http://localhost:8080 for a user-friendly interface with:

  • Real-time validation as you type
  • Auto-format with beautification
  • Copy-to-clipboard functionality
  • Format auto-detection
  • 100% client-side processing (your data never leaves your browser)

πŸ› οΈ Development

Prerequisites
  • Go 1.22 or higher
  • Make (optional, for convenience commands)
Building
# Build for current platform
make build

# Build for all platforms
make build-all

# Run tests
make test

# Run linters
make lint

# Format code
make fmt

# Run benchmarks
make bench
Testing
# Run all tests
go test ./...

# Run tests with coverage
go test -coverprofile=coverage.out ./...

# Run benchmarks
go test -bench=. ./...

🀝 Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

Quick Start for Contributors
  1. Fork the repository
  2. Set up development environment: make pre-commit
  3. Make your changes
  4. Run tests: make test
  5. Submit a pull request

Please read our Code of Conduct.

πŸ“„ License

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

πŸ™ Acknowledgments

  • Built with ❀️ for the developer community
  • Inspired by the need for privacy-focused validation tools
  • Thanks to all contributors who help improve this project

Visit SerdeVal | Documentation | Report Issues

Directories ΒΆ

Path Synopsis
cmd
serdeval command
Command serdeval provides a CLI for validating JSON, YAML, XML, and TOML files.
Command serdeval 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