Skip to content

Conversation

@devmil
Copy link
Member

@devmil devmil commented Jul 23, 2025

Description

in a PR of protobuf there were some hints of weird dart_apitool behavior (google/protobuf.dart#1026)
The main issue was that parameter type changes are detected that are none (TypeX changed to TypeX)

To investigate this issue more easily I also added git support for the package ref (solving #204 ).
And while trying get rid of all wrong changes I also fixed (parts of) #228 (private top level functions). I still need to check for other private types, though.

There were two major issues that are now fixed:

  1. the package resolution was no longer working for package refs ('package:xxx/yyy.dart') always falling back to the "file name without extension". In the protobuf case the entry point changed from "protobuf.dart" to "internal.dart" for a couple of types and for all of those types dart_apitool detected a package change (protobuf -> internal) which is wrong. This PR adds support for package refs and also turns file URIs into file paths before looking for the pubspec.yaml
  2. private top level functions were considered part of the public API (the method _onVisitFunctionElement did the right checks but this method was also used for top level and local functions that called into their super method of the RecursiveElementVisitor making it iterating through all parameters regardless

Type of Change

  • 🚀 New feature (non-breaking change)
  • 🛠️ Bug fix (non-breaking change)
  • ⚠️ Breaking change (feature or bug fix which breaks existing behaviors/APIs)
  • 🏗️ Code refactor
  • ⚙️ Build configuration change
  • 📝 Documentation
  • 🧹 Chore / Housekeeping

devmil added 3 commits July 23, 2025 17:27
it now gets a file URI which confused the logic to search for the next pubspec.yaml to gather the package name.
This ended up in taking the file name as a package name which changed for protobug from "protobuf.dart" to "internal.dart" causing dart_apitool to detect a change.
Additionally package refs ('package:xx') were not treated correctly
@devmil devmil linked an issue Jul 23, 2025 that may be closed by this pull request
@devmil devmil changed the title Fix/2025 07 23 weird protobug changes Fix weird protobuf changes Jul 23, 2025
@devmil devmil enabled auto-merge (squash) July 23, 2025 17:34
@devmil devmil merged commit c2fbdc5 into main Jul 24, 2025
11 checks passed
@devmil devmil deleted the fix/2025-07-23_weird_protobug_changes branch July 24, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Make it possible to use git tags/urls as target for old/new

3 participants