hyku icon indicating copy to clipboard operation
hyku copied to clipboard

I102 valkyrie validations

Open ShanaLMoore opened this issue 1 year ago • 3 comments

Create change set for model resources and a TitleValidator.

Enforce the validator with generic_work_resource_cs = GenericWorkChangeSet.new(GenericWorkResource.new). 

generic_work_resource_cs.valid? => false

generic_work_resource_cs.errors.messages => => {:title=>["can't be blank", "Your work must have a title."]}

Issue:

  • https://github.com/scientist-softserv/hykuup_knapsack/issues/102

Docs:

  • https://github.com/samvera/valkyrie/wiki/Persisting-changes-through-synchronization#successfully-change-and-save

TODO

  • [x] Confirm via rails console
  • [ ] Confirm via UI/manual work creation

ShanaLMoore avatar Jan 09 '24 19:01 ShanaLMoore

consider making a default changeset

ShanaLMoore avatar Jan 10 '24 16:01 ShanaLMoore

As discussed with LaRita, we're holding off on this merge. Is this the right way to do this? Can validations be enforced using the yaml?

ShanaLMoore avatar Jan 16 '24 16:01 ShanaLMoore

When I made title not be a required field on the form, I can still successfully save a generic work resource from the ui, even with the validator. Perhaps it doesn't go through the changeset??

Update: it inherits from Hyrax::ChangeSet 🤔 which doesn't have a title validation. How do I make the resource forms use their respective changesets?

ShanaLMoore avatar Jan 16 '24 17:01 ShanaLMoore