Skip to content

Api generation failing No such file/directory #164

@L4stIdi0t

Description

@L4stIdi0t

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

[INFO] openapi_generator on lib/main.dart:Loaded cached and current spec files.
[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-13T09:43:10.992397

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

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions