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

[BUG] Generated code does not use security field #709

Open
guyluz11 opened this issue Jan 8, 2024 · 0 comments
Open

[BUG] Generated code does not use security field #709

guyluz11 opened this issue Jan 8, 2024 · 0 comments
Assignees
Labels
bug Something isn't working Triage needed

Comments

@guyluz11
Copy link

guyluz11 commented Jan 8, 2024

Describe the bug
The generated code does not take into account security field.

To Reproduce

  1. Download the file as json from the "Swagger specification link".
  2. Create a basic build.yaml just to find and generate the file, for example
  targets:
    $default:
      builders:
        swagger_dart_code_generator:
          options:
            input_folder: 'src/lib/api'
            output_folder: 'src/lib/api/generated_code/'
  1. Look at the generated _usersMePodsGet({ function

Expected behavior
Generated functions to have api_key ({String? fields, String api_key}) as input to authenticate because it is specified in the /users/me/pods: security: field.

Swagger specification link
Link to swagger/OpenApi documentation

Library version used:
chopper: ^6.1.1
json_annotation: ^4.8.0

build_runner: ^2.3.3
chopper_generator: ^6.0.0
json_serializable: ^6.6.1
swagger_dart_code_generator: ^2.10.4

Additional context
You can run the code like this

     Sensibo sensibo = Sensibo.create(baseUrl: Uri.parse('https://home.sensibo.com/api/v2/'));
     await sensibo.usersMePodsGet(fields: '*');

$request.url in src/api/generated_code/sensibo.swagger.chopper.dart:29 looks like this

https://home.sensibo.com/api/v2/users/me/pods?fields=*
and in the "Common Examples" you can see that it should look like this
https://home.sensibo.com/api/v2/users/me/pods?fields=*&apiKey={api_key}

@guyluz11 guyluz11 added bug Something isn't working Triage needed labels Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Triage needed
Projects
None yet
Development

No branches or pull requests

3 participants