Skip to content

Commit ecf3f1d

Browse files
committed
feat: change include/exclude recommendations
1 parent 99e3612 commit ecf3f1d

File tree

1 file changed

+44
-27
lines changed

1 file changed

+44
-27
lines changed

README.md

Lines changed: 44 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -71,44 +71,55 @@ name, e.g., `properties.datetime` or `datetime`.
7171

7272
## Include/Exclude Semantics
7373

74-
1. If `fields` attribute is specified with an empty object, or with both `include` and `exclude` set to null or an
75-
empty array, the recommended behavior is as if `include` was set to
76-
`["id", "type", "geometry", "bbox", "links", "assets", "properties.datetime"]`. This default is so that the entity
77-
returned is a valid STAC Item. Implementations may choose to add other properties, e.g., `created`, but the number
74+
1. If `fields` attribute is specified as an empty object, or with both `include` and `exclude` set to null or an
75+
empty array, then the recommended behavior is to `include` the following keys:
76+
`["id", "type", "geometry", "bbox", "links", "assets", "properties.datetime", "stac_version"]`.
77+
This default is so that the entity returned is a valid STAC Item.
78+
Implementations may choose to add other properties, e.g., `created`, but the number
7879
of default properties attributes should be kept to a minimum.
79-
2. If only `include` is specified, these attributes are added to the default set of attributes (set union operation).
80-
3. If only `exclude` is specified, these attributes are subtracted from the union of the default set of attributes and
81-
the `include` attributes (set difference operation). This will result in an entity that is not a valid Item if any
82-
of the excluded attributes are in the default set of attributes.
83-
4. If both `include` and `exclude` attributes are specified, semantics are that a field must be included and **not**
84-
excluded. E.g., if `properties` is included and `properties.datetime` is excluded, then `datetime` must not appear
85-
in the attributes of `properties`.
80+
2. If only `include` is specified, these attributes should be the only attributes included.
81+
3. If only `exclude` is specified, these attributes are subtracted from the full item.
82+
This may result in an entity that is not a valid STAC Item.
83+
4. If `exclude` is specified and `include` is null or an empty
84+
array, then the `exclude` attributes are subtracted from the default set.
85+
This may result in an entity that is not a valid STAC Item.
86+
5. If a key is in `exclude`, and a sub-key is in `include`, the sub-key should be included, but no other fields
87+
in the key should be included. E.g., if `properties` is excluded and `properties.datetime` is included, then `datetime`
88+
should be the only attribute in `properties`.
89+
6. If a key is in `include`, and a sub-key is in `exclude`, the key should be included, and the sub-key should be excluded.
90+
E.g., if `properties` is included and `properties.datetime` is excluded, then `datetime`
91+
should not be in `properties`.
92+
7. If the same attribute is present in both `include` and `exclude`, it should be included.
8693

8794
## Examples
8895

89-
Return baseline fields. This **must** return valid STAC Item entities.
96+
Return the default fields. This should return valid STAC Item entities.
9097

9198
Query Parameters
92-
```http
99+
100+
```text
93101
?fields=
94102
```
95103

96104
JSON
105+
97106
```json
98107
{
99108
"fields": {
100109
}
101110
}
102111
```
103112

104-
This has a similar effect as an empty object for `fields`, but it is up to the discretion of the implementation
113+
This has a similar effect as an empty object for `fields`, but it is up to the discretion of the implementation.
105114

106115
Query Parameters
107-
```http
108-
?fields=id,type,geometry,bbox,properties,links,assets
116+
117+
```text
118+
?fields=id,type,geometry,bbox,properties.datetime,links,assets,stac_version
109119
```
110120

111121
JSON
122+
112123
```json
113124
{
114125
"fields": {
@@ -117,22 +128,25 @@ JSON
117128
"type",
118129
"geometry",
119130
"bbox",
120-
"properties",
131+
"properties.datetime",
121132
"links",
122-
"assets"
133+
"assets",
134+
"stac_version",
123135
]
124136
}
125137
}
126138
```
127139

128-
Exclude `geometry` from the baseline fields. This **must** return an entity that is not a valid GeoJSON Feature or a valid STAC Item.
140+
Exclude `geometry` from the full item. This **must** return an entity that is not a valid GeoJSON Feature or a valid STAC Item.
129141

130142
Query Parameters
131-
```http
143+
144+
```text
132145
?fields=-geometry
133146
```
134147

135148
JSON
149+
136150
```json
137151
{
138152
"fields": {
@@ -143,17 +157,17 @@ JSON
143157
}
144158
```
145159

146-
To return the `id`, `type`, `geometry`, and the Properties attribute `eo:cloud_cover`.
147-
This **must** return a valid STAC Item, as the includes are added to the default includes.
148-
Explicitly specifying `id`, `type`, and `geometry` has not effect as these are default fields,
149-
but `properties.eo:cloud_cover` is not a default field and thereby should be in the response.
160+
Return the `id`, `type`, `geometry`, and the Properties attribute `eo:cloud_cover`.
161+
This might not return a valid STAC Item, since not all required Item attributes are included.
150162

151163
Query Parameters
152-
```http
164+
165+
```text
153166
?fields=id,type,geometry,properties.eo:cloud_cover
154167
```
155168

156169
JSON
170+
157171
```json
158172
{
159173
"fields": {
@@ -170,16 +184,19 @@ JSON
170184
To include `id` and all the properties fields, except for the `foo` field.
171185

172186
Query Parameters
173-
```http
187+
188+
```text
174189
?fields=id,properties,-properties.foo
175190
```
176191

177192
also valid:
178-
```http
193+
194+
```text
179195
?fields=+id,+properties,-properties.foo
180196
```
181197

182198
JSON
199+
183200
```json
184201
{
185202
"fields": {

0 commit comments

Comments
 (0)