apidoc-postman icon indicating copy to clipboard operation
apidoc-postman copied to clipboard

Tags

Open scriptsure opened this issue 4 years ago • 5 comments

@panz3r hey thanks for the conversion utility. Looks like there are many tags that are not getting converted... like description for api and parameters when it comes to a payload (POST). Any suggestions on how to adjust code base?

scriptsure avatar Mar 02 '20 17:03 scriptsure

Hi @scriptsure ,

Thanks for your feedback and your interest in this package.

It's been a while since I worked on this but looking at the code I noticed that it is not supported, the body is simply set to raw type.

I'd look into this as soon as I can.

panz3r avatar Mar 02 '20 18:03 panz3r

yeah thanks man appreciate it

scriptsure avatar Mar 02 '20 18:03 scriptsure

Hi @scriptsure ,

I just release a new version of apidoc-postman (v2.1.0) with support to set a sample payload from the apiDoc file.

See the updated README to see how it should work, basically by specifing a group of Body for the @apiParam tag a template payload will be created based on the name and type.

Let me know if this helps you.

panz3r avatar Mar 03 '20 19:03 panz3r

ok sure.. thanks... now i am struggling with postman because you cant secure it with some kind of basic auth. So I might go to a more Slate approach... very frustrating not to find a sensible documentation code base.

scriptsure avatar Mar 05 '20 12:03 scriptsure

Hi @scriptsure ,

Actually if you need to setup Authentication for a particular Endpoint commented with apiDoc you can use the @apiPermission tag.

apidoc-postman will then make the following conversion:

  • for @apiPermission basic it will setup a Basic Auth protected call.
  • for any other value (e.g. @apiPermission user) it will setup a Bearer Auth protected call and expect a user_token variable containing the JWT token (that you can define in your Postman environment).

The following apiDoc comment

/**
 * @api {get} /user/:id Read data of a User
 * @apiVersion 0.3.0
 * @apiName GetUser
 * @apiGroup User
 * @apiPermission admin
 */

will create a call to GET /user/:id with the Bearer Auth expecting an admin_token JWT Token.

Let me know if this helps you.

panz3r avatar Mar 05 '20 13:03 panz3r