-
Notifications
You must be signed in to change notification settings - Fork 64
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
Support for (virtual) array attributes #408
Comments
I've been in the same place while testing file params. The way I worked around this was to create a subclass for https://github.com/luckyframework/avram/pull/404/files#diff-dcf82d31916d537fe7e9380227ffc216 But that's obviously not an ideal solution. I think |
I'd like to refactor Avram to be able to remove |
Now that luckyframework/lucky#1380 is done, here's what we need to do:
I think that will get array attributes working |
Unfortunately I was wrong. luckyframework/lucky#1380 added @jwoertink Got any opinions on this? |
|
@jwoertink This is kind of why I think |
Oh that's right. Yeah, the params definitely need a bit of thought. @paulcsmith and I have tried to tackle it a few times, but it's not an easy problem to solve. I have some ideas that I think I sent over to you before, but I can send those again. I'm just limited on time at the moment to really sit down and attack it. Does doing something like this work? I think it all just goes back to the fact that Avram shouldn't care about HTTP Params. We should bring back this discussion luckyframework/lucky#727. Though, that's about just the Lucky side. Let's figure out a time we can hop on a chat to go over a path for this. Then we can document that path, and figure out if there's an easy migration/change, or if it'll just be a single massive overhaul from the ground up (most likely lol) |
I tried to setup a
Avram::Operation
with an array attribute:Sadly this will not compile, because crystal does not currently support nested constants in generics. In #151 @jwoertink added array support for column values and found a nice workaround.
So as a first step, I tried to use this workaround and change
avram/src/avram/define_attribute.cr
Line 95 in af99911
to
Then my app did compile successfully. I have not checked if it actually works yet, because I thought this would be a nice little fix I could prepare a PR for.
Sadly, I failed because when I tried to add specs, they blew up:
I think the reason is that the specs use
Avram::Params
which only supports a flatString => String
mapping. If my theory is correct, my app compiles, because it usesLucky::Params
which does support nested structures.If someone knows an easy fix, I would be happy to continue the work on a PR.
But more importanty I think this could be valuable input for luckyframework/lucky#1209
The text was updated successfully, but these errors were encountered: