|  | 
| 7 | 7 |     { | 
| 8 | 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 |  | -                  "$comment": "Require fields here for item properties.", | 
|  | 27 | +                  "$comment": "Require fields here for Item Properties.", | 
| 25 | 28 |                   "required": [ | 
| 26 | 29 |                     "template:new_field" | 
| 27 | 30 |                   ] | 
|  | 
| 32 | 35 |               ] | 
| 33 | 36 |             }, | 
| 34 | 37 |             "assets": { | 
|  | 38 | +              "$comment": "This validates the fields in Item Assets, but does not require them.", | 
| 35 | 39 |               "type": "object", | 
| 36 | 40 |               "additionalProperties": { | 
| 37 | 41 |                 "$ref": "#/definitions/fields" | 
| 38 | 42 |               } | 
| 39 | 43 |             } | 
| 40 | 44 |           } | 
| 41 |  | -        }, | 
| 42 |  | -        { | 
| 43 |  | -          "$ref": "#/definitions/stac_extensions" | 
| 44 | 45 |         } | 
| 45 | 46 |       ] | 
| 46 | 47 |     }, | 
| 47 | 48 |     { | 
| 48 |  | -      "$comment": "This is the schema for STAC Collections. Remove this object if this extension does not define top-level fields for Collections AND can't be used in collection assets or item asset defintions.", | 
|  | 49 | +      "$comment": "This is the schema for STAC Collections.", | 
|  | 50 | +      "type": "object", | 
| 49 | 51 |       "allOf": [ | 
| 50 | 52 |         { | 
| 51 |  | -          "type": "object", | 
| 52 | 53 |           "required": [ | 
| 53 | 54 |             "type" | 
| 54 | 55 |           ], | 
| 55 | 56 |           "properties": { | 
| 56 | 57 |             "type": { | 
| 57 | 58 |               "const": "Collection" | 
|  | 59 | +            } | 
|  | 60 | +          } | 
|  | 61 | +        }, | 
|  | 62 | +        { | 
|  | 63 | +          "$ref": "#/definitions/stac_extensions" | 
|  | 64 | +        } | 
|  | 65 | +      ], | 
|  | 66 | +      "anyOf": [ | 
|  | 67 | +        { | 
|  | 68 | +          "$comment": "This is the schema for the top-level fields in a Collection. Remove this if this extension does not define top-level fields for Collections.", | 
|  | 69 | +          "allOf": [ | 
|  | 70 | +            { | 
|  | 71 | +              "$comment": "Require fields here for Collections (top-level).", | 
|  | 72 | +              "required": [ | 
|  | 73 | +                "template:new_field" | 
|  | 74 | +              ] | 
| 58 | 75 |             }, | 
|  | 76 | +            { | 
|  | 77 | +              "$ref": "#/definitions/fields" | 
|  | 78 | +            } | 
|  | 79 | +          ] | 
|  | 80 | +        }, | 
|  | 81 | +        { | 
|  | 82 | +          "$comment": "This validates the fields in Collection Assets, but does not require them.", | 
|  | 83 | +          "required": [ | 
|  | 84 | +            "assets" | 
|  | 85 | +          ], | 
|  | 86 | +          "properties": { | 
| 59 | 87 |             "assets": { | 
| 60 | 88 |               "type": "object", | 
| 61 |  | -              "additionalProperties": { | 
| 62 |  | -                "$ref": "#/definitions/fields" | 
|  | 89 | +              "not": { | 
|  | 90 | +                "additionalProperties": { | 
|  | 91 | +                  "not": { | 
|  | 92 | +                    "allOf": [ | 
|  | 93 | +                      { | 
|  | 94 | +                        "$ref": "#/definitions/require_any_field" | 
|  | 95 | +                      }, | 
|  | 96 | +                      { | 
|  | 97 | +                        "$ref": "#/definitions/fields" | 
|  | 98 | +                      } | 
|  | 99 | +                    ] | 
|  | 100 | +                  } | 
|  | 101 | +                } | 
| 63 | 102 |               } | 
| 64 |  | -            }, | 
|  | 103 | +            } | 
|  | 104 | +          } | 
|  | 105 | +        }, | 
|  | 106 | +        { | 
|  | 107 | +          "$comment": "This is the schema for the fields in Item Asset Definitions. It doesn't require any fields.", | 
|  | 108 | +          "required": [ | 
|  | 109 | +            "item_assets" | 
|  | 110 | +          ], | 
|  | 111 | +          "properties": { | 
| 65 | 112 |             "item_assets": { | 
| 66 | 113 |               "type": "object", | 
| 67 |  | -              "additionalProperties": { | 
| 68 |  | -                "$ref": "#/definitions/fields" | 
|  | 114 | +              "not": { | 
|  | 115 | +                "additionalProperties": { | 
|  | 116 | +                  "not": { | 
|  | 117 | +                    "allOf": [ | 
|  | 118 | +                      { | 
|  | 119 | +                        "$ref": "#/definitions/require_any_field" | 
|  | 120 | +                      }, | 
|  | 121 | +                      { | 
|  | 122 | +                        "$ref": "#/definitions/fields" | 
|  | 123 | +                      } | 
|  | 124 | +                    ] | 
|  | 125 | +                  } | 
|  | 126 | +                } | 
| 69 | 127 |               } | 
| 70 | 128 |             } | 
| 71 | 129 |           } | 
| 72 | 130 |         }, | 
| 73 | 131 |         { | 
| 74 |  | -          "$ref": "#/definitions/stac_extensions" | 
| 75 |  | -        }, | 
| 76 |  | -        { | 
| 77 |  | -          "$comment": "Remove this object if this extension does not define top-level fields for Collections.", | 
| 78 |  | -          "$ref": "#/definitions/fields" | 
|  | 132 | +          "$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.", | 
|  | 133 | +          "required": [ | 
|  | 134 | +            "summaries" | 
|  | 135 | +          ], | 
|  | 136 | +          "properties": { | 
|  | 137 | +            "summaries": { | 
|  | 138 | +              "$ref": "#/definitions/require_any_field" | 
|  | 139 | +            } | 
|  | 140 | +          } | 
| 79 | 141 |         } | 
| 80 | 142 |       ] | 
| 81 | 143 |     } | 
|  | 
| 95 | 157 |         } | 
| 96 | 158 |       } | 
| 97 | 159 |     }, | 
|  | 160 | +    "require_any_field": { | 
|  | 161 | +      "$comment": "Please list all fields here so that we can force the existance of one of them in other parts of the schemas.", | 
|  | 162 | +      "anyOf": [ | 
|  | 163 | +        {"required": ["template:new_field"]}, | 
|  | 164 | +        {"required": ["template:xyz"]}, | 
|  | 165 | +        {"required": ["template:another_one"]} | 
|  | 166 | +      ] | 
|  | 167 | +    }, | 
| 98 | 168 |     "fields": { | 
| 99 |  | -      "$comment": "Add your new fields here. Don't require them here, do that above in the item schema.", | 
|  | 169 | +      "$comment": "Add your new fields here. Don't require them here, do that above in the corresponding schema.", | 
| 100 | 170 |       "type": "object", | 
| 101 | 171 |       "properties": { | 
| 102 | 172 |         "template:new_field": { | 
|  | 
0 commit comments