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¶
The entry types and properties served, with derived lookup tables. |
Functions¶
|
Reconstruct the simplified |
|
A small dialect view of a property definition for the filter/wrap layers. |
Build an |
|
|
Build a |
Module Contents¶
- httk.optimade.schema.served.fulltype_of(definition: httk.core.PropertyDefinition) str[source]¶
Reconstruct the simplified
fulltypestring 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’sitems) 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, reconstructedfulltype, the implementation flags (sortable/required_response/default_response), and — when present — the property’sunitanddimensions(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
EntryTypeDefinitionfrom the simplified dialect.infois a{"description": <str>, "properties": {<name>: <simplified property dict>}}mapping (as produced by, e.g.,trajectories_entry_info()); each property is generated withfrom_simple().
- class httk.optimade.schema.served.ServedSchema[source]¶
The entry types and properties served, with derived lookup tables.
- 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
ServedSchemafrom entry-type definitions.definitionsmaps each served entry type name to its fullEntryTypeDefinition.servedmaps 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 (aValueErrornames any offender).idandtypeare always default- and required-response;default_response_overridesmarks additional served properties as default-response, andsortablemarks served properties as sortable.recognized_prefixesdefaults to the prefixes currently registered viaregister_definition_prefix()(resolved at call time so newly registered prefixes are honored).