-
Notifications
You must be signed in to change notification settings - Fork 134
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
Honor custom types for array items #1131
Conversation
def propMetaWithName[L <: LA, F[_]](tpe: L#Type, property: Tracker[Schema[_]])( | ||
def propMetaWithName[L <: LA, F[_]](tpe: L#Type, property: Tracker[Schema[_]], arrayTypeLifter: (L#Type, Option[L#Type]) => F[L#Type])( |
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 don't love arrayTypeLifter
, but one of my goals here was to use the same type resolution code for protocol objects and parameters. The issue here is that for protocol objects we want to use a concrete type like Vector
, but for client parameters, we don't care which type the caller passes, so we want to use Iterable
.
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.
Hrm, it appears that this ends up using the abstract container type for server routes, which almost certainly will not work.
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.
Actually, I guess that was always happening. For Java stdlib it's not a problem since it's always a concrete type, and I guess for the Scala stuff the routes don't have types listed? But for Java Vavr I'm using Seq
now, which will not work. I guess I can go back to Vector
. Hrm.
4b7e4da
to
3b65406
Compare
Previously this only worked for protocol objects; now it also works for parameters and in-line request bodies.
3b65406
to
84d2583
Compare
Ugh, so this does seem to break things, but because we were arguably doing questionably-wrong things previously. Every array param was always But now that it does the right thing, the defaults break when the real type isn't
And also it can't properly generate routes on the server for non-string params:
|
I'm actually surprised the latter thing doesn't work, because I thought you were generating akka unmarshallers automatically from circe decoders? |
@kelnos This is definitely done for non-array members, though I've had to restrict the Directives stuff quite a bit to prevent overeager JSON decoders, for instance requiring JSON-encoded path parameters like I'll take a look at this sometime this week, thank you for driving this |
Ah, makes sense. Just to summarize, there are three issues:
|
Going to close this in favor of #1407, all functionality here should be reflected in the new unified codepath. |
Previously this only worked for protocol objects; now it also works for parameters and in-line request bodies.
Addresses #738