Developer ToolsFree generatorPDF, Excel, Word export

JSON Schema Generator for ERP Records

Most bad ERP integrations fail on data shape: a wrong unit of measure, a part number with a stray space, a cost sent as text. A JSON Schema catches these before a record reaches the ERP. This generator builds one for an item master style record.

Fill in

Generated code
Download:

JSON Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/schemas/item.json",
  "title": "Item master record",
  "type": "object",
  "properties": {
    "itemNumber": { "type": "string", "pattern": "^[A-Z0-9-]{3,30}$" },
    "description": { "type": "string", "maxLength": 60 },
    "uom": { "enum": ["EA", "KG", "M", "L"] },
    "itemType": { "enum": ["make", "buy", "phantom"] },
    "unitCost": { "type": "number", "minimum": 0, "maximum": 1000000 },
    "leadTimeDays": { "type": "integer", "minimum": 0, "maximum": 365 },
    "lotTracked": { "type": "boolean", "default": false },
    "effectiveDate": { "type": "string", "format": "date" },
    "suppliers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "supplierId": { "type": "string" },
          "leadTimeDays": { "type": "integer", "minimum": 0 }
        },
        "required": ["supplierId"]
      }
    }
  },
  "required": ["itemNumber", "description", "uom", "itemType"],
  "additionalProperties": false
}

Field names are generic examples, not the columns of any specific ERP. Map them to your entity. JSON Schema validates shape only: business rules such as valid supplier ids or open periods still need checks against the ERP.

Check my ERP data contracts

Optional: we can review your schemas and validation flow before agents write anything.

Optional. The tool and every export work without this. No spam.

How to use it

Set the key field and its regex pattern, the list of allowed units and item types, and numeric limits for length and cost. Copy the schema into your validator of choice, such as Ajv in JavaScript or jsonschema in Python, and run every inbound payload through it. The same document can serve as the inputSchema of an AI tool, so the model is constrained to valid shapes from the start.

  • Use enum for coded values like UoM
  • Set additionalProperties to false on inbound data
  • List required fields explicitly

What the keywords do

Type fixes the base type. Pattern applies a regular expression to strings, which is ideal for part numbers and document ids. Enum restricts a value to a known list. Minimum and maximum bound numbers, and maxLength bounds strings, which also protects against fields that exceed the column width in the ERP. Format with date or date-time documents intent, although validators may only assert it when configured to do so.

Reading the example

The default describes an item with a key, a 60 character description, a unit, a make or buy type, a cost, a lead time, lot tracking and a nested list of suppliers. Required fields are the minimum an ERP would reject a record without. Limits are examples; set them from your actual field lengths and business ranges, not from this sample.

Common mistakes

Teams often validate only at the final API, leave additionalProperties open so typos pass silently, use numbers for ids that carry leading zeros, and forget that decimals in JSON are floating point, so money may need string or integer minor units. Version your schemas alongside the API and test them with both valid and invalid sample files.

Frequently Asked Questions

Which JSON Schema draft does this use?

Draft 2020-12, declared in the $schema keyword. Most current validators support it. If your tool needs draft-07, the keywords used here are largely compatible, but check array and reference handling.

Can I use it as an MCP or function tool schema?

Yes, a plain object schema with properties and required works as an input schema. Some clients restrict advanced keywords, so keep to simple types, enums and patterns for tool inputs.

Does this replace ERP validation?

No. It checks structure and ranges. The ERP still validates business rules such as existing master data, open periods and authorizations, and its errors should be surfaced to the caller.

How should I model money?

Either as a string with a decimal pattern or as an integer in minor units, together with a currency code. Binary floating point can introduce rounding errors in totals.

If you want validated, permissioned data flowing between your ERP and AI tools, Netray can help design the schemas and the services around them.