REST router#
The HTTP surface the middleware exposes.
REST routes, generated recursively to the complex property.
The middleware extends the CRUD API of the resource datamodel with recursive routes. These routes descend
the datamodel tree. They terminate at each interface-accessible parameter. This parameter is a
PropertyValueKind.COMPLEX property. Its blanknode dict is the atomic addressable unit. The
framework generator produces only top-level CRUD. This module adds the parameter routes beneath it.
Recursion terminates at COMPLEX properties. RDF has no properties about properties. Metadata about
a conveyor speed is its unit and its MQTT topic. The middleware models this metadata as a blanknode.
This blanknode hangs off the parameter property. That blanknode materializes as an AnonymousClass
with no id. It is not Identifiable. It is never routable. Treat the blanknode dict as the
atomic element. This approach makes the id-less problem disappear. The property is the last
segment. The dict is the body. Value and unit move together. They must move together. A speed
without its unit is not a speed.
Every value in this tree is a list. RDF multiplicity requires this (research doc 0029). This requirement includes scalars. The original example showed a bare dict. That example predates the finding. The payload is a list of parameter dicts. It is not a bare dict.
Verb gating is per individual. One belt may be readwrite. A barrier on the same unit may be
read. Path segments are therefore literal. They are not FastAPI path parameters. A
parameterized route could not express per-individual verb differences. A PUT to a read-only
parameter returns 405. The route does not exist. FastAPI handles that automatically.
The request or response type comes from the owning node model field annotation. It does not
come from binding.node_model_type. The latter comes from the full spec. It carries southbound
connection metadata. The northbound instance owns its annotation. That annotation is the pruned
shape. Use the wrong one. This mistake leaks broker addresses northbound.
- kapps_semantic_middleware.rest_router.generate_recursive_rest_api(middleware: Any, data_model_name: str, *, root_id: str, instance: Any, bindings: Sequence[ParameterBinding]) List[str][source]#
Generate the REST surface of the resource middleware. Generate top-level CRUD plus recursive parameter routes.
Call
middleware.generate_rest_api_for_data_modelfirst. This produces the unchanged top-level CRUD. Then walk the instance tree. Mount parameter routes beneath it. Return the list of generated parameter route paths. Count the path string per route. Count GET and PUT of the same path once. Ordering is tree order. It is depth-first.- Parameters:
middleware – The semantic middleware instance. It provides
app,persistence_registry, andgenerate_rest_api_for_data_model.data_model_name – The name of the data model for ConnectionInfo.
root_id – The IRI of the root resource instance.
instance – The materialized root instance. Walk its tree.
bindings – The recognized ParameterBindings from WiringPlan.bindings.
- Returns:
List of generated parameter route paths. Empty if the instance has no id.