Skip to content

Commit 2949fcb

Browse files
committed
fix: comments from PR review
1 parent db7d816 commit 2949fcb

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

README.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,42 @@ geometries, and even smaller Item objects can add up when large numbers of them
2525
fields in an Item are used, so this
2626
specification provides a mechanism for clients to request that servers to explicitly include or exclude certain fields.
2727

28-
This behavior may be bound to either or both of
28+
This behavior may be bound to either or both of
2929
[STAC API - Item Search](https://github.com/radiantearth/stac-api-spec/tree/v1.0.0-rc.2/item-search) (`/search` endpoint) or
3030
[STAC API - Features](https://github.com/radiantearth/stac-api-spec/tree/v1.0.0-rc.2/ogcapi-features)
31-
(`/collections/{collectionId}/items` endpoint) by advertising the relevant conformance class.
31+
(`/collections/{collectionId}/items` endpoint) by advertising the relevant conformance class.
3232

33-
When used in a POST request with `Content-Type: application/json`, this adds an attribute `fields` with
34-
an object value to the core JSON search request body. The `fields` object contains two attributes with string array
33+
When used in a POST request with `Content-Type: application/json`, this adds an attribute `fields` with
34+
an object value to the core JSON search request body. The `fields` object contains two attributes with string array
3535
values, `include` and `exclude`.
3636

37-
When used with GET, the semantics are the same, except the syntax is a single parameter `fields` with
38-
a comma-separated list of attribute names, where `exclude` values are those prefixed by a `-` and `include` values are
37+
When used with GET, the semantics are the same, except the syntax is a single parameter `fields` with
38+
a comma-separated list of attribute names, where `exclude` values are those prefixed by a `-` and `include` values are
3939
those with no prefix, e.g., `-geometry`, or `id,-geometry,properties`.
4040

41-
It is recommended that implementations provide exactly the `include` and `exclude` sets specified by the request,
42-
but this is not required. These values are only hints to the server as to the desires of the client, and not a
43-
contract about what the response will be. Implementations are still considered compliant if fields not specified as part of `include`
44-
are in the response or ones specified as part of `exclude` are. For example, implementations may choose to always
45-
include simple string fields like `id` and `type` regardless of the `exclude` specification. However, it is recommended
46-
that implementations honor excludes for attributes with more complex and arbitrarily large values
47-
(e.g., `geometry`, `assets`). For example, some Item objects may have a geometry with a simple 5 point polygon, but these
41+
It is recommended that implementations provide exactly the `include` and `exclude` sets specified by the request,
42+
but this is not required. These values are only hints to the server as to the desires of the client, and not a
43+
contract about what the response will be. Implementations are still considered compliant if fields not specified as part of `include`
44+
are in the response or ones specified as part of `exclude` are. For example, implementations may choose to always
45+
include simple string fields like `id` and `type` regardless of the `exclude` specification. However, it is recommended
46+
that implementations honor excludes for attributes with more complex and arbitrarily large values
47+
(e.g., `geometry`, `assets`). For example, some Item objects may have a geometry with a simple 5 point polygon, but these
4848
polygons can be very large when reprojected to EPSG:4326, as in the case of a highly-decimated sinusoidal polygons.
4949
Implementations are also not required to implement semantics for nested values whereby one can include an object, but
5050
exclude attributes of that object, e.g., include `properties` but exclude `properties.datetime`.
5151

52-
No error must be returned if a specified field has no value for it in the catalog. For example, if the attribute
52+
No error must be returned if a specified field has no value for it in the catalog. For example, if the attribute
5353
"properties.eo:cloud_cover" is specified but there is no cloud cover value for an Item, a successful HTTP response
54-
must be returned and the Item entities will not contain that
55-
attribute.
54+
must be returned and the Item entities will not contain that
55+
attribute.
5656

5757
If no `fields` are specified, the response is **must** be a valid
5858
[ItemCollection](https://github.com/radiantearth/stac-spec/tree/v1.0.0-rc.2/itemcollection/README.md). If a client excludes
59-
attributes that are required in a STAC Item, the server may return an invalid STAC Item. For example, if `type`
60-
and `geometry` are excluded, the entity will not even be a valid GeoJSON Feature, or if `bbox` is excluded then the entity
59+
attributes that are required in a STAC Item, the server may return an invalid STAC Item. For example, if `type`
60+
and `geometry` are excluded, the entity will not even be a valid GeoJSON Feature, or if `bbox` is excluded then the entity
6161
will not be a valid STAC Item.
6262

63-
Implementations may return attributes not specified, e.g., id, but must avoid anything other than a minimal entity
63+
Implementations may return attributes not specified, e.g., id, but must avoid anything other than a minimal entity
6464
representation.
6565

6666
This specification does not yet require the implementation of an "-ables" endpoint (like CQL2 does for queryables)
@@ -79,18 +79,26 @@ This default is so that the entity returned is a valid STAC Item.
7979
Implementations may choose to include other properties, e.g., `properties.created`, but the number
8080
of default properties attributes should be kept to a minimum.
8181
2. If only `include` is specified, these attributes should be the only attributes included.
82-
3. If only `exclude` is specified, these attributes should be subtracted from the full item.
83-
This may result in an entity that is not a valid STAC Item.
82+
If additional fields are provided beyond those in the `include` list, the number and size of
83+
these attributes should be kept to a minimum.
84+
3. If only `exclude` is specified, these attributes fields should not be
85+
included in the response Item object, but every other fields available for the
86+
Item should be included.
8487
4. If `exclude` is specified and `include` is null or an empty
8588
array, then the `exclude` attributes should be excluded from the default set.
86-
This may result in an entity that is not a valid STAC Item.
87-
5. If a key is in `exclude`, and a sub-key is in `include`, the sub-key should be included, but no other fields
88-
in the key should be included. For example, if `properties` is excluded and `properties.datetime` is included, then `datetime`
89-
should be the only attribute in `properties`.
90-
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.
91-
For example, if `properties` is included and `properties.datetime` is excluded, then `datetime`
92-
should not be in `properties`.
93-
7. If the same attribute is present in both `include` and `exclude`, it should be included.
89+
5. For nested attributes (e.g. `properites.datetime`), the most specific path
90+
should be honored first, and `include` should be preferred over `exclude`. For
91+
example:
92+
1. If a field is in `exclude`, and a nested attribute of that field is in
93+
`include`, the nested attribute should be included, but no other nested
94+
attributes in the field should be included. For example, if `properties` is
95+
excluded and `properties.datetime` is included, then `datetime`
96+
should be the only nested attribute in `properties`.
97+
2. If a field is in `include`, and a nested attribute is in `exclude`, the field
98+
should be included, and the nested attribute should be excluded. For example,
99+
if `properties` is included and `properties.datetime` is excluded, then
100+
`datetime` should not be in `properties`.
101+
6. If the same field is present in both `include` and `exclude`, it should be included.
94102

95103
## Examples
96104

@@ -138,7 +146,7 @@ JSON
138146
}
139147
```
140148

141-
Exclude `geometry` from the full item. This **must** return an entity that is not a valid GeoJSON Feature or a valid STAC Item.
149+
Exclude `geometry` from the full item. This will return an entity that is not a valid GeoJSON Feature or a valid STAC Item.
142150

143151
Query Parameters
144152

@@ -159,7 +167,9 @@ JSON
159167
```
160168

161169
Return the `id`, `type`, `geometry`, and the Properties attribute `eo:cloud_cover`.
162-
This might not return a valid STAC Item, since not all required Item attributes are included.
170+
This is not guaranteed not return a valid STAC Item, since not all required Item
171+
attributes are included, but an implementor may choose to return a valid STAC
172+
item anyways.
163173

164174
Query Parameters
165175

0 commit comments

Comments
 (0)