Skip to content

fields

stac_fastapi.extensions.core.fields.fields

Fields extension.

FieldsConformanceClasses

Bases: str, Enum

Conformance classes for the Fields extension.

See stac-api-extensions/fields

Source code in stac_fastapi/extensions/core/fields/fields.py
14
15
16
17
18
19
20
21
22
23
class FieldsConformanceClasses(str, Enum):
    """Conformance classes for the Fields extension.

    See https://github.com/stac-api-extensions/fields

    """

    SEARCH = "https://api.stacspec.org/v1.0.0/item-search#fields"
    ITEMS = "https://api.stacspec.org/v1.0.0/ogcapi-features#fields"
    COLLECTIONS = "https://api.stacspec.org/v1.0.0-rc.1/collection-search#fields"

FieldsExtension

Bases: ApiExtension

Fields Extension.

The Fields extension adds functionality to the /search endpoint which allows the caller to include or exclude specific from the API response. Registering this extension with the application has the added effect of removing the ItemCollection response model from the /search endpoint, as the Fields extension allows the API to return potentially invalid responses by excluding fields which are required by the STAC spec, such as geometry.

stac-api-extensions/fields

Attributes:

  • default_includes (set) –

    defines the default set of included fields.

  • conformance_classes (list) –

    Defines the list of conformance classes for the extension

Source code in stac_fastapi/extensions/core/fields/fields.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@attr.s
class FieldsExtension(ApiExtension):
    """Fields Extension.

    The Fields extension adds functionality to the `/search` endpoint which
    allows the caller to include or exclude specific from the API response.
    Registering this extension with the application has the added effect of
    removing the `ItemCollection` response model from the `/search` endpoint, as
    the Fields extension allows the API to return potentially invalid responses
    by excluding fields which are required by the STAC spec, such as geometry.

    https://github.com/stac-api-extensions/fields

    Attributes:
        default_includes (set): defines the default set of included fields.
        conformance_classes (list): Defines the list of conformance classes for
            the extension
    """

    GET = FieldsExtensionGetRequest
    POST = FieldsExtensionPostRequest

    conformance_classes: List[str] = attr.ib(
        factory=lambda: [
            FieldsConformanceClasses.SEARCH,
        ]
    )
    schema_href: Optional[str] = attr.ib(default=None)

    def register(self, app: FastAPI) -> None:
        """Register the extension with a FastAPI application.

        Args:
            app (fastapi.FastAPI): target FastAPI application.

        Returns:
            None
        """
        pass

register

register(app: FastAPI) -> None

Register the extension with a FastAPI application.

Parameters:

  • app (FastAPI) –

    target FastAPI application.

Returns:

  • None

    None

Source code in stac_fastapi/extensions/core/fields/fields.py
55
56
57
58
59
60
61
62
63
64
def register(self, app: FastAPI) -> None:
    """Register the extension with a FastAPI application.

    Args:
        app (fastapi.FastAPI): target FastAPI application.

    Returns:
        None
    """
    pass