OPTIONS
-a <authorization>, --auth <authorization>
adds authorization headers when fetching the swagger definitions
remotely. Pass in a URL-encoded string of name:header with a
comma
separating multiple values
so the -a option is for fetching the swagger spec only if "-i" refers to an
URL instead of a local file.
Do you want to hard code the API key in the PHP API client? If yes, that's
not supported at the moment and we won't recommend doing that due to
security concerns.
If you need further assistance, please open a ticket
via https://github.com/swagger-api/swagger-codegen/issues/new.
William
Oleg Polosin於 2016年8月1日星期一 UTC+8下午7時55分19秒寫道:
>
> 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.