diff --git a/integration_test/test_data/handler/restaurants.go b/integration_test/test_data/handler/restaurants.go index d353c3e..dc5eae4 100644 --- a/integration_test/test_data/handler/restaurants.go +++ b/integration_test/test_data/handler/restaurants.go @@ -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"` +} diff --git a/integration_test/test_data/spec/expected.json b/integration_test/test_data/spec/expected.json index 5b6193c..de69ecd 100644 --- a/integration_test/test_data/spec/expected.json +++ b/integration_test/test_data/spec/expected.json @@ -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": { @@ -236,6 +349,17 @@ } } }, + "GetPogsResponse": { + "type": "object", + "properties": { + "planograms": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "GetRestaurantsResponse": { "type": "object", "properties": { @@ -354,6 +478,20 @@ } } } + }, + "ValidationError": { + "type": "object", + "properties": { + "statusCode": { + "type": "integer" + }, + "errors": { + "type": "array", + "items": { + "type": "error" + } + } + } } }, "securitySchemes": { diff --git a/integration_test/test_data/spec/expected_with_pkg.json b/integration_test/test_data/spec/expected_with_pkg.json index 90ff145..096a63c 100644 --- a/integration_test/test_data/spec/expected_with_pkg.json +++ b/integration_test/test_data/spec/expected_with_pkg.json @@ -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": { @@ -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": {