swagger-api / swagger-api/swagger-codegen

[Android] API Key based Authentication not included in generated client

Open
#7,499 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I am trying to generate an Android client which has the API key based security schemes defined. The endpoint definitions are also correct (see the snippet). Also, note that I am able to generate the Java and python clients correctly.

The config that I am using for the android client is as follows:

{
  "artifactId": "rsearch",
  "library": "volley"
}
Swagger-codegen version

Have tried with both 2.3.0 and 2.3.1

Swagger declaration file content or url

The relevant sections of the yaml is pasted below:

securityDefinitions:
  readAppID:
    type: apiKey
    in: header
    name: X-RSearch-App-ID
  authToken:
    type: apiKey
    in: query
    name: auth_token

paths:
  /indexes:
    get:
      tags:
        - rsearch
      description: Fetches indexes
      operationId: getAllIndexes
      produces:
        - application/json
      security:
        - readAppID: []
        - authToken: []
Command line used for generation

java -jar tools/swagger-codegen-cli-2.3.1.jar generate -i source/rsearch.yaml -l android -o tmp/rsearch-sdk-android -c source/config/android/config.json

Steps to reproduce

Generate the client, check documentation and also the generated API Class.

Related issues/PRs

https://github.com/swagger-api/swagger-codegen/issues/7088

Suggest a fix/enhancement

Not sure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the Android generation command and the supplied YAML, then inspect the generated API class and documentation for the /indexes operation. Compare them with the generated Java and Python clients; done means the Android client includes the defined header and query API-key authentication.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, openapi
Domain
api, mobile, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.