Skip to content
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

Don't implicitly include types in the public api that can not be used by the consumer #170

Open
devmil opened this issue Jan 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@devmil
Copy link
Member

devmil commented Jan 9, 2024

Describe the bug
Changes to types that only get passed in and are not directly exported lead to detected API changes.

To Reproduce
See this PR: dart-lang/ecosystem#221
The type GithubApi got changed and dart_apitool detected a change.

Actual and Expected behavior
As GithubApi is only used as an argument to the verify method and not exported directly, no consumer code can be harmed.
dart_apitool should not consider GithubApi as part of the public API as it is not exported directly and only used as input for the package. (That doesn't mean that this method has any value for consumers, though)

System info (please complete the following information):

dart --version
Dart SDK version: 3.2.3 (stable) (Tue Dec 5 17:58:33 2023 +0000) on "macos_arm64"
dart-apitool --version
0.17.0

Implementation hint
To not interfer with #171 it would be best to apply the filter in the diffing logic and keep all implicitly used types in the PackageApi model.
Types that are only used as input can be detected by looking at the typeUsages meta information in the model:

required Set<TypeUsage> typeUsages,

If a type only has TypeUsage.input in this list and no entry points then it can be ignored for the diff.
Btw: It looks like there is no use of TypeUsage.provide any more so we can remove it.

@devmil devmil added the bug Something isn't working label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant