Welcome to DataSentinel! This guide will help you get up and running quickly.
DataSentinel is an agentic framework that automatically generates validation, testing, and documentation suites from API specifications. It eliminates manual coding by transforming API specs into production-ready code.
- 🚀 Zero Manual Coding - From API spec to production-ready validation service
- 🔄 Three Input Formats - OpenAPI/Swagger, GraphQL, or JSON samples
- 🛡️ Automatic Validation - Pydantic v2 models with comprehensive validators
- 🧪 Test Generation - Complete pytest suite with factories
- 📦 FastAPI App - Ready-to-deploy validation API
- 🐳 Docker Ready - Multi-stage Dockerfile included
- 📚 Auto Documentation - Markdown data dictionaries
- Python 3.9 or higher
- pip (Python package manager)
- Git (optional, for cloning)
# Clone the repository
git clone https://github.com/yourusername/datasentinel.git
cd datasentinel
# Create a virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install development dependencies (optional)
pip install -r requirements-dev.txtpython auto_sentinel.py --versionYou should see: DataSentinel 1.0.0
The simplest way to get started is with a JSON endpoint:
python auto_sentinel.py \
--api https://jsonplaceholder.typicode.com/users \
--output ./my-first-projectThis will:
- Fetch the JSON response
- Infer data types and structure
- Generate all artifacts in
./my-first-project/
If you have an OpenAPI/Swagger specification:
python auto_sentinel.py \
--api ./specs/openapi.yaml \
--output ./my-api-validatorFor GraphQL APIs with introspection enabled:
python auto_sentinel.py \
--api https://api.example.com/graphql \
--format graphql \
--output ./graphql-validatorpython auto_sentinel.py --api <SOURCE> [OPTIONS]--api- API source (URL, file path, or endpoint)
--output/-o- Output directory (default:./generated)--format/-f- Input format:json,openapi, orgraphql(auto-detected if not specified)--verbose/-v- Enable verbose logging--dry-run- Show what would be generated without creating files
# API Key authentication
python auto_sentinel.py \
--api https://api.example.com/data \
--auth-type api-key \
--auth-token YOUR_API_KEY
# Bearer token authentication
python auto_sentinel.py \
--api https://api.example.com/data \
--auth-type bearer \
--auth-token YOUR_BEARER_TOKEN
# Basic authentication
python auto_sentinel.py \
--api https://api.example.com/data \
--auth-type basic \
--auth-username user \
--auth-token passwordSkip specific generators:
python auto_sentinel.py \
--api ./spec.yaml \
--skip-tests \
--skip-dockerAvailable skip options:
--skip-models- Skip Pydantic models--skip-validators- Skip validators--skip-tests- Skip test suite--skip-app- Skip FastAPI app--skip-docs- Skip documentation--skip-docker- Skip Dockerfile
Let's create a complete validation service from scratch!
# Using a sample JSON endpoint
python auto_sentinel.py \
--api https://jsonplaceholder.typicode.com/users \
--output ./user-validator \
--verbosecd user-validator
ls -laYou should see:
models.py # Pydantic v2 models
validators.py # Validation logic with retry
test_api.py # Pytest test suite
app.py # FastAPI application
data_dict.md # Documentation
Dockerfile # Docker configuration
.dockerignore # Docker ignore file
# Create a virtual environment
python -m venv venv
source venv/bin/activate
# Install required packages
pip install fastapi uvicorn pydantic httpx pytestpytest test_api.py -vuvicorn app:app --reloadVisit http://localhost:8000/docs to see the interactive API documentation!
# Validate data
curl -X POST http://localhost:8000/validate \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"name": "John Doe",
"email": "john@example.com"
}'docker build -t user-validator .
docker run -p 8000:8000 user-validator- 📖 Input Formats Guide - Detailed guide for each input type
- 🎯 Generated Artifacts - Understanding generated code
- 🚀 Deployment Guide - Deploy to production
- 📚 API Reference - Complete API documentation
Check out the examples/ directory for:
- OpenAPI/Swagger examples
- GraphQL examples
- JSON inference examples
- Schema Drift Detection - Automatically detect API changes
- Batch Validation - Validate multiple records efficiently
- Custom Validators - Extend generated validators
- CI/CD Integration - Automate validation in pipelines
- 📝 GitHub Issues
- 💬 Discussions
- 📧 Email: support@datasentinel.dev
Problem: ModuleNotFoundError: No module named 'pydantic'
Solution:
pip install -r requirements.txtProblem: PermissionError: [Errno 13] Permission denied
Solution:
# Ensure output directory is writable
chmod +w ./output-directoryProblem: 401 Unauthorized
Solution:
# Verify your authentication credentials
python auto_sentinel.py \
--api https://api.example.com/data \
--auth-type bearer \
--auth-token YOUR_VALID_TOKEN \
--verboseProblem: Generated Python code has syntax errors
Solution:
- Ensure you're using Python 3.9+
- Update dependencies:
pip install --upgrade -r requirements.txt - Report the issue with your input specification
Before generating files, preview what will be created:
python auto_sentinel.py --api ./spec.yaml --dry-runAdd generated code to version control to track changes:
git add generated/
git commit -m "Add generated validation code"Generated code is meant to be customized:
- Add business logic to validators
- Extend models with computed fields
- Add custom endpoints to the FastAPI app
Regenerate code when your API specification changes:
python auto_sentinel.py --api ./updated-spec.yaml --output ./validatorStore sensitive data in environment variables:
export API_TOKEN="your-secret-token"
python auto_sentinel.py \
--api https://api.example.com/data \
--auth-type bearer \
--auth-token $API_TOKENNow that you have DataSentinel running, explore:
- Input Formats - Learn about supported input formats
- Generated Artifacts - Understand the generated code
- Deployment - Deploy your validation service
- API Reference - Dive into the API details
Happy validating! 🎉