openrasta / openrasta-core

OpenRasta core libraries

Home Page:http://openrasta.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switch rendering when returned type is not the one in the selected resource

serialseb opened this issue · comments

Currently, error rendering will fail if a type that's being returned by a method is not the same as the selected resource model.

Need to:

  • Add the hydra codec specifically for resources when we process them, and only when we process them, in the metamodel handler, in the Pre phase. Need to distinguish between models registered by the user vs other models, so we don't inject hydra in places it shouldn't be
  • check on rendering that we do have the correct model. Codec configuration object is there for such scenarios, although it means creating the codec config as a palceholder in the pre phase and setting it up in the post phase, so as to respect immutability of the model rules. We may still miss resources registered after hydra has run its config, there's an ordering problem that's a vaster subject and could be (should be?) fixed by dependency graphing the initialisation phase with a plugin model, and in the short term by ensuring resolving order of enums is registration-sensitive, as in #154

Had to inject a lot more hydra models but the codec now will happily switch to the correct renderer