Skip to content

FirestoreSwift: Make DocumentID setter internal #10304

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

Closed
wants to merge 2 commits into from

Conversation

andrewheard
Copy link
Contributor

This is an alternative to the warning-only approach proposed in the latest DocumentID API review.

Made the @DocumentID property wrapper's value setter internal. DocumentID is currently read-only and is only populated when reading from Firestore. This PR limits access to the setter since the value is ignored when writing to Firestore.

Updated the constructor to always set nil, regardless of the wrappedValue provided. Developers are notified of this via an existing log message warning them that the value is ignored.

Added conformance tests to verify (and demonstrate) the functionality change.

Made the @documentid property wrapper's value setter internal. DocumentID is currently read-only and is only populated when reading from Firestore. This limits access to the setter since the value is ignored when writing to Firestore.

Updated the constructor to always set nil, regardless of the wrappedValue provided. Developers are notified of this via an existing log message warning them that the value is ignored.

Added conformance tests to verify (and demonstrate) the functionality change.
@google-oss-bot
Copy link

google-oss-bot commented Oct 4, 2022

Coverage Report 1

Affected Products

  • FirebaseFirestore-iOS-FirebaseFirestore.framework

    Overall coverage changed from 87.92% (a15469e) to 87.95% (ed16edc) by +0.03%.

    FilenameBase (a15469e)Merge (ed16edc)Diff
    exception.cc23.68%84.21%+60.53%
    exception_apple.mm96.55%65.52%-31.03%
    leveldb_key.cc98.82%98.63%-0.20%
    leveldb_mutation_queue.cc93.56%92.42%-1.14%
    task.cc94.78%93.91%-0.87%
  • FirebaseFirestore-iOS-FirebaseFirestoreSwift.framework

    Overall coverage changed from 46.92% (a15469e) to 46.79% (ed16edc) by -0.13%.

    FilenameBase (a15469e)Merge (ed16edc)Diff
    DocumentID.swift86.44%85.96%-0.48%

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/VLg6YpdwFW.html

@andrewheard andrewheard added this to the Firebase 11 milestone Oct 5, 2022
}

public var wrappedValue: Value? {
/// Gets the document identifier if populated; `nil` otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we always call it document ID (not document identifier)

@paulb777
Copy link
Member

Please close, merge, or comment. We plan to close stale PRs on November 28, 2023.

@andrewheard andrewheard deleted the ah-documentid-internal-setter branch November 14, 2023 15:59
@firebase firebase locked and limited conversation to collaborators Dec 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants