Skip to content

Commit 34f3174

Browse files
committed
Validate fields in item assets, item assets defintion and collection assets; add link back to stac-spec
1 parent 4a97ad1 commit 34f3174

File tree

4 files changed

+84
-41
lines changed

4 files changed

+84
-41
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- **Extension [Maturity Classification](https://github.com/radiantearth/stac-spec/tree/master/extensions/README.md#extension-maturity):** Proposal
88
- **Owner**: @your-gh-handles @person2
99

10+
This document explains the Template Extension to the [SpatioTemporal Asset Catalog](https://github.com/radiantearth/stac-spec) (STAC) specification.
1011
This is the place to add a short introduction.
1112

1213
- Examples:
@@ -18,7 +19,8 @@ This is the place to add a short introduction.
1819

1920
| Field Name | Type | Description |
2021
| ----------- | ------------------------- | ----------- |
21-
| new_field | [XYZ Object](#xyz-object) | **REQUIRED**. Describe the required field... |
22+
| new_field | string | **REQUIRED**. Describe the required field... |
23+
| xyz | [XYZ Object](#xyz-object) | Describe the field... |
2224
| another_one | \[number] | Describe the field... |
2325

2426
### Additional Field Information

examples/collection.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"stac_version": "1.0.0-rc.1",
33
"stac_extensions": [
4+
"collection-assets",
5+
"item-assets",
46
"https://stac-extensions.github.io/template/v1.0.0/schema.json"
57
],
68
"type": "Collection",
@@ -28,7 +30,8 @@
2830
]
2931
}
3032
},
31-
"new_field": {
33+
"new_field": "test",
34+
"xyz": {
3235
"x": 1,
3336
"y": 2,
3437
"z": 3
@@ -38,6 +41,17 @@
3841
2,
3942
3
4043
],
44+
"assets": {
45+
"example": {
46+
"href": "https://example.com/examples/file.xyz",
47+
"new_field": "test"
48+
}
49+
},
50+
"item_assets": {
51+
"data": {
52+
"new_field": "test"
53+
}
54+
},
4155
"summaries": {
4256
"datetime": {
4357
"minimum": "2015-06-23T00:00:00Z",
@@ -48,6 +62,10 @@
4862
{
4963
"href": "https://example.com/examples/collection.json",
5064
"rel": "self"
65+
},
66+
{
67+
"href": "https://example.com/examples/item.json",
68+
"rel": "item"
5169
}
5270
]
5371
}

examples/item.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
},
4141
"properties": {
4242
"datetime": "2020-12-11T22:38:32Z",
43-
"new_field": {
43+
"new_field": "test",
44+
"xyz": {
4445
"x": 1,
4546
"y": 2,
4647
"z": 3
@@ -59,7 +60,8 @@
5960
],
6061
"assets": {
6162
"data": {
62-
"href": "https://example.com/examples/file.xyz"
63+
"href": "https://example.com/examples/file.xyz",
64+
"new_field": "test"
6365
}
6466
}
6567
}

json-schema/schema.json

Lines changed: 58 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,46 @@
55
"description": "STAC Template Extension for STAC Items and STAC Collections.",
66
"oneOf": [
77
{
8+
"$comment": "This is the schema for STAC Items.",
89
"allOf": [
910
{
1011
"type": "object",
1112
"required": [
12-
"type"
13+
"type",
14+
"properties",
15+
"assets"
1316
],
1417
"properties": {
1518
"type": {
1619
"const": "Feature"
20+
},
21+
"properties": {
22+
"allOf": [
23+
{
24+
"required": [
25+
"new_field"
26+
]
27+
},
28+
{
29+
"$ref": "#/definitions/fields"
30+
}
31+
]
32+
},
33+
"assets": {
34+
"type": "object",
35+
"additionalProperties": {
36+
"$ref": "#/definitions/fields"
37+
}
1738
}
1839
}
1940
},
2041
{
2142
"$ref": "#/definitions/stac_extensions"
22-
},
23-
{
24-
"type": "object",
25-
"required": [
26-
"properties"
27-
],
28-
"properties": {
29-
"properties": {
30-
"$ref": "#/definitions/template"
31-
}
32-
}
3343
}
3444
]
3545
},
3646
{
47+
"$comment": "This is the schema for STAC Collections.",
3748
"allOf": [
3849
{
3950
"type": "object",
@@ -43,14 +54,26 @@
4354
"properties": {
4455
"type": {
4556
"const": "Collection"
57+
},
58+
"assets": {
59+
"type": "object",
60+
"additionalProperties": {
61+
"$ref": "#/definitions/fields"
62+
}
63+
},
64+
"item_assets": {
65+
"type": "object",
66+
"additionalProperties": {
67+
"$ref": "#/definitions/fields"
68+
}
4669
}
4770
}
4871
},
4972
{
5073
"$ref": "#/definitions/stac_extensions"
5174
},
5275
{
53-
"$ref": "#/definitions/template"
76+
"$ref": "#/definitions/fields"
5477
}
5578
]
5679
}
@@ -70,14 +93,31 @@
7093
}
7194
}
7295
},
73-
"template": {
96+
"fields": {
97+
"$comment": "Add your new fields here. Don't require them here, do that above in the item schema.",
7498
"type": "object",
75-
"required": [
76-
"new_field"
77-
],
7899
"properties": {
79100
"new_field": {
80-
"$ref": "#/definitions/xyz_object"
101+
"type": "string"
102+
},
103+
"xyz": {
104+
"type": "object",
105+
"required": [
106+
"x",
107+
"y",
108+
"z"
109+
],
110+
"properties": {
111+
"x": {
112+
"type": "number"
113+
},
114+
"y": {
115+
"type": "number"
116+
},
117+
"z": {
118+
"type": "number"
119+
}
120+
}
81121
},
82122
"another_one": {
83123
"type": "array",
@@ -86,25 +126,6 @@
86126
}
87127
}
88128
}
89-
},
90-
"xyz_object": {
91-
"type": "object",
92-
"required": [
93-
"x",
94-
"y",
95-
"z"
96-
],
97-
"properties": {
98-
"x": {
99-
"type": "number"
100-
},
101-
"y": {
102-
"type": "number"
103-
},
104-
"z": {
105-
"type": "number"
106-
}
107-
}
108129
}
109130
}
110131
}

0 commit comments

Comments
 (0)