Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8254
Closed
Open
Issue created Dec 22, 2020 by Administrator@rootContributor

[BUG][DART-DIO] break in for loop in 'ApiKeyAuthInterceptor'

Created by: vancegillies

Hi,

Sorry for not following the bug report template but the issue is so simple and can probably be answered without having to have a repro.

There is a break statement in '/modules/openapi-generator/src/main/resources/dart-dio/auth/api_key_auth.mustache'

for (var info in authInfo) {
    final authName = info["name"];
    final authKeyName = info["keyName"];
    final authWhere = info["where"];
    final apiKey = apiKeys[authName];
    if (apiKey != null) {
        if (authWhere == 'query') {
            options.queryParameters[authKeyName] = apiKey;
        } else {
            options.headers[authKeyName] = apiKey;
        }
        break; // <- THIS
    }
}

A break in a for loop stops lopping, so if there is more then one apiKey only the first is added to the headers

I think 'continue' was intended? but also unneeded as its at the end of the loop anyway.

These are the headers i'm using

securitySchemes:
  device_id:
    type: apiKey
    in: header
    name: X-DEVICE-ID
  app_id:
    type: apiKey
    in: header
    name: X-APP-ID
  session_token:
    type: apiKey
    in: header
    name: Authorization

Only the app-id was being added to the headers, but removing the break statement fixed my issue.

Unless I'm missing something this seems like a bug

Again sorry not using a the template.

Thanks

Assignee
Assign to
Time tracking