|
5 | 5 | "description": "STAC Processing Extension for STAC Items and STAC Collections.", |
6 | 6 | "anyOf": [ |
7 | 7 | { |
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.", |
9 | 9 | "allOf": [ |
| 10 | + { |
| 11 | + "$ref": "#/definitions/stac_extensions" |
| 12 | + }, |
10 | 13 | { |
11 | 14 | "type": "object", |
12 | 15 | "required": [ |
|
21 | 24 | "properties": { |
22 | 25 | "allOf": [ |
23 | 26 | { |
24 | | - "$ref": "#/definitions/requirements" |
| 27 | + "$ref": "#/definitions/require_any_field" |
25 | 28 | }, |
26 | 29 | { |
27 | 30 | "$ref": "#/definitions/fields" |
28 | 31 | } |
29 | 32 | ] |
30 | 33 | }, |
31 | 34 | "assets": { |
| 35 | + "$comment": "This validates the fields in Item Assets, but does not require them.", |
32 | 36 | "type": "object", |
33 | 37 | "additionalProperties": { |
34 | 38 | "$ref": "#/definitions/fields" |
35 | 39 | } |
36 | 40 | } |
37 | 41 | } |
38 | | - }, |
39 | | - { |
40 | | - "$ref": "#/definitions/stac_extensions" |
41 | 42 | } |
42 | 43 | ] |
43 | 44 | }, |
44 | 45 | { |
45 | | - "$comment": "This is the schema for STAC Collections (Providers).", |
| 46 | + "$comment": "This is the schema for STAC Collections.", |
| 47 | + "type": "object", |
46 | 48 | "allOf": [ |
47 | 49 | { |
48 | | - "type": "object", |
49 | 50 | "required": [ |
50 | | - "type", |
51 | | - "providers" |
| 51 | + "type" |
52 | 52 | ], |
53 | 53 | "properties": { |
54 | 54 | "type": { |
55 | 55 | "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": { |
57 | 71 | "providers": { |
58 | 72 | "type": "array", |
59 | 73 | "minItems": 1, |
|
79 | 93 | } |
80 | 94 | }, |
81 | 95 | { |
82 | | - "$ref": "#/definitions/requirements" |
| 96 | + "$ref": "#/definitions/require_any_field" |
83 | 97 | }, |
84 | 98 | { |
85 | 99 | "$ref": "#/definitions/fields" |
|
98 | 112 | } |
99 | 113 | }, |
100 | 114 | { |
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" |
123 | 118 | ], |
124 | 119 | "properties": { |
125 | | - "type": { |
126 | | - "const": "Collection" |
127 | | - }, |
128 | 120 | "assets": { |
129 | 121 | "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 | + } |
132 | 135 | } |
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": { |
134 | 145 | "item_assets": { |
135 | 146 | "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 | + } |
138 | 160 | } |
139 | 161 | } |
140 | 162 | } |
141 | 163 | }, |
142 | 164 | { |
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 | + } |
144 | 174 | } |
145 | 175 | ] |
146 | 176 | } |
|
160 | 190 | } |
161 | 191 | } |
162 | 192 | }, |
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.", |
164 | 195 | "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"]} |
190 | 201 | ] |
191 | 202 | }, |
192 | 203 | "fields": { |
| 204 | + "$comment": "Add your new fields here. Don't require them here, do that above in the corresponding schema.", |
193 | 205 | "type": "object", |
194 | 206 | "properties": { |
195 | 207 | "processing:expression": { |
|
0 commit comments