Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…hema.com into keyword-anchor
  • Loading branch information
AgniveshChaubey committed Feb 13, 2024
2 parents ac248c8 + 91fe902 commit 7f0a990
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion content/2020-12/validation/maxLength.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,20 @@ The `maxLength` keyword is used to specify the maximum length of a string instan

{{<instance-pass `An instance with a numeric value is valid`>}}
55
{{</instance-pass>}}
{{</instance-pass>}}

{{<schema `Schema for maximum string length validation with Unicode characters`>}}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string",
"maxLength": 3
}
{{</schema>}}

{{<instance-pass `An instance with 3 or less characters is valid`>}}
"\u0066\u006F\u006F" // --> "foo"
{{</instance-pass>}}

{{<instance-fail `An instance with more than 3 characters is invalid`>}}
"\u0048\u0065\u006C\u006C\u006F" // --> "Hello"
{{</instance-fail>}}

0 comments on commit 7f0a990

Please sign in to comment.