-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Infer route in action generators instead of using route macro #1378
Infer route in action generators instead of using route macro #1378
Conversation
@@ -0,0 +1,99 @@ | |||
class Lucky::RouteInferrer |
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.
This class was copied from https://github.com/luckyframework/lucky/blob/master/src/run_macros/infer_route.cr and lightly modified
I'm not sure how much more complexity it would add, but is it possible to give users an escape hatch when requesting a non-restful route rather than throwing an error? I was just setting up OAuth today, for example, and ran a bunch of generators like What if we just fallback to a |
@stephendolan That makes sense but I think that should be a separate issue. While you were able to generate the action, you definitely must have gone in and removed the This PR moves the error up to when generating the action, instead. |
Yes, that's true! I mostly just use it to quickly scaffold up folders and file names for me. |
@stephendolan O wait, this issue is exactly what you want #1098 That will be done after this one is merged in |
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.
Looks great! It'll be nice to get rid of this thing. I left some comments on the escapes in the strings. I'm good with it either way. So if you prefer as is, feel free to merge in.
FYI I am getting the following error when building
|
Well that's an interesting error 🤨 |
Purpose
Fixes #1097
Description
Before we were utilizing the
route
macro in generated actions to infer the route at compile-time. This updates moves the route inferring into the generator.Breaking Change:
Checklist
crystal tool format spec src
./script/setup
./script/test