4

I just created my JSON Schema and I can't find if there is some kind of unsigned integer.

Is there an unsigned integer type available in JSON Schema?

1 Answer 1

7

No, there isn't. Check the 'type' section for details. But you can do

{
   "type" : "integer",
   "minimum" : 0
}
3
  • I tried this solution but it did not work for me. The value "-1" is still accepted by JSON validator. Is there something else to do?
    – Matthieu.V
    Commented May 14, 2020 at 15:35
  • 1
    This can be a bug in the validator you use @Matthieu.V
    – erosb
    Commented May 15, 2020 at 16:08
  • Ok, I found out the cause. It is not really a bug, but the library I was using supported only draft v3 while this keyword is something like draft v4+.
    – Matthieu.V
    Commented May 18, 2020 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.