Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

JSON Schema Inference

schema.infer_json_schema

ProductionHeuristic (Class C)Deterministicbest-effortfastv1.0.0
File inputNo network

Overview

You send one or more example JSON documents and we read their structure to write a conservative JSON Schema in the 2020-12 dialect. A field counts as required when it appears in every example, and a field that holds different types across examples gets a union type plus a warning so you can decide what you actually meant. We stay deliberately plain: no conditionals, no oneOf, no $ref. Use the result as a first draft to review, not as a finished contract. Accepts file input via file_ref — no need to extract file content first.

Writing a schema by hand from a folder of sample payloads is slow, and it is easy to miss the one field that is sometimes a string and sometimes a number. You get a faithful first draft, and the disagreements are called out rather than smoothed over.

Reliability

Best-effort by design, and repeatable: the same examples in the same order always give the same schema, but the schema only reflects the documents you sent. A whole number becomes integer unless some sibling value is fractional, in which case the field becomes number. If an example is not valid JSON we return the recoverable failure JSON_MALFORMED, which you can clear by repairing the text with schema.repair_json and calling again with the same options. We reject the call outright, and an unchanged retry will not help, when neither examples nor examples_file_ref is present, when the array is empty or holds anything other than strings, when there are more than 100 examples or more than 2097152 bytes of them, or when a referenced file is missing, unreadable, or too large.

Context footprint

Inline examples and a referenced file are both capped at 2097152 bytes; the response carries one schema, so it stays far smaller than the input. A successful call costs 1 execution credit.

When to use it

When you have real payloads and want a schema to review, document, or tighten up before you enforce it.

When the schema already exists and you want documents checked against it, or when the contract needs conditional branches only a human can decide.

Scope

Note
We read the structure of your example documents and write a plain 2020-12 JSON Schema: types, properties, required fields, and warnings where the examples disagree.

Non-goals

  • We never check a document against a schema — that is schema.validate_json
  • We never invent constraints you cannot see in the examples, such as formats or ranges
  • We never write conditionals, oneOf, or $ref; you add those yourself

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

analysisgeneration

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input2 MBMax file size2 MB

File limits

Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.

LimitValueLimited by
Maximum size per input file2 MiBSkill and platform maximum

How we handle your data

Sensitive output possible
What this means

This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.

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.
  • Output may reveal sensitive derived information
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.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
examplesarrayNoExample documents, 1 through 100 JSON strings totalling at most 2097152 bytes. Required unless examples_file_ref is provided.
examples_file_refstringNoTenant-owned examples file; a top-level array becomes one example per element. Omit it to read examples. When both are sent this one wins.
draftstringNoAccepted and currently ignored; omit it. The inferred schema always declares 2020-12.
requiredPolicystringNopresent_in_all marks fields seen in every sibling object; none leaves required out. Omit it for present_in_all.
additionalPropertiesPolicystringNofalse closes every object; true leaves additionalProperties out. Omit it for true.
maxDepthintegerNoHow many nesting levels to describe; omit it for 20. Zero or negative falls back to 20.

Output schema

FieldTypeRequiredDescription
schemaobjectYesInferred JSON Schema opening with $schema and type, plus properties, optional required and additionalProperties, with at most 4096 keys. — unconstrained RFC 8259 JSON items.
examplesAnalyzedintegerYesHow many example documents were parsed, from 1 through 100.
warningsarrayYesNon-fatal advisory notices as 0 through 256 strings, each one sentence long; empty when nothing was worth flagging.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"schema.infer_json_schema","input":{"examples":["{\"name\":\"Alice\",\"age\":30}","{\"name\":\"Bob\",\"age\":25}"]}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("schema.infer_json_schema", {"examples":["{\"name\":\"Alice\",\"age\":30,\"email\":\"[email protected]\"}","{\"name\":\"Bob\",\"age\":25}"]});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
JSON_MALFORMED400NoThe request payload failed this skill's input validation.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • We never check a document against a schema — that is schema.validate_json
  • We never invent constraints you cannot see in the examples, such as formats or ranges
  • We never write conditionals, oneOf, or $ref; you add those yourself
  • Checking documents against a schema you already have (schema.validate_json)
  • Writing schemas with conditional or polymorphic branches
  • Comparing two schema versions (schema.diff_json_schema)

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "schema.infer_json_schema",
  "input": {
    "examples": [
      "{\"name\":\"Alice\",\"age\":30,\"email\":\"[email protected]\"}",
      "{\"name\":\"Bob\",\"age\":25}"
    ]
  }
}

Examples

Infer from user objects

Inputjson
{
  "examples": [
    "{\"name\":\"Alice\",\"age\":30,\"email\":\"[email protected]\"}",
    "{\"name\":\"Bob\",\"age\":25}"
  ]
}
Expected outputjson
{
  "schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "required": [
      "name",
      "age"
    ],
    "type": "object",
    "properties": {
      "name": {
        "type": "string"
      },
      "email": {
        "type": "string"
      },
      "age": {
        "type": "integer"
      }
    }
  },
  "warnings": [],
  "examplesAnalyzed": 2
}
Tip
email is optional because it appears in only one example

Mixed types produce warning

Inputjson
{
  "examples": [
    "{\"value\":\"hello\"}",
    "{\"value\":42}"
  ]
}
Expected outputjson
{
  "schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "required": [
      "value"
    ],
    "type": "object",
    "properties": {
      "value": {
        "type": [
          "string",
          "integer"
        ]
      }
    }
  },
  "warnings": [
    "Mixed types detected: [string, integer]"
  ],
  "examplesAnalyzed": 2
}
  • Start an API contract from payloads you already have
  • Describe the shape of JSON coming out of a log or an export you did not design
  • Spot fields whose type is inconsistent across real-world samples

Avoid for

  • Checking documents against a schema you already have (schema.validate_json)
  • Writing schemas with conditional or polymorphic branches
  • Comparing two schema versions (schema.diff_json_schema)

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.

Tags

jsonanalysisgeneration