-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Generator adds comment into version controlled source file containing the Openapi annotation #131
Comments
I have the same issue. And also, as a temporary workaround, I've created a script that removes timestamp comment using rps. pubspec.yaml: scripts:
gen-apiclient:
$script: dart run build_runner build --delete-conflicting-outputs --build-filter='lib/my_generator_config.dart'
$after: $remove-timestamp
remove-timestamp:
$script:
$windows: powershell -Command "(Get-Content lib\my_generator_config.dart) -notmatch '^\/\/ Openapi Generator last run' | Foreach-Object { $_ + \"`n\" } | Set-Content lib\my_generator_config.dart -NoNewline"
$default: sed -i '' '/^\/\/ Openapi Generator last run/d' lib/my_generator_config.dart |
I would like to add that this also causes issues when running |
If you don't need to rebuild the API everytime the build runner runs, then add this to your targets:
$default:
builders:
openapi_generator:
enabled: false if you add a new spec or need to update, just set Hope this helps! |
Thank you for the hint. It seems my case is one of "you are not using it correctly". I would still prefer that the tool would not touch my manually written files. IMO it would be better to write this comment into one of the generated files instead. |
Description of the bug
Every time, when the OpenAPI generator runs, it adds following comment line to the source file containing the Openapi annotation:
Since that source file is typically under source control its automatic modification is very annoying, because a developer has either to revert the git change or commit it after each
dart run build_runner build
. The situation becomes even worse, if thedart run build_runner build
is executed each time before the normalflutter build
.Steps to reproduce
execute
dart run build_runner build
Expected behavior
The source file containing the openapi annotation is not touched.
Logs
No response
Screenshots
No response
Platform
macOS
Library version
5.0.2
Flutter version
3.16.9
Flutter channel
stable
Additional context
No response
The text was updated successfully, but these errors were encountered: