-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add SQSEvent #58
Add SQSEvent #58
Conversation
Thanks for taking this on! And being first, while we figure these things out :)
|
} | ||
|
||
final case class SQSRecordAttributes( | ||
awsTraceHeader: Option[String], |
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.
@bpholt Now this is interesting!
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.
Hmm, a subtlety I missed is that this trace header is not on the event itself, but rather on each individual record in the event.
Oh, regarding integers represented as strings: the JSON spec effectively treats all numbers as |
I understand that part, what I don't know is what kind of types we want after decoded. My |
Later I'll remove the case classes and add the test |
|
So by isomorphic, I mean that the typescript types indicate how this stuff is encoded in the JSON. So our decoders should match the typescript encoding exactly. However, our own classes/models for these events can/should use idiomatic Scala types as much as possible. |
Regarding newtypes, I'd like to hear @bpholt's and others thoughts on this, since I don't have much experience with them. However, I'm not yet convinced of their usefulness here. AFAICT newtypes are most helpful when they can be shared across many APIs, otherwise you end up converting between them via the For example, it would be nice to use Edit: there's an |
Re: newtypes: IMO, if they can be used by other APIs too, that's nice, but it is not the primary purpose. We used newtypes when creating the custom CloudFormation resource request to help users of the library distinguish at the type level between the different kind of strings present in the input. The |
Thanks for explaining! That makes sense. I think the only "cost" is the choice of encoding, what do you think about the monix one? |
I don't have a strong preference (which in practice means that some of our internal projects use several different newtype encodings in various places, oops 🤷🏻♂️). The Monix one works with Scala 3 and doesn't pull in all of Shapeless. |
Seems there were some recent updates to the SQSEvent in DefinitelyTyped/DefinitelyTyped#57488, it now has a return type! Regarding monix-newtypes, I inquired about its future in monix/newtypes#5. |
approximateReceiveCount: String, | ||
sentTimestamp: String, | ||
senderId: String, | ||
approximateFirstReceiveTimestamp: String, |
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.
FiniteDuration
for this?
@fredshonorio FYI I'll probably merge this as-is tomorrow. I'm pushing to put together a pre-release so people can start playing with feral and I'd much rather have this in than out! We'll keep iterating on these models as we figure out what we want to do about the questions you raised. Thanks for all your efforts! |
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.
Our first contributor ❤️ thank you!
Here's the first one, once I get these questions answered I'll hopefully pick up the pace and add more events:
ApproximateReceiveCount
)