gibahjoe / openapi-generator-dart

Openapi Generator for Dart/Flutter
BSD 3-Clause "New" or "Revised" License
112 stars 29 forks source link

fvm wrapper fails to install dependencies #129

Open toonvanstrijp opened 5 months ago

toonvanstrijp commented 5 months ago

Description of the bug

When using the fvm wrapper it fails to install the dependencies. This is caused because it's executing the wrong command. This is seen below in the logs:

[INFO] openapi_generator on lib/api.config.dart:Installing dependencies with generated source. fvm pub get

[SEVERE] openapi_generator on lib/api.config.dart:
Failed to generate content.

Install within generated sources failed.  #0      OpenapiGenerator.fetchDependencies (package:openapi_generator/src/openapi_generator_runner.dart:406:36)
<asynchronous suspension>
#1      OpenapiGenerator.generatorV2 (package:openapi_generator/src/openapi_generator_runner.dart:171:9)
<asynchronous suspension>
#2      normalizeGeneratorOutput (package:source_gen/src/output_helpers.dart:10:1)
<asynchronous suspension>
#3      StreamCompleter.se

Steps to reproduce

To reproduce this issue you can use the following config:

@Openapi(
  additionalProperties: AdditionalProperties(
    pubName: 'hycare_api',
    enumUnknownDefaultCase: true,
    wrapper: Wrapper.fvm,
  ),
  inputSpec: RemoteSpec(
    path: "http://localhost:3000/docs-json",
  ),
  cachePath: ".dart_tool/build/openapi_cache.json",
  generatorName: Generator.dio,
  runSourceGenOnOutput: true,
  outputDirectory: 'api',
)

Now simply run the fvm flutter pub run build_runner build --delete-conflicting-outputs and you can see it fails to install.

Expected behavior

I would expect that when the fvm wrapper is used the install command looks like fvm flutter pub get.

Logs

No response

Screenshots

No response

Platform

macOS

Library version

5.0.2

Flutter version

3.16.4

Flutter channel

stable

Additional context

No response