Decimal precision in JSON Schema

If you use python jsonschema library than you need

{ "type": "number", "multipleOfPrecision": 0.01 }

https://github.com/epoberezkin/ajv#options


They replaced it with multipleOf (via v3 divisibleBy).

For 2 decimal places, just add multipleOf: 0.01.


I would suggest { "type": "number", "multipleOf": 0.01 } rather than { "type": "integer", "multipleOf": 0.01 }.

See http://spacetelescope.github.io/understanding-json-schema/reference/numeric.html#multiples


Based on JSON Schema specification rfc.section.6.3:

{ 
  "type": "string", 
  "pattern": "-?^\\d*(.\\d{0,2})?$" 
}