Skip to content

Add title parameter to all static functions in Schema class #14971

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

Merged
merged 6 commits into from
Jun 13, 2025

Conversation

SeanChinJunKai
Copy link
Contributor

Hey there! So you want to contribute to a Firebase SDK?
Before you file this pull request, please read these guidelines:

Discussion

Closes #14961

Testing

  • Make sure all existing tests in the repository pass after your change.
  • If you fixed a bug or added a feature, add a new test to cover your code.

API Changes

  • At this time we cannot accept changes that affect the public API. If you'd like to help
    us make Firebase APIs better, please propose your change in a feature request so that we
    can discuss it together.

Copy link
Contributor

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

@SeanChinJunKai
Copy link
Contributor Author

SeanChinJunKai commented Jun 12, 2025

Hi @andrewheard, I have checked that both Vertex AI and Gemini API accepts the title parameter.

References:
https://cloud.google.com/vertex-ai/docs/reference/rest/v1beta1/FunctionDeclaration#Schema
https://ai.google.dev/api/caching#Schema

Also, I was unable to run unit test locally due to some unsupported architecture error on my IPhone

Copy link
Contributor

@andrewheard andrewheard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @SeanChinJunKai! This looks great. The two CI failures (the quickstart and integration tests) are just because you're working from a fork, nothing wrong with your code changes.

I also added a bunch of titles in the integration test and ran them locally. Everything worked as expected. 😃 Don't worry about updating the integration tests though (too much of a pain to do for external contributors).

If you have time though, would be great to add title to the unit tests in https://github.com/firebase/firebase-ios-sdk/blob/5902b4087de393025cfda096091ad08743c3f3f2/FirebaseAI/Tests/Unit/Types/SchemaTests.swift.

@SeanChinJunKai
Copy link
Contributor Author

SeanChinJunKai commented Jun 13, 2025

Hey @andrewheard, thanks for the help. I'll make the changes and add the unit tests later

@paulb777
Copy link
Member

Thanks @SeanChinJunKai Looks like a styling and unit test issue remain

@SeanChinJunKai
Copy link
Contributor Author

Hi @paulb777, I have fixed the styling issue. Trying to resolve the unit test issue but im unable to run unit tests locally

@andrewheard
Copy link
Contributor

I have fixed the styling issue. Trying to resolve the unit test issue but im unable to run unit tests locally

Thanks, @SeanChinJunKai! I think I know why the unit tests are failing. We're using the following setting for the JSONEncoder in the tests:

encoder.outputFormatting = [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]

The title properties in the JSON just need to be in alphabetical order because of .sortedKeys (I added that because otherwise they come out in a random order and my tests intermittently failed -- really confused me at first 😂).

Just saw your new commit... you figured this out already.

Copy link
Contributor

@andrewheard andrewheard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @SeanChinJunKai! LGTM, just need to revert the one Package.swift line change and we're good to merge 😃

Copy link
Contributor

@andrewheard andrewheard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feature request and implementing it, @SeanChinJunKai! Let us know if there's anything else we can help with, if you have any more feature requests, or if you build something cool with the SDK 😄

@andrewheard andrewheard merged commit 07ecf70 into firebase:main Jun 13, 2025
42 of 54 checks passed
andrewheard added a commit that referenced this pull request Jun 13, 2025
@SeanChinJunKai
Copy link
Contributor Author

SeanChinJunKai commented Jun 14, 2025

Thanks @andrewheard. I'm currently leveraging this sdk to build a Firebase AI KMP SDK. I'm curious to know why there is objective-c interopability for modules such as auth 🧐

@paulb777
Copy link
Member

@SeanChinJunKai Thanks for the contribution!

Firebase has been around for years and has many customers with large chunks of Objective-C code. While many of our newer APIs are Swift only, we're still continuing to support the longer-lived APIs in both languages.

@SeanChinJunKai
Copy link
Contributor Author

SeanChinJunKai commented Jun 16, 2025

Hi @paulb777 thanks for the response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FR]: Adding title property for Schema static function constructors in FirebaseAI
3 participants