Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#162727461 Document api with swagger #21

Merged
merged 3 commits into from Jan 22, 2019

Conversation

abejide001
Copy link
Contributor

What does this PR do?

Document application API with swagger

Description of Task to be completed?

  • Configure swagger
  • Ensure API is documented on localhost:9000/api/v1/api-docs

How should this be manually tested?

  • Run npm i
  • Visit the url localhost:9000/api/v1/api-docs, and make request to any endpoint

Any background context you want to provide?

N/A

What are the relevant pivotal tracker stories?

#162727461

Screenshots (if appropriate)

screen shot 2019-01-16 at 7 29 32 pm

setup swagger configuration
use swagger jsdoc in authrouter
[Delivers #162727461]
authRouter
.post('/signup',
UserValidator.UserSignUpValidator,
emailCheck,
UserController.signUp);
/**
* @swagger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, I would like to know if there is a reason for using swagger JSDOCs against Swagger.json where the documentation is kept in a different file. I feel using swagger.json file and having all the documentation there is cleaner because adding documentation to the route file will make it unavoidably long and I don't think we want that. Anyone going through the route file will have to read the doc of each of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach works fine for our project, because the controllers have separate route files, for reference purposes please check here https://github.com/Surnet/swagger-jsdoc/blob/master/example/v2/routes.js

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

Copy link
Contributor

@wombolo wombolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andela-dbamidele andela-dbamidele merged commit 25383ff into staging Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants