Classes() does not support nested operations
aldesantis opened this issue · 0 comments
aldesantis commented
It shouldn't be required to explicitly specify classes when the operation is nested, e.g.
class Create < Pragma::Operation::Create
class CustomCreate < Create
step Pragma::Operation::Macro::Classes()
end
end
Currently, this will fail to locate all the classes, because it looks in the wrong namespace.
Interestingly enough, this works and is just plain Ruby:
self['model.class'] = '???' # not sure how to do this one
self['policy.default.class'] = Policy
self['policy.default.scope.class'] = Policy::Scope
self['decorator.instance.class'] = Decorator::Instance
self['decorator.collection.class'] = Decorator::Collection
self['contract.default.class'] = Contract::Create::CustomCreate
This can be done by computing namespace via string matching rather than indexing, e.g.
operation_klass = 'API::V1::Post::Operation::Create::CustomCreate'
contract_klass = operation_klass.