-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adding the optional routing in the to core #1229
Conversation
…with the optional routing
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.
I believe it does still need additional specs for accessing the param. If you try to access the optional param it needs to be nilable
but right now I don't believe it is. It would likely raise a NilAssertionError if the param is missing from the path :(
Ah, gotcha. Ok, I'll take a look at that! |
Nice! I believe this is the spot: Lines 198 to 203 in 72336b7
starts_with?("?:") and use params.get?() . I think it'll also need to update the with and route helpers so that the params can be nil and they have a default value of nil which is somewhere in here I think :P Lines 228 to 243 in 72336b7
|
😂 ok, so now that I just merged in that Avram update, this is failing. Should I include those Avram updates in this? Or make a separate PR to update that, then get that PR merged in to here? 🤔 |
@jwoertink I think a separate PR with Avram fixes would be good since it’s small and we can get that in super fast |
@paulcsmith Alright, I sent in that other PR and merged it in. It was a pretty small change. Let me know if you see any cases missing on this one. |
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.
I think that covers everything. LGTM!
Purpose
Optional path params were added in to the router luckyframework/lucky_router#18 but there was never a test done to see if Lucky core needed any updates. I added a spec to see if we needed to do anything, and it doesn't look like it.
Checklist
crystal tool format spec src
./script/setup
./script/test