You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These types have analogs in most programming languages, though they may
26
25
go by different names.
27
26
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
+
28
29
[tabs-start "Language-specific info"]
29
30
30
31
[tab "Python"]
@@ -130,7 +131,7 @@ to decode ``Int`` from a non-integer number in JSON.
130
131
131
132
The `type` keyword can take two forms:
132
133
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.
134
135
135
136
Here is an example of using `"number"` as a single string value:
136
137
@@ -179,7 +180,7 @@ JSON Schema offers a variety of keywords to validate data against specific types
179
180
| Type Keyword | Specific Keywords | Description |
|[integer](../../understanding-json-schema/reference/numeric)| Same as `number`| Integers use numeric constraints but must not contain a fractional part. |
185
186
|[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
210
211
211
212
### Built-in Formats
212
213
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.
214
215
215
216
#### Dates and Times
216
217
@@ -255,4 +256,4 @@ Dates and times are represented in [RFC 3339, section 5.6](https://tools.ietf.or
255
256
256
257
#### Regular Expressions
257
258
258
-
-`"regex"`: <StarInlinelabel="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"`: <StarInlinelabel="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