Skip to content

fix(codegen): skip the OpenAPI-client stage when codegen-tool-dir is absent - #33

Merged
stephane-segning merged 1 commit into
mainfrom
fix/codegen-skip-openapi-when-absent
Aug 18, 2026
Merged

fix(codegen): skip the OpenAPI-client stage when codegen-tool-dir is absent#33
stephane-segning merged 1 commit into
mainfrom
fix/codegen-skip-openapi-when-absent

Conversation

@stephane-segning

Copy link
Copy Markdown
Contributor

Summary

The codegen action (and its android-setup/ios-setup wrappers) always ran the OpenAPI-client stage unconditionally — step 1 (dart pub get in codegen-tool-dir) hard-fails with a bare "No such file or directory" for any consumer that has no generated OpenAPI client, with no input to opt out.

Why

Discovered fixing vaam-store/mobile's CI: vaam-store/mobile#16 deleted its api/ OpenAPI package and toolchain entirely, but analyze · test still called vymalo/flutter-tools/actions/codegen@v0, which unconditionally tried dart pub get inside the now-deleted mobile/tool/openapi_codegen dir and died. A hard-coded assumption in a shared action is a trap for any consumer without an OpenAPI client, not just this one.

Change

  • New generate-openapi input (auto/true/false, default auto) on codegen, android-setup, ios-setup.
  • auto checks whether codegen-tool-dir exists on disk; when it doesn't, steps 1-3 (the whole OpenAPI-client stage) are skipped and only the app-level flutter pub get + build_runner build run.
  • planCodegen (lib/src/codegen.dart) stays pure/I/O-free — it takes an explicit generateOpenapi bool. The directory-existence check lives in the CLI command layer (bin/flutter_tools.dart), matching this repo's plan-then-execute testability design.
  • Default behaviour for existing consumers is unchanged (auto only skips when the directory is genuinely absent; explicit true/false still force it).
  • Bumped cli-version.txt 0.1.0 -> 0.2.0 (Dart code changed) per RELEASING.md Flow A. Needs release-cli then release-actions (with move_major) run from the Actions tab once this merges, to move v0.

Verification

  • dart format --output=none --set-exit-if-changed . — clean
  • dart analyze --fatal-infos — no issues
  • dart test — 63 passed, including 3 new planCodegen cases for generateOpenapi: false and the unchanged default
  • Manual --dry-run sanity check: a missing codegen-tool-dir produces a 2-step plan (app pub get + build_runner only); an existing one produces the original 9-step plan, unchanged
  • Real CI proof: vaam-store/mobile PR pins this branch by commit SHA in its workflow and runs analyze · test green against it (linked once opened)

🤖 Generated with Claude Code

…absent

The codegen action's step 1 ("Generate OpenAPI client (Java CLI)") always
cd's into codegen-tool-dir and runs `dart pub get`, unconditionally — a
consumer with no generated OpenAPI client (e.g. one that deleted its api/
package and openapi_codegen toolchain entirely) hits a bare "No such file
or directory" with no way to opt out, since no skip input existed.

Add a `generate-openapi` input (auto/true/false, default auto) to the
codegen action and its android-setup/ios-setup wrappers. `auto` checks
whether codegen-tool-dir exists on disk and skips steps 1-3 (the whole
OpenAPI-client stage) when it doesn't, leaving just the app-level
`flutter pub get` + `build_runner build`. The planner (planCodegen) stays
pure/I/O-free for testability — the CLI command layer does the directory
check and passes an explicit bool through.

Bumps cli-version.txt (0.1.0 -> 0.2.0) since bin/ and lib/src/codegen.dart
changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cbc3a71

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@stephane-segning
stephane-segning merged commit 556b77b into main Aug 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant