-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Api generation failing No such file/directory #164
Comments
Hello, could you enable debug logging by setting it to true on your annotation then try again? Please post logs if possible. |
Sorry for the delay, i do not see any debug info in the following: l4sti@fedora:~/Projects/local/flut-front$ flutter pub run build_runner build --delete-conflicting-outputs
Deprecated. Use `dart run` instead.
Building package executable... (1.8s)
Built build_runner:build_runner.
[INFO] Generating build script completed, took 145ms
[INFO] Precompiling build script... completed, took 1.8s
[INFO] Building new asset graph completed, took 635ms
[INFO] Checking for unexpected pre-existing outputs. completed, took 0ms
[INFO] Generating SDK summary completed, took 2.2s
[INFO] openapi_generator on lib/main.dart:
:::::::::::::::::::::::::::::::::::::::::::
:: Openapi generator for dart ::
:::::::::::::::::::::::::::::::::::::::::::
[WARNING] openapi_generator on lib/main.dart:
Using a remote specification, a cache will still be created but may be outdated.
[WARNING] openapi_generator on lib/main.dart:
loadSpec - /home/l4sti/Projects/local/flut-front/.dart_tool/openapi-generator-cache.json
[WARNING] openapi_generator on lib/main.dart:
loadSpec - https://petstore3.swagger.io/api/v3/openapi.json
[INFO] openapi_generator on lib/main.dart:Loaded cached and current spec files.
{}
{"openapi":"3.0.2","info":{"title":"Swagger Petstore - OpenAPI 3.0
removed the openapi.json
"api_key","in":"header"}}}}
[INFO] openapi_generator on lib/main.dart:Dirty Spec found. Running generation.
[INFO] openapi_generator on lib/main.dart:Running following command to generate openapi client - [ generate -o=api/petstore_api -i=https://petstore3.swagger.io/api/v3/openapi.json -g=dart-dio --type-mappings=Pet=ExamplePet --additional-properties=allowUnicodeIdentifiers=false,ensureUniqueParams=true,useEnumExtension=true,enumUnknownDefaultCase=false,prependFormOrBodyParameters=false,pubAuthor=Johnny dep..,pubName=petstore_api,legacyDiscriminatorBehavior=true,sortModelPropertiesByRequiredFlag=true,sortParamsByRequiredFlag=true,wrapper=none ]
[SEVERE] openapi_generator on lib/main.dart:
Failed to generate content.
ProcessException: No such file or directory
Command: dart run openapi_generator_cli:main generate -o=api/petstore_api -i=https://petstore3.swagger.io/api/v3/openapi.json -g=dart-dio --type-mappings=Pet=ExamplePet --additional-properties=allowUnicodeIdentifiers=false,ensureUniqueParams=true,useEnumExtension=true,enumUnknownDefaultCase=false,prependFormOrBodyParameters=false,pubAuthor=Johnny dep..,pubName=petstore_api,legacyDiscriminatorBehavior=true,sortModelPropertiesByRequiredFlag=true,sortParamsByRequiredFlag=true,wrapper=none
[INFO] openapi_generator on lib/main.dart:Found generated timestamp. Updating with 2024-11-18T19:00:49.272190
[INFO] Running build completed, took 8.3s
[INFO] Caching finalized dependency graph completed, took 60ms
[SEVERE] Failed after 8.3s
l4sti@fedora:~/Projects/local/flut-front$ dart --version
Dart SDK version: 3.5.4 (stable) (Wed Oct 16 16:18:51 2024 +0000) on "linux_x64" i am using dart 3 if that matters because i found some issues with dart 3 |
Had the same issue try with a local spec instead of a remote one |
using |
Hi, i am unable to recreate this issue however, i suspect it is due to the cache of the spec not being created yet on first run. Please add @openapi(
additionalProperties:
DioProperties(pubName: 'petstore_api', pubAuthor: 'Johnny_dep'),
inputSpec:
RemoteSpec(path: 'https://petstore3.swagger.io/api/v3/openapi.json'),
typeMappings: {'Pet': 'ExamplePet'},
generatorName: Generator.dio,
runSourceGenOnOutput: true,
skipIfSpecIsUnchanged: false, // <======= add this
outputDirectory: 'api/petstore_api',
)
class Example {} |
After adding after generating the files using the command which is logged |
If you are on Linux, make sure that your |
Thanks @jungnitz , PATH set to what exactly? is it the Java path? |
Ah, no, the path to the dart / flutter |
Description of the bug
Generating the api fails
Steps to reproduce
dart run build_runner build --delete-conflicting-outputs # OR flutter pub run build_runner build --delete-conflicting-outputs
Minimal openapi specification
https://petstore3.swagger.io/api/v3/openapi.json
Annotation used
@openapi(
additionalProperties:
DioProperties(pubName: 'petstore_api', pubAuthor: 'Johnny_dep'),
inputSpec:
RemoteSpec(path: 'https://petstore3.swagger.io/api/v3/openapi.json'),
typeMappings: {'Pet': 'ExamplePet'},
generatorName: Generator.dio,
runSourceGenOnOutput: true,
outputDirectory: 'api/petstore_api',
)
class Example {}
Expected behavior
a nicely generated api package
Logs
Screenshots
No response
Platform
Linux
Library version
6.0.0
Flutter version
3.24.4
Flutter channel
stable
Additional context
Running the following works just fine
The text was updated successfully, but these errors were encountered: