httk.optimade.schema.served

The registry of entry types and properties served by an OPTIMADE deployment.

A ServedSchema narrows a set of first-class EntryTypeDefinition objects (supplied from outside, e.g. by an EntryProvider) down to the entry types and properties a backend implements, and derives the endpoint and response-field tables used during request validation and response generation.

The full OPTIMADE property definitions live in httk-core; this module keeps, for each served property, a small simplified view (its fulltype and the implementation flags) that the filter-translation and response layers consume, alongside the full property definitions served on the entry listing info endpoint.

Classes

ServedSchema

The entry types and properties served, with derived lookup tables.

Functions

fulltype_of(→ str)

Reconstruct the simplified fulltype string of a property definition.

simplified_property(→ dict[str, Any])

A small dialect view of a property definition for the filter/wrap layers.

entry_type_definition_from_simple(...)

Build an EntryTypeDefinition from the simplified dialect.

build_served_schema(→ ServedSchema)

Build a ServedSchema from entry-type definitions.

Module Contents

httk.optimade.schema.served.fulltype_of(definition: httk.core.PropertyDefinition) str[source]

Reconstruct the simplified fulltype string of a property definition.

Maps the OPTIMADE type back to the compact spelling used by the filter layer: "string"/"integer"/"float"/"boolean"/"timestamp", "dict" for dictionaries, and "list of ..." (nesting through the definition’s items) for lists.

httk.optimade.schema.served.simplified_property(definition: httk.core.PropertyDefinition, *, sortable: bool = False, required_response: bool = False, default_response: bool = False) dict[str, Any][source]

A small dialect view of a property definition for the filter/wrap layers.

Carries the description, reconstructed fulltype, the implementation flags (sortable/required_response/default_response), and — when present — the property’s unit and dimensions (used by the trajectory frame-wrapping).

httk.optimade.schema.served.entry_type_definition_from_simple(name: str, info: collections.abc.Mapping[str, Any]) httk.core.EntryTypeDefinition[source]

Build an EntryTypeDefinition from the simplified dialect.

info is a {"description": <str>, "properties": {<name>: <simplified property dict>}} mapping (as produced by, e.g., trajectories_entry_info()); each property is generated with from_simple().

class httk.optimade.schema.served.ServedSchema[source]

The entry types and properties served, with derived lookup tables.

entry_info: dict[str, dict[str, Any]][source]
recognized_prefixes: tuple[str, Ellipsis][source]
all_entries: tuple[str, Ellipsis][source]
valid_endpoints: tuple[str, Ellipsis][source]
properties_by_entry: dict[str, tuple[str, Ellipsis]][source]
default_response_fields: dict[str, tuple[str, Ellipsis]][source]
required_response_fields: dict[str, tuple[str, Ellipsis]][source]
unknown_response_fields: dict[str, tuple[str, Ellipsis]][source]
sortable_response_fields: dict[str, tuple[str, Ellipsis]][source]
property_definitions: dict[str, dict[str, dict[str, Any]]][source]
httk.optimade.schema.served.build_served_schema(definitions: collections.abc.Mapping[str, httk.core.EntryTypeDefinition], served: collections.abc.Mapping[str, collections.abc.Sequence[str]] | None = None, *, default_response_overrides: collections.abc.Mapping[str, collections.abc.Sequence[str]] | None = None, sortable: collections.abc.Mapping[str, collections.abc.Sequence[str]] | None = None, recognized_prefixes: tuple[str, Ellipsis] | None = None) ServedSchema[source]

Build a ServedSchema from entry-type definitions.

definitions maps each served entry type name to its full EntryTypeDefinition. served maps each entry type to the subset of property names actually served (defaulting to every property the definition describes); every served name MUST be described by the definition (a ValueError names any offender). id and type are always default- and required-response; default_response_overrides marks additional served properties as default-response, and sortable marks served properties as sortable. recognized_prefixes defaults to the prefixes currently registered via register_definition_prefix() (resolved at call time so newly registered prefixes are honored).