opis / json-schema

JSON Schema validator for PHP
https://opis.io/json-schema
Apache License 2.0
566 stars 57 forks source link

typo in the documentation #132

Closed AurelienMarchand closed 1 week ago

AurelienMarchand commented 1 year ago

In the documentation for Conditional subschemas (https://opis.io/json-schema/2.x/conditional-subschemas.html), under the entry "If-Then-Else", the examples contain an error:

Input Status "ab" valid - string of length 2

This should be invalid as it is a string, and the condition is that it must be of minLength 3.

AurelienMarchand commented 1 week ago

sorry, but the issue is still present on the website (https://opis.io/json-schema/2.x/conditional-subschemas.html#if-then-else):

Schema Tab:

{
  "if": {
    "type": "string"
  },
  "then": {
    "minLength": 3
  },
  "else": {
    "const": 0
  }
}

Example Tab:

"abc" | valid - string of length 3
-- | --
"abcd" | valid - string of length 4
0 | valid
0.0 | valid
"ab" | valid - string of length 2  <<<<<<<<<<========= THIS SHOULD SAY "invalid - string of length 2"
1 | invalid - not a string and not 0
["abc"] | invalid - not a string and not 0
sorinsarca commented 1 week ago

Pages are not published yet