Laravel-apidoc-generator: --headers 'Some: some' don't work!

Created on 22 Oct 2016  路  24Comments  路  Source: mpociot/laravel-apidoc-generator

Most helpful comment

Now I get it.....I totally misunderstood the docs here....sorry, my fault!

I thought this is only for the automatically generated documentation, so that it can insert the header lines in the example requests. I disabled the response calls with --noResponseCalls, so obviously nothing happened.

I still assume some other people also misunderstood the docs here. Otherwise this issue can be closed?

All 24 comments

+1

+1

Any news on this?

+1 Same here. Short statement would be nice
laravel 5.1.* dingo/api 1.0.*@dev

馃憥 think we'll have to fix it allone.
CU Later

+1

same problem +1

Same here on L5.4. The --header flag doesn't seem to generate anything on the documentation.

Running command:

php artisan api:generate --routePrefix="api/*" --actAsUserId=1 --header 'Authorization: Bearer AccessToken'

Run
php artisan api:generate --routePrefix="api/*" --header="Authorization: Bearer AccessToken"

@sergiobelya Thanks for co-operation but this command is not gave the desired output, plz help by any other solution

@Umarjaved420

this command

is example for header only (see documentation and my pull request).
--header="Some: some"
is working.
Compare
--header 'Authorization: Bearer AccessToken'
and
--header="Authorization: Bearer AccessToken"

I use command

php artisan api:gen 
--routePrefix="api/v1/*" 
--bindings="item_type,4|item_types_scale,1|item,5|purchase_list,9|shop,4" 
--header="Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEwLCJpc3MiOiJodHRwOi8va3VwZXJ0aW5vL2FwaS92MS9hdXRoIiwiaWF0IjoxNTEwMjcyNDMzLCJleHAiOjE1MTA0NDUyMzMsIm5iZiI6MTUxMDI3MjQzMywianRpIjoiaGlITkN2Q1B5czZwTE53SCJ9.uDtVDJrpj8OaDFj_Bj7T31_UHZY4SDFjhg2PBnFmIgI"

with or without option
--force
in my local environment.
It's not ideal, but header is working.

What command is not gave the desired output in your environment?

@sergiobelya thanks its working, its my mistake i just not add actual token.
Again thanks

Tried to use the code in README.md and also all tries in this file. Not working with Laravel 5.6 :-(

STILL NOT WORKING

Does not work for me either with --header="Auth-Token: Testing"

Another contributor on this repo would be awesome.

Hi @KuenzelIT ,
Please check the comments above, @sergiobelya elaborate it clearly,
You have to add real "Auth token" in command,
use command like below

php artisan api:generate --routePrefix="api/*" --header="Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEwLCJpc3MiOiJodHRwOi8va3VwZXJ0aW5vL2FwaS92MS9hdXRoIiwiaWF0IjoxNTEwMjcyNDMzLCJleHAiOjE1MTA0NDUyMzMsIm5iZiI6MTUxMDI3MjQzMywianRpIjoiaGlITkN2Q1B5czZwTE53SCJ9.uDtVDJrpj8OaDFj_Bj7T31_UHZY4SDFjhg2PBnFmIgI"

command not work with "Testing" or "AccessToken"

@KuenzelIT Does your API application handle the header 'Auth-Token' with value 'Testing' actually?
Perhaps you should use solutions like https://github.com/tymondesigns/jwt-auth (or other) for authorization in API?
I don't know about your environment and your application nothing, therefore, I can not suggest you anything else.

Now I get it.....I totally misunderstood the docs here....sorry, my fault!

I thought this is only for the automatically generated documentation, so that it can insert the header lines in the example requests. I disabled the response calls with --noResponseCalls, so obviously nothing happened.

I still assume some other people also misunderstood the docs here. Otherwise this issue can be closed?

I am looking for the same as @KuenzelIT , --header works OK, but I want the headers to appear in the HTML docs too, is there something like that done?

@lucasmarques This is the API documentation generator. What do you means by "HTML docs too", at laravel-apidoc-generator context or other?
For custom headers in HTML, json, other responses I use middleware (add to Kernel::$middleware or Kernel::$routeMiddleware), for example https://github.com/sergiobelya/laravel-options-cors/blob/master/OptionsCorsResponse.php.

@sergiobelya I mean visually, in the generated documentation, what I want in the end is to inform the reader of the documentation that he has to send some headers to that request.
I don't need to return headers in the response or even send readers in the request, I just need to let the docs reader know that he has to send additional headers when he sends the request.

@lucasmarques I don't know, unfortunately. Maybe, somebody answer you. Sorry, but this question not for this issue. I think, that you should use this question in the new issue.

@mpociot This issue can be closed, because documentation for using headers already fixed here https://github.com/mpociot/laravel-apidoc-generator/pull/224

@lucasmarques You can try editing the generated markdown file to add this as part of the introduction. There's also a PR to support appending and prepending contend to the generated docs, so you could wait for that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dozieogbo picture dozieogbo  路  4Comments

chinloyal picture chinloyal  路  8Comments

Jaspur picture Jaspur  路  8Comments

farizluqman picture farizluqman  路  4Comments

saidatom picture saidatom  路  7Comments