Skip to content

Commit 275d269

Browse files
Merge pull request #1 from DivyanshuVortex/fix/docs-format-note
chores
2 parents b877a46 + a083061 commit 275d269

File tree

1 file changed

+6
-5
lines changed
  • pages/understanding-json-schema/reference

1 file changed

+6
-5
lines changed

pages/understanding-json-schema/reference/type.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ At its core, JSON Schema defines the following basic types:
2121
- [object](../../understanding-json-schema/reference/object)
2222
- [string](../../understanding-json-schema/reference/string)
2323

24-
2524
These types have analogs in most programming languages, though they may
2625
go by different names.
2726

27+
> Note: JSON does not define an `integer` type. In JSON Schema, `"integer"` is shorthand for `"number"` with `"multipleOf": 1`, used to represent whole-number numeric values.
28+
2829
[tabs-start "Language-specific info"]
2930

3031
[tab "Python"]
@@ -130,7 +131,7 @@ to decode ``Int`` from a non-integer number in JSON.
130131

131132
The `type` keyword can take two forms:
132133

133-
1. **A single string**. When it is a single string, it must be one of the types mentioned above (`array`, `boolean`, `integer`, `number`, `null`, `object` or `string`). This specifies that the instance data is only valid when it matches that specific type.
134+
1. **A single string**. When it is a single string, it must be one of the types mentioned above (`array`, `boolean` , `number`, `null`, `object` or `string`). This specifies that the instance data is only valid when it matches that specific type.
134135

135136
Here is an example of using `"number"` as a single string value:
136137

@@ -179,7 +180,7 @@ JSON Schema offers a variety of keywords to validate data against specific types
179180
| Type Keyword | Specific Keywords | Description |
180181
|---|---|---|
181182
| [array](../../understanding-json-schema/reference/array) | `items`, `additionalItems`, `minItems`, `maxItems`, `uniqueItems` | Define item schemas, additional item handling, item count constraints, and uniqueness. |
182-
| [number](../../understanding-json-schema/reference/numeric) | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf` | Define numeric ranges, including exclusive bounds and divisibility. |
183+
| [number](../../understanding-json-schema/reference/numeric) | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf` | Define numeric ranges and allowed increments. |
183184
| [object](../../understanding-json-schema/reference/object) | `required`, `properties`, `additionalProperties`, `patternProperties`, `minProperties`, `maxProperties`, `dependencies` | Define required properties, property schemas, additional property handling, pattern-based property matching, and property count constraints. |
184185
| [integer](../../understanding-json-schema/reference/numeric) | Same as `number` | Integers use numeric constraints but must not contain a fractional part. |
185186
| [string](../../understanding-json-schema/reference/string) | `minLength`, `maxLength`, `pattern`, `format`| Restrict string length, pattern matching, and format validation (e.g., email, date). |
@@ -210,7 +211,7 @@ The JSON Schema specification has a bias toward networking-related formats due t
210211

211212
### Built-in Formats
212213

213-
It should be noted that `format` is not limited to a specific set of valid values or types. Users may define custom formats through vocabularies, but the built-in formats apply only to strings.
214+
It should be noted that `format` is not limited to a specific set of valid values or types. Users may define additional custom formats, but the built-in formats apply only to the `string` type. Below, we cover the formats defined in the JSON Schema specification.
214215

215216
#### Dates and Times
216217

@@ -255,4 +256,4 @@ Dates and times are represented in [RFC 3339, section 5.6](https://tools.ietf.or
255256

256257
#### Regular Expressions
257258

258-
- `"regex"`: <StarInline label="New in draft 7" /> A regular expression that should be valid according to the [ECMA 262](https://www.ecma-international.org/publications-and-standards/standards/ecma-262/) [dialect](../../learn/glossary#dialect). Be careful, in practice, JSON Schema validators are only required to accept the safe subset of [regular expressions](../../understanding-json-schema/reference/regular_expressions) described elsewhere in this document.
259+
- `"regex"`: <StarInline label="New in draft 7" /> A regular expression that should be valid according to the [ECMA 262](https://www.ecma-international.org/publications-and-standards/standards/ecma-262/) [dialect](../../learn/glossary#dialect). Be careful, in practice, JSON Schema validators are only required to accept the safe subset of [regular expressions](../../understanding-json-schema/reference/regular_expressions) described elsewhere in this document.

0 commit comments

Comments
 (0)