-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛Account for Valkyrie ID in location indexer #6790
base: main
Are you sure you want to change the base?
Conversation
24cc25b
to
f6a5bec
Compare
In #extract_id we were receiving an error because it didn't account for a Valkyrie::ID in its case statement. This commit adds a case for Valkyrie::ID.
f6a5bec
to
c3386ff
Compare
Test Results 9 files ±0 9 suites ±0 16m 55s ⏱️ -22s Results for commit c3386ff. ± Comparison against base commit 42eccf4. This pull request removes 100 and adds 100 tests. Note that renamed tests count towards both.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems good, approving.
i think a unit test would improve things---it would be really easy to regress this in a refactor.
i also wonder whether a refactor like uri = URI(obj)
wouldn't do the trick? URI()
will already raise an informative error message if you try to cast a type it can't handle:
`URI': bad argument (expected URI object or URI string) (ArgumentError)
this seems better than the ambiguous "not a valid type" message you get in our code.
looking at this closer, i definitely think we should do this refactor. it opens the whole class to extension in a way the type check strictly forecloses. if i can pass a type that ruby URI()
will cast, i should be able to use it here.
I put this back in draft. @no-reply Actually, I think the problem is here. It's forcing based_near to have a value even though we aren't declaring one. If we don't do this, based_near remains an empty [ ], and I no longer need this (or a similar) PR to avoid the error. Is there an issue with removing this line? |
Without passing a string, we get an error when based_near is nil. This was discovered when testing Bulkrax in a valkyrized app. When we uploaded a CSV with no based_near defined, I was getting an error
*** ArgumentError Exception: g410220 is not a valid type
from the #extract_id method.based_near => [#<Valkyrie::ID:0x0000ffff5f734970 @id="g410220">]
This is because at this point, obj is a neither a string or a URI. It's a Valkyrie::ID.
@samvera/hyrax-code-reviewers