Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
Signed-off-by: Alvaro Frias Garay <[email protected]>
  • Loading branch information
qequ committed May 6, 2024
1 parent 2c06fe5 commit 505fbda
Show file tree
Hide file tree
Showing 3 changed files with 301 additions and 0 deletions.
25 changes: 25 additions & 0 deletions integration_test/test_data/handler/restaurants.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,28 @@ import (
// @Router /restaurants [get]
func GetRestaurants() {
}

// @title Get Planograms.
// @description Returns planogram based on query params.
// @param id query string true "Use as filter.id! Planogram dbKey [comma separated list]"
// @param locationId query string true "Use as filter.locationId! Location ID"
// @param include query string false "Includes. Can be: position, fixture, liveFlrFixture"
// @param commodity query string false "Use as filter.commodity! Commodity"
// @param commodityGroup query string false "Use as filter.commodityGroup! Commodity Group"
// @param isDigitalScreen query string false "Use as filter.isDigitalScreen! IsDigitalScreen. Can be: true, false"
// @success 200 {object} GetPogsResponse
// @failure 400 {object} ValidationError
// @failure 404 {object} types.ErrResponse
// @failure 500 {object} types.ErrResponse
// @route assortment/planogram [get]
func GetPogs() {}

type GetPogsResponse struct {
// @description Planogram details
Planograms []int `json:"planograms"`
}

type ValidationError struct {
StatusCode int `json:"statusCode" xml:"statusCode"`
Errors []error `json:"errors" xml:"errors"`
}
138 changes: 138 additions & 0 deletions integration_test/test_data/spec/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,123 @@
"required": true
}
}
},
"assortment/planogram": {
"get": {
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GetPogsResponse"
}
}
}
},
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationError"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/"
}
}
}
},
"500": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/"
}
}
}
}
},
"summary": "Get Planograms.",
"description": " Returns planogram based on query params.",
"parameters": [
{
"name": "id",
"in": "query",
"description": "Use as filter.id! Planogram dbKey [comma separated list]",
"required": true,
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.id! Planogram dbKey [comma separated list]"
}
},
{
"name": "locationId",
"in": "query",
"description": "Use as filter.locationId! Location ID",
"required": true,
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.locationId! Location ID"
}
},
{
"name": "include",
"in": "query",
"description": "Includes. Can be: position, fixture, liveFlrFixture",
"schema": {
"type": "string",
"format": "string",
"description": "Includes. Can be: position, fixture, liveFlrFixture"
}
},
{
"name": "commodity",
"in": "query",
"description": "Use as filter.commodity! Commodity",
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.commodity! Commodity"
}
},
{
"name": "commodityGroup",
"in": "query",
"description": "Use as filter.commodityGroup! Commodity Group",
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.commodityGroup! Commodity Group"
}
},
{
"name": "isDigitalScreen",
"in": "query",
"description": "Use as filter.isDigitalScreen! IsDigitalScreen. Can be: true, false",
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.isDigitalScreen! IsDigitalScreen. Can be: true, false"
}
}
]
}
}
},
"components": {
"schemas": {
"": {},
"CreateUserRequest": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -236,6 +349,17 @@
}
}
},
"GetPogsResponse": {
"type": "object",
"properties": {
"planograms": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"GetRestaurantsResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -354,6 +478,20 @@
}
}
}
},
"ValidationError": {
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"errors": {
"type": "array",
"items": {
"type": "error"
}
}
}
}
},
"securitySchemes": {
Expand Down
138 changes: 138 additions & 0 deletions integration_test/test_data/spec/expected_with_pkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,123 @@
"required": true
}
}
},
"assortment/planogram": {
"get": {
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/github.com.parvez3019.go-swagger3.handler.GetPogsResponse"
}
}
}
},
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/github.com.parvez3019.go-swagger3.handler.ValidationError"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/"
}
}
}
},
"500": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/"
}
}
}
}
},
"summary": "Get Planograms.",
"description": " Returns planogram based on query params.",
"parameters": [
{
"name": "id",
"in": "query",
"description": "Use as filter.id! Planogram dbKey [comma separated list]",
"required": true,
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.id! Planogram dbKey [comma separated list]"
}
},
{
"name": "locationId",
"in": "query",
"description": "Use as filter.locationId! Location ID",
"required": true,
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.locationId! Location ID"
}
},
{
"name": "include",
"in": "query",
"description": "Includes. Can be: position, fixture, liveFlrFixture",
"schema": {
"type": "string",
"format": "string",
"description": "Includes. Can be: position, fixture, liveFlrFixture"
}
},
{
"name": "commodity",
"in": "query",
"description": "Use as filter.commodity! Commodity",
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.commodity! Commodity"
}
},
{
"name": "commodityGroup",
"in": "query",
"description": "Use as filter.commodityGroup! Commodity Group",
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.commodityGroup! Commodity Group"
}
},
{
"name": "isDigitalScreen",
"in": "query",
"description": "Use as filter.isDigitalScreen! IsDigitalScreen. Can be: true, false",
"schema": {
"type": "string",
"format": "string",
"description": "Use as filter.isDigitalScreen! IsDigitalScreen. Can be: true, false"
}
}
]
}
}
},
"components": {
"schemas": {
"": {},
"Headers": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -248,6 +361,31 @@
}
}
},
"github.com.parvez3019.go-swagger3.handler.GetPogsResponse": {
"type": "object",
"properties": {
"planograms": {
"type": "array",
"items": {
"type": "integer"
}
}
}
},
"github.com.parvez3019.go-swagger3.handler.ValidationError": {
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"errors": {
"type": "array",
"items": {
"type": "error"
}
}
}
},
"github.com.parvez3019.go-swagger3.model.CreateUserRequest": {
"type": "object",
"properties": {
Expand Down

0 comments on commit 505fbda

Please sign in to comment.