#23352·arangodb

Json schema validation of type integer wrongly rejects 1.0 and 1e0

Author: adoublebCreated Sep 24, 2026Updated Sep 30, 2026

Version: ArangoDB 3.12.11 (official arangodb:3.12.11 image

Summary

A collection schema with type: "integer" on a property rejects numbers with decimal point or exponent (1.0, 1e0) although JSON Schema defines integer by value and the schema language in ArangoDB is documented as JSON Schema.

Additionally, "1 and 1.0 are two ways to represent the same value in JSON. JSON Schema considers that value an integer no matter which representation was used" from json schema spec

Setup

bash
curl -s -u root:PW -X POST http://127.0.0.1:8529/_api/collection -d '{
  "name": "sv",
  "schema": {
    "rule": {"type": "object", "properties": {"f": {"type": ["integer", "null"]}}, "additionalProperties": true},
    "level": "strict",
    "message": "schema violated"
  }
}'

Reproduction (document API and AQL)

POST /_api/document/sv   {"_key": "a", "f": 1.0}            -> 400, errorNum 1620 "schema violated"
POST /_api/document/sv   {"_key": "e", "f": 1e0}            -> 400, errorNum 1620
POST /_api/document/sv   {"_key": "c", "f": 1}              -> 201

POST /_api/cursor  {"query": "INSERT {_key: 'l', f: 1.0} INTO sv"}                          -> 400, errorNum 1620
POST /_api/cursor  {"query": "INSERT @d INTO sv", "bindVars": {"d": {"_key": "bv", "f": 1.0}}} -> 400, errorNum 1620
POST /_api/cursor  {"query": "RETURN SCHEMA_VALIDATE({f: 1.0}, {rule: {properties: {f: {type: 'integer'}}}}).valid"}  -> [false]
POST /_api/cursor  {"query": "RETURN SCHEMA_VALIDATE({f: 1},   {rule: {properties: {f: {type: 'integer'}}}}).valid"}  -> [true]

With "type": ["number", "null"] instead, 1.0 and -0.0 are accepted (201).

Expected

1.0 and 1e0 should satisfy {"type": "integer"}