feat(app): Add ability for initializeApp to accept a JSON string#9978
feat(app): Add ability for initializeApp to accept a JSON string#9978hsubox76 wants to merge 9 commits into
Conversation
🦋 Changeset detectedLatest commit: 5d80c59 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Code Review
This pull request enables the initialization of FirebaseApp and FirebaseServerApp instances using JSON configuration strings, including necessary updates to the API surface, error handling for JSON parsing, and expanded test coverage. The review feedback identifies several areas for improvement, including correcting JSDoc parameter documentation, implementing safer type validation for parsed JSON objects, updating a misleading test description, and removing a duplicate test case.
This PR is built on top of #9904
(internal link) API proposal go/initializeapp-with-strings
Allows initializeApp() to be initialized with a string.
initializeApp()can currently be called withUsers often store the config as a JSON string when it needs to come from a secret or an environment variable, and then need to decode it, which can be error prone. To avoid this, users often store each property in separate secrets or environment variables, which can be cumbersome.
This change also accepts a JSON stringified string as an argument and automatically
JSON.parses it, throwing an actionable error if the parse fails.