gibahjoe / openapi-generator-dart

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

Generator.dio doesn't work #99

Open jiffstudio opened 10 months ago

jiffstudio commented 10 months ago

Description of the bug

I chose the generatorName as Generator.dio. But it produces dart version.

Steps to reproduce

@Openapi( additionalProperties: DioProperties(pubName: 'coclass_api', pubAuthor: 'Jiff'), inputSpecFile: 'lib/apis/api_spec.yaml', generatorName: Generator.dio, outputDirectory: 'plugins/coclass_api', useNextGen: true) class CustomOpenapiGeneratorConfig extends OpenapiGeneratorConfig {}

Expected behavior

Expect it to use dio to request. But it only uses http library.

Logs

No response

Screenshots

No response

Platform

Windows

Library version

4.12.1

Flutter version

3.13.1

Flutter channel

stable

Additional context

No response

gibahjoe commented 10 months ago

HI, did you try deleting the coclass_api folder and running the generator again?

when you do, look for a log that says something like generate -I lib/apis/api_spec.yaml or something like that and paste here.

Also, if you find that the generator is not running, make a simple modification to the file that has the @openapi annotation so that build runner will detect changes and run the generator. Awaiting your feedback.

aschulz90 commented 6 months ago

I can confirm that the generator always uses the dart generator, regardless of what is defined.

Version: 4.13.1

Config:

@Openapi(
  additionalProperties: DioAltProperties(
    pubName: 'wichteln_api',
    pubAuthor: 'Andreas Schulz',
    nullSafe: true,
    nullSafeArrayDefault: true,
    listAnyOf: true,
  ),
  inputSpecFile: 'wichteln-api.yaml',
  generatorName: Generator.dio,
  outputDirectory: 'wichteln_api',
  alwaysRun: true,
)

Log:

[ generate -o=wichteln_api -i=wichteln-api.yaml -g=dart --additional-properties=allowUnicodeIdentifiers=false,ensureUniqueParams=true,useEnumExtension=true,prependFormOrBodyParameters=false,pubAuthor=Andreas Schulz,pubName=wichteln_api,legacyDiscriminatorBehavior=true,sortModelPropertiesByRequiredFlag=true,sortParamsByRequiredFlag=true,wrapper=none,nullSafe=true,nullSafe-array-default=true,listAnyOf=true ]

So every parameter seems to be applied correctly, except -g=dart.

quyenvsp commented 3 months ago

it happen when your pub outdated (usually source_gen) so you can fix by run flutter pub upgrade (maybe --major-versions)