Do I correctly understand that -a option in codegen is used to set up some 
authorization header for all requests?

I try to generate PHP client using the following command:
# java -jar swagger-codegen-cli.jar generate -l php -i myapi.json -o 
/path/to/api -a API_KEY:keyvalue

In the result code I see that it tries to set up API_KEY header for each 
method:


$apiKey = $this->apiClient->getApiKeyWithPrefix('API_KEY');

if (strlen($apiKey) !== 0) {
    $headerParams['API_KEY'] = $apiKey;
}


But $apiKeys property in Configuration.php is empty.


This is path of my JSON file:

{
    "swagger": "2.0",

    ...

    "security": [

        {
            "api_key": []
        }
    ],

    "securityDefinitions": {

        "api_key": {
            "type": "apiKey",
            "name": "API_KEY",
            "in": "header"
        }
    }

}


What do I do wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to