Skip to content
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

Generator.dio doesn't work #99

Open
jiffstudio opened this issue Aug 25, 2023 · 3 comments
Open

Generator.dio doesn't work #99

jiffstudio opened this issue Aug 25, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@jiffstudio
Copy link

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

@jiffstudio jiffstudio added the bug Something isn't working label Aug 25, 2023
@gibahjoe
Copy link
Owner

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
Copy link

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
Copy link
Contributor

quyenvsp commented Mar 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants