Skip to content

Commit 6d3ba9a

Browse files
committed
Add template prefix, make schema more strict (radiantearth/stac-spec#901) and add more comments to schema
1 parent b6739b5 commit 6d3ba9a

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ This is the place to add a short introduction.
1818

1919
## Item Properties and Collection Fields
2020

21-
| Field Name | Type | Description |
22-
| ----------- | ------------------------- | ----------- |
23-
| new_field | string | **REQUIRED**. Describe the required field... |
24-
| xyz | [XYZ Object](#xyz-object) | Describe the field... |
25-
| another_one | \[number] | Describe the field... |
21+
| Field Name | Type | Description |
22+
| -------------------- | ------------------------- | ----------- |
23+
| template:new_field | string | **REQUIRED**. Describe the required field... |
24+
| template:xyz | [XYZ Object](#xyz-object) | Describe the field... |
25+
| template:another_one | \[number] | Describe the field... |
2626

2727
### Additional Field Information
2828

29-
#### new_field
29+
#### template:new_field
3030

31-
This is a much more detailed description of the field `new_field`...
31+
This is a much more detailed description of the field `template:new_field`...
3232

3333
### XYZ Object
3434

examples/collection.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,26 @@
3030
]
3131
}
3232
},
33-
"new_field": "test",
34-
"xyz": {
33+
"template:new_field": "test",
34+
"template:xyz": {
3535
"x": 1,
3636
"y": 2,
3737
"z": 3
3838
},
39-
"another_one": [
39+
"template:another_one": [
4040
1,
4141
2,
4242
3
4343
],
4444
"assets": {
4545
"example": {
4646
"href": "https://example.com/examples/file.xyz",
47-
"new_field": "test"
47+
"template:new_field": "test"
4848
}
4949
},
5050
"item_assets": {
5151
"data": {
52-
"new_field": "test"
52+
"template:new_field": "test"
5353
}
5454
},
5555
"summaries": {

examples/item.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
},
4141
"properties": {
4242
"datetime": "2020-12-11T22:38:32Z",
43-
"new_field": "test",
44-
"xyz": {
43+
"template:new_field": "test",
44+
"template:xyz": {
4545
"x": 1,
4646
"y": 2,
4747
"z": 3
4848
},
49-
"another_one": [
49+
"template:another_one": [
5050
1,
5151
2,
5252
3
@@ -61,7 +61,7 @@
6161
"assets": {
6262
"data": {
6363
"href": "https://example.com/examples/file.xyz",
64-
"new_field": "test"
64+
"template:new_field": "test"
6565
}
6666
}
6767
}

json-schema/schema.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
"properties": {
2222
"allOf": [
2323
{
24+
"$comment": "Require fields here for item properties.",
2425
"required": [
25-
"new_field"
26+
"template:new_field"
2627
]
2728
},
2829
{
@@ -97,10 +98,10 @@
9798
"$comment": "Add your new fields here. Don't require them here, do that above in the item schema.",
9899
"type": "object",
99100
"properties": {
100-
"new_field": {
101+
"template:new_field": {
101102
"type": "string"
102103
},
103-
"xyz": {
104+
"template:xyz": {
104105
"type": "object",
105106
"required": [
106107
"x",
@@ -119,13 +120,19 @@
119120
}
120121
}
121122
},
122-
"another_one": {
123+
"template:another_one": {
123124
"type": "array",
124125
"items": {
125126
"type": "number"
126127
}
127128
}
128-
}
129+
},
130+
"patternProperties": {
131+
"^(?!template:)": {
132+
"$comment": "Above, change `template` to the prefix of this extension",
133+
}
134+
},
135+
"additionalProperties": false
129136
}
130137
}
131138
}

0 commit comments

Comments
 (0)