Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 36 additions & 39 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,40 +52,25 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/product.Product"
}
}
"$ref": "#/definitions/product.productGetResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
}
}
Expand Down Expand Up @@ -122,53 +107,46 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/product.Product"
}
"$ref": "#/definitions/product.getProductByIdResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
}
}
}
}
},
"definitions": {
"handlers.Error": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
},
"product.Product": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -522,6 +500,25 @@ const docTemplate = `{
"type": "string"
}
}
},
"product.getProductByIdResponse": {
"type": "object",
"properties": {
"product": {
"$ref": "#/definitions/product.Product"
}
}
},
"product.productGetResponse": {
"type": "object",
"properties": {
"products": {
"type": "array",
"items": {
"$ref": "#/definitions/product.Product"
}
}
}
}
},
"securityDefinitions": {
Expand Down
75 changes: 36 additions & 39 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,25 @@
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/definitions/product.Product"
}
}
"$ref": "#/definitions/product.productGetResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
}
}
Expand Down Expand Up @@ -115,53 +100,46 @@
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/product.Product"
}
"$ref": "#/definitions/product.getProductByIdResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/handlers.Error"
}
}
}
}
}
},
"definitions": {
"handlers.Error": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
},
"product.Product": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -515,6 +493,25 @@
"type": "string"
}
}
},
"product.getProductByIdResponse": {
"type": "object",
"properties": {
"product": {
"$ref": "#/definitions/product.Product"
}
}
},
"product.productGetResponse": {
"type": "object",
"properties": {
"products": {
"type": "array",
"items": {
"$ref": "#/definitions/product.Product"
}
}
}
}
},
"securityDefinitions": {
Expand Down
55 changes: 26 additions & 29 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
basePath: /api/v1
definitions:
handlers.Error:
properties:
error:
type: string
type: object
product.Product:
properties:
_id:
Expand Down Expand Up @@ -235,6 +240,18 @@ definitions:
product_name:
type: string
type: object
product.getProductByIdResponse:
properties:
product:
$ref: '#/definitions/product.Product'
type: object
product.productGetResponse:
properties:
products:
items:
$ref: '#/definitions/product.Product'
type: array
type: object
info:
contact: {}
description: API for accessing the SnackLog product database.
Expand All @@ -258,33 +275,23 @@ paths:
"200":
description: OK
schema:
additionalProperties:
$ref: '#/definitions/product.Product'
type: object
$ref: '#/definitions/product.getProductByIdResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
$ref: '#/definitions/handlers.Error'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
$ref: '#/definitions/handlers.Error'
"404":
description: Not Found
schema:
additionalProperties:
type: string
type: object
$ref: '#/definitions/handlers.Error'
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
$ref: '#/definitions/handlers.Error'
security:
- Bearer: []
summary: Get product by ID
Expand All @@ -311,29 +318,19 @@ paths:
"200":
description: OK
schema:
additionalProperties:
items:
$ref: '#/definitions/product.Product'
type: array
type: object
$ref: '#/definitions/product.productGetResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
$ref: '#/definitions/handlers.Error'
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
$ref: '#/definitions/handlers.Error'
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
$ref: '#/definitions/handlers.Error'
security:
- Bearer: []
summary: Search products
Expand Down
Loading
Loading