Issue #3620341: Support a service call as the source of a property

A property whose source reads "@my_module.schedule:forDoctor" is answered by that service instead of by a field. Aggregates, schedules and everything else that is counted rather than read stop needing a subclass, which is what makes the promise that generated files never have to be edited hold.

Configuration that can call code is configuration that can be an attack, so what may be called is decided by the container rather than by this module:

  • A service is callable only after it carries the "myrest_structure_source" tag, and the tagged services are collected into a service locator. The resolver is handed what opted in and cannot reach the container at all.
  • The tag may narrow itself to named methods, which is the recommended form. Without it, a public non-static non-magic method of the tagged service may be named; a private one, a static one and a magic one may not.
  • MyrestServiceSourceInterface::validate() reports the problems in words, for whoever writes a structure down to check before saving it.

The call has one signature - the entity, the settings of the property and a cacheability object the callee adds to - and no failure of it costs more than its own key: an untagged service, a refused method, a service that throws and a value a response cannot carry all produce no key and a line in the log.

The passthrough shape returns what the service answered, unchanged.

Closes #3620341

Merge request reports

Loading