Closed Nexushunter closed 1 year ago
Hi, can you please explain the issue? What behavior are you expecting? Are you saying the output directory is not updated when you run the generator?
👋🏻 Hi! Yep that is correct. When I making a change to the OAS spec and rerun the generator the output directory doesn't get updated as I would expect it to even when the alwaysRun
flag is set.
As a work around I either need to update the path for the output directory or I can remove the .dart_tool
directory (this has an additional burden of having to constantly redownload the dependencies). Both of these cause the generator to update the output directory as expected.
The note about the process being skipped if the output directory exists sticks out as a cause of the issue. The generation should still run in the event that the directory exists.
For the generator to run again, you need to make a change to the file that has your @openapi
annotation. This is because the generator uses build runner and build runner only runs on files that have changed.
Something I do is just add a full stop behind the pubDescription or pubAuthor for instance.
So, in your case, make a change to the tagmine_api.dart
file before running build runner
command.
Let me know if this helps or if I have addressed your issue.
🤔 I would expect it to run in cases where the oas spec changes too.
Would you object to that being a new feature? I can look into implementing it.
Here's my proposal:
Currently the openapi-generator doesn't rerun when the oas spec changes. This prevents incremental changes to the oas spec, making it a requirement to make hacky changes. To alleviate this storing a copy of the oas spec in the build directory allowing for changes to be diffed. Another option is to use git. It should also not require flutter and should allow for dart only if the pubspec doesn't include the flutter SDK as a dependency.
Of course. This will be a very welcome update. Thank you. Send a PR when done.
Description of the bug
The current implementation forces either an update to the
outputDirectory
or delete the currentoutputDirectory
. This prevents incremental updates an retaining the current testing being given to the generated clients / servers.Steps to reproduce
make a change to the open api spec. ie add a content type to the response. run
dart run build_runner build --delete-conflicting-outputs
Expected behavior
Regenerates new changes in
outputDirectory
Logs
Screenshots
No response
Platform
Linux
Library version
4.11.0
Flutter version
3.0.5 - Dart
Flutter channel
stable
Additional context
No response