Skip to content

Commit aa6178c

Browse files
committed
Suggest simple property names
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 90fb4d3 commit aa6178c

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

content/2019-09/applicator/properties.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ keyword. If an object property is described by both keywords, then both schemas
7474
must successfully validate against the given property for validation to
7575
succeed. {{</common-pitfall>}}
7676

77+
{{<best-practice>}} While JSON Schema allows property names to contain any
78+
characters (including spaces, special characters, and even empty strings),
79+
consider restricting property names to match the regular expression
80+
`[A-Za-z_][A-Za-z0-9_]*`, as suggested by the [JSON Structure
81+
specification](https://json-structure.github.io/core/draft-vasters-json-structure-core.html#section-3.6).
82+
This makes it easier to convert your schemas into programming language type
83+
definitions (such as classes or structs), database schemas (such as SQL
84+
tables), and other systems that have stricter naming requirements.
85+
{{</best-practice>}}
86+
7787
{{<constraint-warning `object`>}}
7888

7989
## Examples

content/2020-12/applicator/properties.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ keyword. If an object property is described by both keywords, then both schemas
7474
must successfully validate against the given property for validation to
7575
succeed. {{</common-pitfall>}}
7676

77+
{{<best-practice>}} While JSON Schema allows property names to contain any
78+
characters (including spaces, special characters, and even empty strings),
79+
consider restricting property names to match the regular expression
80+
`[A-Za-z_][A-Za-z0-9_]*`, as suggested by the [JSON Structure
81+
specification](https://json-structure.github.io/core/draft-vasters-json-structure-core.html#section-3.6).
82+
This makes it easier to convert your schemas into programming language type
83+
definitions (such as classes or structs), database schemas (such as SQL
84+
tables), and other systems that have stricter naming requirements.
85+
{{</best-practice>}}
86+
7787
{{<constraint-warning `object`>}}
7888

7989
## Examples

content/draft4/validation/properties.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ keyword. If an object property is described by both keywords, then both schemas
6262
must successfully validate against the given property for validation to
6363
succeed. {{</common-pitfall>}}
6464

65+
{{<best-practice>}} While JSON Schema allows property names to contain any
66+
characters (including spaces, special characters, and even empty strings),
67+
consider restricting property names to match the regular expression
68+
`[A-Za-z_][A-Za-z0-9_]*`, as suggested by the [JSON Structure
69+
specification](https://json-structure.github.io/core/draft-vasters-json-structure-core.html#section-3.6).
70+
This makes it easier to convert your schemas into programming language type
71+
definitions (such as classes or structs), database schemas (such as SQL
72+
tables), and other systems that have stricter naming requirements.
73+
{{</best-practice>}}
74+
6575
{{<constraint-warning `object`>}}
6676

6777
## Examples

content/draft6/validation/properties.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ keyword. If an object property is described by both keywords, then both schemas
6464
must successfully validate against the given property for validation to
6565
succeed. {{</common-pitfall>}}
6666

67+
{{<best-practice>}} While JSON Schema allows property names to contain any
68+
characters (including spaces, special characters, and even empty strings),
69+
consider restricting property names to match the regular expression
70+
`[A-Za-z_][A-Za-z0-9_]*`, as suggested by the [JSON Structure
71+
specification](https://json-structure.github.io/core/draft-vasters-json-structure-core.html#section-3.6).
72+
This makes it easier to convert your schemas into programming language type
73+
definitions (such as classes or structs), database schemas (such as SQL
74+
tables), and other systems that have stricter naming requirements.
75+
{{</best-practice>}}
76+
6777
{{<constraint-warning `object`>}}
6878

6979
## Examples

content/draft7/validation/properties.markdown

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ keyword. If an object property is described by both keywords, then both schemas
6363
must successfully validate against the given property for validation to
6464
succeed. {{</common-pitfall>}}
6565

66+
{{<best-practice>}} While JSON Schema allows property names to contain any
67+
characters (including spaces, special characters, and even empty strings),
68+
consider restricting property names to match the regular expression
69+
`[A-Za-z_][A-Za-z0-9_]*`, as suggested by the [JSON Structure
70+
specification](https://json-structure.github.io/core/draft-vasters-json-structure-core.html#section-3.6).
71+
This makes it easier to convert your schemas into programming language type
72+
definitions (such as classes or structs), database schemas (such as SQL
73+
tables), and other systems that have stricter naming requirements.
74+
{{</best-practice>}}
75+
6676
{{<constraint-warning `object`>}}
6777

6878
## Examples

0 commit comments

Comments
 (0)