Generate Test Cases from Schema
quality.generate_test_cases_from_schema
Overview
You send a JSON Schema and we build a payload that satisfies it, then a set of near-misses that each break one rule — a required property removed, a number pushed past its bound, a string made too long, the wrong type entirely. Every case is run through the same validator the platform uses before it reaches you, so a case labelled invalid really does fail and one labelled valid really does pass; anything we cannot confirm is dropped with a note rather than guessed at. The answer also tells you which keywords in your schema we could target and which we could not.
Writing the failing half of a test suite by hand is tedious and easy to get subtly wrong — a case meant to fail that quietly passes teaches you nothing.
Reliability
The same schema and the same options always give the same cases, in the same order, and nothing leaves the platform — a $ref that points at an address is refused rather than fetched. Two limits are worth planning around. Failing cases are built from the top level of your schema, so a constraint on a nested property shapes the passing payload but does not get a case of its own; coverage tells you which keywords were actually targeted. And pattern, oneOf, anyOf, allOf, not, if, then, and else are listed as unsupported rather than quietly skipped, so a schema built mostly from those yields few cases. Every case is checked against the real validator first, and one that does not behave as intended is dropped with a warning instead of shipped. Two failures stop the call, both needing a change from you rather than a retry: INVALID_JSON_SCHEMA means the schema will not compile, or the draft you named is not one we support, so the message points at the problem; REMOTE_REF_FORBIDDEN means a $ref starts with http, https, or a double slash, so inline that definition or move it into the same document.
Context footprint
Every case carries its whole payload, so the reply grows with maxCases and with how large one instance of your schema is; lower maxCases, or turn off the half you do not need, to keep it small. A successful call costs 1 execution credit.
When to use it
When a schema exists and you want a starting set of cases you can trust.
When you need full coverage guaranteed, or data that looks like real data.
Runs on the networknt JSON Schema validator, the same one the platform validates with, so a verdict here matches a verdict there.
Scope
Non-goals
- Does not claim the cases cover your schema exhaustively
- Does not fetch a $ref that points at an address
- Does not build cases for pattern or the combinator keywords
- Does not invent lifelike sample data — the payloads are minimal on purpose
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response does not contain submitted content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| schema | object | Yes | JSON Schema to generate cases from; extra keys are schema keywords and nested $ref must stay inside this document. — unconstrained RFC 8259 JSON items. |
| options | object | No | Closed generation controls; omit the object to include valid and invalid cases, cap at 100, use draft 2020-12, seed 42 and the boundaries strategy. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| cases | array | Yes | Generated cases in target-path then id order, 0 through 200 closed objects. |
| coverage | object | Yes | Closed coverage report with alphabetically sorted keywordsSeen, keywordsTargeted and keywordsUnsupported arrays. |
| warnings | array | Yes | Non-fatal advisory notices as 0 through 100 strings, each one sentence long; empty when nothing was worth flagging. |
| _meta | object | Yes | Closed bookkeeping echoing seed and strategy plus the generatorProfile that produced these cases. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"quality.generate_test_cases_from_schema","input":{"schema":{"type":"object","properties":{"name":{"type":"string"}},"required":["name"]}}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("quality.generate_test_cases_from_schema", {"schema":{"properties":{"name":{"type":"string"}},"type":"object","required":["name"]}});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| INVALID_JSON_SCHEMA | 400 | No | The request payload failed this skill's input validation. |
| REMOTE_REF_FORBIDDEN | 422 | No | The input was rejected as unsafe. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not claim the cases cover your schema exhaustively
- Does not fetch a $ref that points at an address
- Does not build cases for pattern or the combinator keywords
- Does not invent lifelike sample data — the payloads are minimal on purpose
- Proving a schema is fully covered
- Producing realistic-looking data for a demo or a fixture
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "quality.generate_test_cases_from_schema",
"input": {
"schema": {
"properties": {
"name": {
"type": "string"
}
},
"type": "object",
"required": [
"name"
]
}
}
}Examples
A small object schema, with the cases it earns
{
"schema": {
"properties": {
"name": {
"type": "string"
}
},
"type": "object",
"required": [
"name"
]
}
}{
"_meta": {
"seed": 42,
"generatorProfile": "json-schema-cases-1",
"strategy": "boundaries"
},
"warnings": [],
"coverage": {
"keywordsTargeted": [
"required",
"type"
],
"keywordsUnsupported": [],
"keywordsSeen": [
"properties",
"required",
"type"
]
},
"cases": [
{
"id": "valid_baseline",
"classification": "valid",
"targetKeyword": null,
"targetPath": "",
"instance": {
"name": "a"
},
"expected": {
"valid": true,
"errorKeywords": [],
"instancePath": ""
}
},
{
"id": "invalid_missing_required__name",
"classification": "invalid",
"targetKeyword": "required",
"targetPath": "/required",
"instance": {},
"expected": {
"valid": false,
"errorKeywords": [
"required"
],
"instancePath": ""
}
},
{
"id": "invalid_type",
"classification": "invalid",
"targetKeyword": "type",
"targetPath": "/type",
"instance": "not_object",
"expected": {
"valid": false,
"errorKeywords": [
"type"
],
"instancePath": ""
}
}
]
}Keeping only the failing cases, capped at five
{
"options": {
"maxCases": 5,
"includeValid": false
},
"schema": {
"properties": {
"name": {
"type": "string"
}
},
"type": "object",
"required": [
"name"
]
}
}{
"_meta": {
"seed": 42,
"generatorProfile": "json-schema-cases-1",
"strategy": "boundaries"
},
"warnings": [],
"coverage": {
"keywordsTargeted": [
"required",
"type"
],
"keywordsUnsupported": [],
"keywordsSeen": [
"properties",
"required",
"type"
]
},
"cases": [
{
"id": "invalid_missing_required__name",
"classification": "invalid",
"targetKeyword": "required",
"targetPath": "/required",
"instance": {},
"expected": {
"valid": false,
"errorKeywords": [
"required"
],
"instancePath": ""
}
},
{
"id": "invalid_type",
"classification": "invalid",
"targetKeyword": "type",
"targetPath": "/type",
"instance": "not_object",
"expected": {
"valid": false,
"errorKeywords": [
"type"
],
"instancePath": ""
}
}
]
}Recommended use cases
- Start a contract test suite from a schema you already publish
- Get the boundary cases nobody remembers to write by hand
- Check that your own validator agrees about what should fail
Avoid for
- Proving a schema is fully covered
- Producing realistic-looking data for a demo or a fixture
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.