-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Functions Codable after sharing implementation with RTDB #9091
Conversation
Generated by 🚫 Danger |
Coverage ReportAffected SDKs
Test Logs
|
@mortenbekditlevsen @peterfriese Please confirm I merged everything correctly. @ryanwilson This should now be a one-stop PR for review of the Codable changes for Functions and RTDB |
Thanks a ton for putting this together, @paulb777! |
I struggle with the naming of What about something like It would also be useful to update to the latest implementation, along with a comment of the hash we retrieved it at for later comparisons. |
Updated Callable API to use Enabled second way of using API after an internal conversation. See the new test
versus
|
I am glad to see that this got through your internal API review process. Regarding the choice to supply both explicit typing of the callable and inferred typing:
without the And if not: Why might that be? |
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.
@mortenbekditlevsen Thanks for the review. Comments addressed in bdacb29
@mortenbekditlevsen The design choice of supplying both explicit typing of the callable and inferred typing sounds like a good standard to me. @ryanwilson What do you think? BTW, we're not completely through the internal API review yet - but hopefully getting close. 😄 |
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 still need to look at the IntegrationTests.swift
but looking good so far!
That's a really good thought and question. I hadn't considered it since we're in a way duplicating our API surface here, but in this case I think it makes sense since the latter call (explicitly declaring the type and not providing extra arguments) is a much cleaner API due to the ordering (not the first arg) + passing 2 types instead of 1. We don't want to have any APIs that require declaring the type, but in this case it's a pretty huge improvement to readability. For the other APIs it's worth considering, although I'd want to test out code completion and what sort of help Xcode gives when you get it wrong (don't declare the type and don't provide arguments. One other downside of the explicit declared types is when you separate the type declaration from the call site, it makes it less obvious what's going on. Ex: private let myCallable: Callable<Request, Result>
// Some other code...
init() {
myCallable = Functions.functions().httpsCallable("myFunction")
} Don't know if I want to commit to one way or the other right this second but thanks for pointing it out and we'll have to evaluate it! |
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.
Found a couple of typos. Also, should we add code samples for calling using inferred types?
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.
Thanks @peterfriese !
Binary Size ReportAffected SDKs
Test Logs
|
As discussed above, I renamed All comments should be addressed and looking for approvals from @ryanwilson and @peterfriese and optionally @ncooke3, @schmidt-sebastian, and anyone else interested. |
ef4a37e
to
db0ad75
Compare
I squashed the commits from 15 to 5. |
db0ad75
to
ec23d96
Compare
Example: let greeter = functions.httpsCallable("greeter", requestType: GreetingRequest.self, responseType: GreetingResponse.self) let result = try await greeter(data) print(result.greeting) Signed-off-by: Peter Friese <peter@peterfriese.de>
Signed-off-by: Peter Friese <peter@peterfriese.de>
ec23d96
to
ac4df1f
Compare
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.
Just a couple of nits then the tests LGTM, thanks!
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.
Thanks @ryanwilson !
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.
LGTM - excited to see this land!
Umbrella PR that rolls up the following
#8853 from @mortenbekditlevsen to share Codable implementation
#8854 from @mortenbekditlevsen to add Firebase Functions Codable implementation
Additional Functions Codable APIs cherry-picked from @peterfriese's #9057
CI implementation cherry-picked from @paulb777's #8983
Reviewers, you may want to review commit by commit
The FirebaseFunctionsSwift CocoaPods implementation, additional CI and associated documentation will come in follow up PR(s)
I plan to merge this PR without squashing to keep the contribution history in master.