Skip to content

Commit

Permalink
Merge pull request #55 from nikhilnarayanan623/update/swagger-documen…
Browse files Browse the repository at this point in the history
…tation

swagger documentation updated
  • Loading branch information
nikhilnarayanan623 authored Aug 11, 2023
2 parents 6e62eb8 + 194c6ae commit d21d133
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
20 changes: 16 additions & 4 deletions cmd/api/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion cmd/api/docs/swagger.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
{
"swagger": "2.0",
"info": {
"contact": {}
"description": "Backend API built with Golang using Clean Code architecture. \\nGithub: [https://github.com/nikhilnarayanan623/ecommerce-gin-clean-arch].",
"title": "E-commerce Application Backend API",
"contact": {
"name": "For API Support",
"email": "nikhilnarayanan623@gmail.com"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
},
"basePath": "/api",
"paths": {
"/account": {
"get": {
Expand Down Expand Up @@ -4116,5 +4126,10 @@
}
}
}
},
"securityDefinitions": {
"BasicAuth": {
"type": "basic"
}
}
}
14 changes: 13 additions & 1 deletion cmd/api/docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
basePath: /api
definitions:
request.Address:
properties:
Expand Down Expand Up @@ -460,7 +461,15 @@ definitions:
type: string
type: object
info:
contact: {}
contact:
email: nikhilnarayanan623@gmail.com
name: For API Support
description: 'Backend API built with Golang using Clean Code architecture. \nGithub:
[https://github.com/nikhilnarayanan623/ecommerce-gin-clean-arch].'
license:
name: MIT
url: https://opensource.org/licenses/MIT
title: E-commerce Application Backend API
paths:
/account:
get:
Expand Down Expand Up @@ -2692,4 +2701,7 @@ paths:
summary: Get all product items (User)
tags:
- User Products
securityDefinitions:
BasicAuth:
type: basic
swagger: "2.0"
16 changes: 14 additions & 2 deletions pkg/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ type ServerHTTP struct {
Engine *gin.Engine
}

// @title E-commerce Application Backend API
// @description Backend API built with Golang using Clean Code architecture. \nGithub: [https://github.com/nikhilnarayanan623/ecommerce-gin-clean-arch].
//
// @contact.name For API Support
// @contact.email nikhilnarayanan623@gmail.com
//
// @license.name MIT
// @license.url https://opensource.org/licenses/MIT
//
// @BasePath /api
//
// @securityDefinitions.basic BasicAuth
func NewServerHTTP(authHandler handlerInterface.AuthHandler, middleware middleware.Middleware,
adminHandler handlerInterface.AdminHandler, userHandler handlerInterface.UserHandler,
cartHandler handlerInterface.CartHandler, paymentHandler handlerInterface.PaymentHandler,
Expand All @@ -33,9 +45,9 @@ func NewServerHTTP(authHandler handlerInterface.AuthHandler, middleware middlewa
engine.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerfiles.Handler))

// set up routes
routes.UserRoutes(engine.Group("/"), authHandler, middleware, userHandler, cartHandler,
routes.UserRoutes(engine.Group("/api"), authHandler, middleware, userHandler, cartHandler,
productHandler, paymentHandler, orderHandler, couponHandler)
routes.AdminRoutes(engine.Group("/admin"), authHandler, middleware, adminHandler,
routes.AdminRoutes(engine.Group("/api/admin"), authHandler, middleware, adminHandler,
productHandler, paymentHandler, orderHandler, couponHandler, offerHandler, stockHandler)

// no handler
Expand Down

0 comments on commit d21d133

Please sign in to comment.