-
Notifications
You must be signed in to change notification settings - Fork 0
Allow for more explicit API declarations #10
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
Conversation
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.
Pull Request Overview
This PR enables more explicit API declarations by implementing a structured approach to mark APIs as either safe to expose or internal-only. It introduces new annotation markers and a lint check to enforce proper API classification.
- Remove @StreamCoreApi annotation and replace with @StreamPublishedApi and @StreamInternalApi
- Enable explicit API mode in Kotlin compiler to require visibility modifiers
- Add lint detector to enforce API annotation requirements
Reviewed Changes
Copilot reviewed 47 out of 48 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| build.gradle.kts | Enable explicit API mode and update compiler opt-ins |
| StreamApiMarkers.kt | Replace @StreamCoreApi with @StreamPublishedApi annotation |
| StreamApiExplicitMarkerDetector.kt | New lint detector to enforce API annotation requirements |
| Multiple API files | Replace @StreamCoreApi with @StreamInternalApi/@StreamPublishedApi and add public modifiers |
| lint.xml | Update lint configuration for new API marker rule |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.../src/main/java/io/getstream/android/core/api/model/config/StreamClientSerializationConfig.kt
Show resolved
Hide resolved
.../src/main/java/io/getstream/android/core/api/model/config/StreamClientSerializationConfig.kt
Show resolved
Hide resolved
.../src/main/java/io/getstream/android/core/api/model/config/StreamClientSerializationConfig.kt
Show resolved
Hide resolved
stream-android-core/src/main/java/io/getstream/android/core/api/model/StreamTypedKey.kt
Outdated
Show resolved
Hide resolved
stream-android-core/src/main/java/io/getstream/android/core/api/model/StreamTypedKey.kt
Show resolved
Hide resolved
gpunto
left a comment
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.
Looks good, just a few doubts
Goal
Allow for more explicit API declaration from within core.
Implementation
Enable explicit-api=struct
Add new annotation
@StreamPublishedApi
remove @StreamCoreApi
Add a new lint check for @StreamPublishedApi
In a nutshell a public api in the core.api package has to be either @StreamPublishedApi (safe to expose) or @StreamInternalApi (unsafe to expose) and even if exposed by accident still requires opt in from integration side.