# JSON Schema Generator for ERP Records

> Source: https://netray.co/tools/erp-record-json-schema-generator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Define an item, order or supplier record as JSON Schema with types, patterns, enums and required fields for validation and AI tool input.

## Category

developer

## Audience

- ERP developer
- Data engineer
- AI engineer

## Tool

**Kind:** template

**Output:** code

**Language:** json

**Fields:**

#### Schema id URL

**Key:** schema_id

**Type:** text

**Default:** https://example.com/schemas/item.json

#### Schema title

**Key:** title

**Type:** text

**Default:** Item master record

#### Key field

**Key:** key_field

**Type:** text

**Default:** itemNumber

#### Key pattern

**Key:** key_pattern

**Type:** text

**Default:** ^[A-Z0-9-]{3,30}$

#### Allowed units (JSON array body)

**Key:** uom_list

**Type:** text

**Default:** "EA", "KG", "M", "L"

#### Item types (JSON array body)

**Key:** type_list

**Type:** text

**Default:** "make", "buy", "phantom"

#### Max description length

**Key:** max_desc

**Type:** number

**Default:** 60

#### Max unit cost

**Key:** max_cost

**Type:** number

**Default:** 1000000

**Blocks:**

#### JSON Schema

**Body:** {
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "{{schema_id}}",
  "title": "{{title}}",
  "type": "object",
  "properties": {
    "{{key_field}}": { "type": "string", "pattern": "{{key_pattern}}" },
    "description": { "type": "string", "maxLength": {{max_desc}} },
    "uom": { "enum": [{{uom_list}}] },
    "itemType": { "enum": [{{type_list}}] },
    "unitCost": { "type": "number", "minimum": 0, "maximum": {{max_cost}} },
    "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": ["{{key_field}}", "description", "uom", "itemType"],
  "additionalProperties": false
}

**Notes:** 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.

## Content

**Intro:** 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.

**Sections:**

#### How to use it

**Body:** 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.

**Bullets:**

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

#### What the keywords do

**Body:** 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

**Body:** 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

**Body:** 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.

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

**Faq:**

#### Which JSON Schema draft does this use?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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.

## Search terms

json schema example, json schema item master, json schema purchase order, erp data validation schema, json schema 2020-12 template, json schema generator erp, json schema pattern part number, validate erp json payload

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
