samvera / hydra-editor

A basic editor for samvera objects.
Other
10 stars 13 forks source link

Reevaluate dependency upon ActiveFedora #172

Open jrgriffiniii opened 4 years ago

jrgriffiniii commented 4 years ago

This was proposed by @tpendragon, and perhaps calls to the Gem (such as what is found on https://github.com/samvera/hydra-editor/blob/master/lib/hydra_editor/controller_resource.rb#L3) could be removed for a future minor release.

jrgriffiniii commented 4 years ago

https://github.com/samvera/hydra-editor/commit/032f9ea520757f2dc26304c8bc4794ae4b544328 should remove ActiveFedora as a dependency, and https://github.com/samvera/hydra-editor/commit/4b10480914c7f878da1d2a3c9e3d9a495854d077 hard-codes the three supported ORMs. This is far from an ideal approach, but my sense is that one shouldn't encounter compatibility issues for all three cases handled.

no-reply commented 4 years ago

What's the contract for a supported ORM?

Instead of hard coding, could we make orm_class configurable?

I suspect 4b10480 will break Hyrax, since both Valkyrie and ActiveFedora are defined.

jrgriffiniii commented 4 years ago

I'm definitely in support of making orm_class configurable, but first I'll need to address some outstanding compatibility issues for ActiveRecord Models (if, indeed, these should be supported - I don't know if that's going to be considered necessary for a future release).

I needed to squash a number of commits to get stubbing properly working for https://github.com/samvera/hydra-editor/commit/8a965f175e0209ecb999fc3a4169c6c07f923f14 and https://github.com/samvera/hydra-editor/commit/0f9b2ad9f76869185e96668702f20c8bc241a5fb.

Regarding the contract, my suspicion is that it is probably going to require either .reflect_on_association or .schema on the Class (ActiveRecord does not appear to offer either in https://api.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html, but perhaps this is the wrong section in the documentation).

tpendragon commented 4 years ago

@no-reply Does Hyrax use the features that hydra-editor uses the ORM for? I vaguely remember just using the partial lookup bit, but I might be mixed up.

tpendragon commented 4 years ago

For instance, Hyrax seems to have its own ControllerResource: https://github.com/samvera/hyrax/blob/5a9d1be16ee1a9150646384471992b03aab527a5/lib/hyrax/controller_resource.rb

jrgriffiniii commented 4 years ago

Maybe https://github.com/samvera/hydra-works/issues/352 provides some guidance here?