Do a compile-time check to make sure that the configured token_resource
is an Ash.Resource
#749
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
During a refactor of the auth resources, the
tokens.token_resource
field was not updated properly on my user resource, and so I ended up getting a very vague:error
result when trying to create tokens, without any other context. It was caused by the module not existing, but the current checks only check that the value configured is an atom.Errors
Initial error when trying to log in:
After adding some logging, I got this error:
Improvement
Improved compile-time validation of the token_resource option of the tokens DSL by checking that the passed value is an
Ash.Resource
.Further improvements?
Could this be improved to test it being an
AshAuthentication.TokenResource
directly?