Skip to content

Commit fd75042

Browse files
committed
Update schema to follow new template #3, update examples to STAC 1.0.0
1 parent b0dc14b commit fd75042

4 files changed

Lines changed: 90 additions & 70 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212

1313
### Changed
1414

15+
- Updated examples to STAC 1.0.0
16+
1517
### Deprecated
1618

1719
### Removed
1820

1921
### Fixed
2022

23+
- The JSON Schema is more strict and should not have issues with missing required fields in Collections any longer [#3](https://github.com/stac-extensions/processing/issues/3)
24+
2125
## [v1.0.0] - 2021-03-08
2226

2327
Initial independent release, see [previous history](https://github.com/radiantearth/stac-spec/commits/4a841605ad83a16f45fcb88ed90117d6c77a7f04/extensions/processing)

examples/collection.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"stac_version": "1.0.0-rc.1",
2+
"stac_version": "1.0.0",
33
"stac_extensions": [
44
"https://stac-extensions.github.io/processing/v1.0.0/schema.json"
55
],
@@ -80,6 +80,10 @@
8080
10,
8181
30,
8282
60
83+
],
84+
"processing:level": [
85+
"L1C",
86+
"L2A"
8387
]
8488
},
8589
"links": [

examples/item.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"stac_version": "1.0.0-rc.1",
2+
"stac_version": "1.0.0",
33
"stac_extensions": [
44
"https://stac-extensions.github.io/sat/v1.0.0/schema.json",
55
"https://stac-extensions.github.io/sar/v1.0.0/schema.json",

json-schema/schema.json

Lines changed: 80 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
"description": "STAC Processing Extension for STAC Items and STAC Collections.",
66
"anyOf": [
77
{
8-
"$comment": "This is the schema for STAC Items.",
8+
"$comment": "This is the schema for STAC Items. Remove this object if this extension only applies to Collections.",
99
"allOf": [
10+
{
11+
"$ref": "#/definitions/stac_extensions"
12+
},
1013
{
1114
"type": "object",
1215
"required": [
@@ -21,39 +24,50 @@
2124
"properties": {
2225
"allOf": [
2326
{
24-
"$ref": "#/definitions/requirements"
27+
"$ref": "#/definitions/require_any_field"
2528
},
2629
{
2730
"$ref": "#/definitions/fields"
2831
}
2932
]
3033
},
3134
"assets": {
35+
"$comment": "This validates the fields in Item Assets, but does not require them.",
3236
"type": "object",
3337
"additionalProperties": {
3438
"$ref": "#/definitions/fields"
3539
}
3640
}
3741
}
38-
},
39-
{
40-
"$ref": "#/definitions/stac_extensions"
4142
}
4243
]
4344
},
4445
{
45-
"$comment": "This is the schema for STAC Collections (Providers).",
46+
"$comment": "This is the schema for STAC Collections.",
47+
"type": "object",
4648
"allOf": [
4749
{
48-
"type": "object",
4950
"required": [
50-
"type",
51-
"providers"
51+
"type"
5252
],
5353
"properties": {
5454
"type": {
5555
"const": "Collection"
56-
},
56+
}
57+
}
58+
},
59+
{
60+
"$ref": "#/definitions/stac_extensions"
61+
}
62+
],
63+
"anyOf": [
64+
{
65+
"$comment": "Validate fields in Collection Providers.",
66+
"type": "object",
67+
"required": [
68+
"providers"
69+
],
70+
"properties": {
5771
"providers": {
5872
"type": "array",
5973
"minItems": 1,
@@ -79,7 +93,7 @@
7993
}
8094
},
8195
{
82-
"$ref": "#/definitions/requirements"
96+
"$ref": "#/definitions/require_any_field"
8397
},
8498
{
8599
"$ref": "#/definitions/fields"
@@ -98,49 +112,65 @@
98112
}
99113
},
100114
{
101-
"$ref": "#/definitions/stac_extensions"
102-
}
103-
]
104-
},
105-
{
106-
"$comment": "This is the schema for STAC Collections (Assets).",
107-
"allOf": [
108-
{
109-
"type": "object",
110-
"anyOf": [
111-
{
112-
"required": [
113-
"type",
114-
"assets"
115-
]
116-
},
117-
{
118-
"required": [
119-
"type",
120-
"item_assets"
121-
]
122-
}
115+
"$comment": "This validates the fields in Collection Assets, but does not require them.",
116+
"required": [
117+
"assets"
123118
],
124119
"properties": {
125-
"type": {
126-
"const": "Collection"
127-
},
128120
"assets": {
129121
"type": "object",
130-
"additionalProperties": {
131-
"$ref": "#/definitions/fields"
122+
"not": {
123+
"additionalProperties": {
124+
"not": {
125+
"allOf": [
126+
{
127+
"$ref": "#/definitions/require_any_field"
128+
},
129+
{
130+
"$ref": "#/definitions/fields"
131+
}
132+
]
133+
}
134+
}
132135
}
133-
},
136+
}
137+
}
138+
},
139+
{
140+
"$comment": "This is the schema for the fields in Item Asset Definitions. It doesn't require any fields.",
141+
"required": [
142+
"item_assets"
143+
],
144+
"properties": {
134145
"item_assets": {
135146
"type": "object",
136-
"additionalProperties": {
137-
"$ref": "#/definitions/fields"
147+
"not": {
148+
"additionalProperties": {
149+
"not": {
150+
"allOf": [
151+
{
152+
"$ref": "#/definitions/require_any_field"
153+
},
154+
{
155+
"$ref": "#/definitions/fields"
156+
}
157+
]
158+
}
159+
}
138160
}
139161
}
140162
}
141163
},
142164
{
143-
"$ref": "#/definitions/stac_extensions"
165+
"$comment": "This is the schema for the fields in Summaries. By default, only checks the existance of the properties, but not the schema of the summaries.",
166+
"required": [
167+
"summaries"
168+
],
169+
"properties": {
170+
"summaries": {
171+
"$ref": "#/definitions/require_any_field"
172+
}
173+
}
144174
}
145175
]
146176
}
@@ -160,36 +190,18 @@
160190
}
161191
}
162192
},
163-
"requirements": {
193+
"require_any_field": {
194+
"$comment": "Please list all fields here so that we can force the existance of one of them in other parts of the schemas.",
164195
"anyOf": [
165-
{
166-
"required": [
167-
"processing:expression"
168-
]
169-
},
170-
{
171-
"required": [
172-
"processing:lineage"
173-
]
174-
},
175-
{
176-
"required": [
177-
"processing:level"
178-
]
179-
},
180-
{
181-
"required": [
182-
"processing:facility"
183-
]
184-
},
185-
{
186-
"required": [
187-
"processing:software"
188-
]
189-
}
196+
{"required": ["processing:expression"]},
197+
{"required": ["processing:lineage"]},
198+
{"required": ["processing:level"]},
199+
{"required": ["processing:facility"]},
200+
{"required": ["processing:software"]}
190201
]
191202
},
192203
"fields": {
204+
"$comment": "Add your new fields here. Don't require them here, do that above in the corresponding schema.",
193205
"type": "object",
194206
"properties": {
195207
"processing:expression": {

0 commit comments

Comments
 (0)