Skip to content

scrimbles/handroll

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

handroll

A spec-driven test data generator in Common Lisp. No hardcoded structs. No maintenance.

Point it at an OpenAPI spec, tell it what schema you want, and it generates structurally valid JSON test data. When the API changes, handroll changes with it.

Usage

# List available schemas
handroll api.json --list

# Generate a single instance
handroll api.json Order

# Generate multiple instances
handroll api.json Order -n 5

# Works with URLs too
handroll https://petstore3.swagger.io/api/v3/openapi.json Pet -n 3

# Pin specific fields (dot notation for nested)
handroll api.json Order -s status=pending
handroll api.json Pet -s name=Grendel -s category.name=familiar

# Compact output (no indentation)
handroll api.json Order -c

# Control recursion depth and array length
handroll api.json Order -d 5 -a 2

How It Works

  1. Loads an OpenAPI 3.x (or Swagger 2.x) spec
  2. Resolves $ref, allOf, oneOf, anyOf compositions
  3. Walks the schema tree and generates data based on types, formats, enums, and constraints
  4. Outputs valid JSON

Format-Aware Generation

When schemas specify formats, handroll generates appropriate data:

FormatExample Output
uuida3f7b2c1-4d8e-4f9a-b2c1-d8e4f9a3f7b2
date2024-03-15
date-time2024-03-15T14:30:00Z
emaildelta.foxtrot@example.com
urihttps://example.com/bravo/4521
ipv4192.168.42.7
hostnamealpha.example.com

Enums are respected — if a field has "enum": ["placed", "approved", "delivered"], handroll picks from those values.

Install

Requires Roswell:

brew install roswell  # macOS
ros setup
ros install yason dexador cl-ppcre alexandria

# Then either run directly:
ros handroll.ros <spec> <schema>

# Or install as a command:
ros install handroll.ros
handroll <spec> <schema>

Sister Project

beer-me — template query management for debugging. handroll generates the mess, beer-me helps you investigate it.

License

GPL-3.0

About

A CLI for generating API payloads

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors