Skip to content
Snippets Groups Projects
Commit ee44e6e8 authored by Tucker Gary Siegel's avatar Tucker Gary Siegel
Browse files

add failures

parent 7e80a3ac
No related branches found
No related tags found
1 merge request!24update swagger
...@@ -19,6 +19,8 @@ var GetGddValues = services.GetGddValues ...@@ -19,6 +19,8 @@ var GetGddValues = services.GetGddValues
// @Produce json // @Produce json
// @Success 200 {object} models.GddResponse // @Success 200 {object} models.GddResponse
// @Failure 400 {object} errors.StandardError // @Failure 400 {object} errors.StandardError
// @Failure 404 {object} errors.StandardError
// @Failure 500 {object} errors.StandardError
// @Param year query int true "Year to get gdd for" // @Param year query int true "Year to get gdd for"
// @Param product query string true "Crop to calculate gdd for" Enums(corn) // @Param product query string true "Crop to calculate gdd for" Enums(corn)
// @Param latitude query number true "Latitude to search for" // @Param latitude query number true "Latitude to search for"
...@@ -40,6 +42,8 @@ func GetDailyGdd(c *fiber.Ctx) error { ...@@ -40,6 +42,8 @@ func GetDailyGdd(c *fiber.Ctx) error {
// @Produce json // @Produce json
// @Success 200 {object} models.GddResponse // @Success 200 {object} models.GddResponse
// @Failure 400 {object} errors.StandardError // @Failure 400 {object} errors.StandardError
// @Failure 404 {object} errors.StandardError
// @Failure 500 {object} errors.StandardError
// @Param product query string true "Crop to calculate gdd for" Enums(corn) // @Param product query string true "Crop to calculate gdd for" Enums(corn)
// @Param latitude query number true "Latitude to search for" // @Param latitude query number true "Latitude to search for"
// @Param longitude query number true "Longitude to search for" // @Param longitude query number true "Longitude to search for"
......
This diff is collapsed.
{ {
"swagger": "2.0", "swagger": "2.0",
"info": { "info": {
"description": "All operations for GDD/Freezing Date data",
"title": "Dawn GDD Service", "title": "Dawn GDD Service",
"contact": { "contact": {
"name": "API Support", "name": "API Support",
...@@ -55,7 +54,7 @@ ...@@ -55,7 +54,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -100,7 +99,7 @@ ...@@ -100,7 +99,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -175,7 +174,7 @@ ...@@ -175,7 +174,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -247,6 +246,19 @@ ...@@ -247,6 +246,19 @@
"name": "longitude", "name": "longitude",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "Plant date, ISO8601 or RFC3339 format",
"name": "plantingDate",
"in": "query",
"required": true
},
{
"type": "number",
"description": "number of times to repeat the request. When included with planting date, will extrapolate plantingdate -\u003e end of repeatYears range",
"name": "repeatYears",
"in": "query"
} }
], ],
"responses": { "responses": {
...@@ -259,7 +271,7 @@ ...@@ -259,7 +271,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -417,7 +429,7 @@ ...@@ -417,7 +429,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -425,7 +437,11 @@ ...@@ -425,7 +437,11 @@
}, },
"/gdd/daily": { "/gdd/daily": {
"get": { "get": {
"description": "get gdd values", "security": [
{
"ApiKeyAuth": []
}
],
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -433,9 +449,10 @@ ...@@ -433,9 +449,10 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"Gdd" "Gdd",
"public"
], ],
"summary": "Get gdd values", "summary": "Get GDD Values for given year",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
...@@ -446,20 +463,7 @@ ...@@ -446,20 +463,7 @@
}, },
{ {
"enum": [ "enum": [
"corn", "corn"
"soybean",
"sunflower",
"tomato",
"sugar_beet",
"peanut",
"cotton",
"potato",
"wheat",
"pea",
"oat",
"spring_wheat",
"rice",
"sorghum"
], ],
"type": "string", "type": "string",
"description": "Crop to calculate gdd for", "description": "Crop to calculate gdd for",
...@@ -487,6 +491,13 @@ ...@@ -487,6 +491,13 @@
"name": "accumulate", "name": "accumulate",
"in": "query", "in": "query",
"required": true "required": true
},
{
"type": "string",
"description": "Plant date RFC3339 format",
"name": "plantingDate",
"in": "query",
"required": true
} }
], ],
"responses": { "responses": {
...@@ -499,7 +510,152 @@ ...@@ -499,7 +510,152 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
}
}
}
}
},
"/gdd/forecast/freezing": {
"get": {
"description": "Get stages",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Forecast"
],
"summary": "Get stages",
"parameters": [
{
"type": "number",
"description": "Latitude to search for",
"name": "latitude",
"in": "query",
"required": true
},
{
"type": "number",
"description": "Longitude to search for",
"name": "longitude",
"in": "query",
"required": true
},
{
"type": "number",
"description": "Freezing temperature to use",
"name": "freezing_temp",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/errors.StandardError"
}
}
}
}
},
"/gdd/forecast/stages": {
"get": {
"description": "Get stages",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Forecast"
],
"summary": "Get stages",
"parameters": [
{
"type": "number",
"description": "Latitude to search for",
"name": "latitude",
"in": "query",
"required": true
},
{
"type": "number",
"description": "Longitude to search for",
"name": "longitude",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Plant date, ISO8601 or RFC3339 format",
"name": "plant_date",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Mode, rm or gdds_to_maturity",
"name": "mode",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "Value of mode",
"name": "value",
"in": "query",
"required": true
},
{
"type": "string",
"description": "anchoring stage",
"name": "anchor_stage",
"in": "query"
},
{
"type": "string",
"description": "anchoring date",
"name": "anchor_date",
"in": "query"
},
{
"type": "integer",
"description": "comparison. -1 for normals, or any int between 1981 and 2021 for a single year",
"name": "comparison",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/models.Bins"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -574,7 +730,7 @@ ...@@ -574,7 +730,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -696,7 +852,7 @@ ...@@ -696,7 +852,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -733,7 +889,7 @@ ...@@ -733,7 +889,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -799,7 +955,7 @@ ...@@ -799,7 +955,7 @@
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -807,7 +963,11 @@ ...@@ -807,7 +963,11 @@
}, },
"/gdd/normals": { "/gdd/normals": {
"get": { "get": {
"description": "get gdd normals", "security": [
{
"ApiKeyAuth": []
}
],
"consumes": [ "consumes": [
"application/json" "application/json"
], ],
...@@ -815,26 +975,14 @@ ...@@ -815,26 +975,14 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"Gdd" "Gdd",
"public"
], ],
"summary": "Get gdd normals", "summary": "Get GDD normals over the past 30 years",
"parameters": [ "parameters": [
{ {
"enum": [ "enum": [
"corn", "corn"
"soybean",
"sunflower",
"tomato",
"sugar_beet",
"peanut",
"cotton",
"potato",
"wheat",
"pea",
"oat",
"spring_wheat",
"rice",
"sorghum"
], ],
"type": "string", "type": "string",
"description": "Crop to calculate gdd for", "description": "Crop to calculate gdd for",
...@@ -862,91 +1010,25 @@ ...@@ -862,91 +1010,25 @@
"name": "accumulate", "name": "accumulate",
"in": "query", "in": "query",
"required": true "required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.GddResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/common.StandardError"
}
}
}
}
},
"/gdd/stages": {
"get": {
"description": "Get stages",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Maturity"
],
"summary": "Get stages",
"parameters": [
{
"type": "number",
"description": "Latitude to search for",
"name": "latitude",
"in": "query",
"required": true
}, },
{ {
"type": "number", "type": "number",
"description": "Longitude to search for", "description": "number of times to repeat the request. When included with planting date, will extrapolate plantingdate -\u003e end of repeatYears range",
"name": "longitude", "name": "repeatYears",
"in": "query", "in": "query"
"required": true
},
{
"type": "string",
"description": "Plant date, ISO8601 or RFC3339 format",
"name": "plant_date",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Mode, rm or gdds_to_maturity",
"name": "mode",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "Value of mode",
"name": "value",
"in": "query",
"required": true
} }
], ],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
"schema": { "schema": {
"type": "object", "$ref": "#/definitions/models.GddResponse"
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
} }
}, },
"400": { "400": {
"description": "Bad Request", "description": "Bad Request",
"schema": { "schema": {
"$ref": "#/definitions/common.StandardError" "$ref": "#/definitions/errors.StandardError"
} }
} }
} }
...@@ -954,7 +1036,7 @@ ...@@ -954,7 +1036,7 @@
} }
}, },
"definitions": { "definitions": {
"common.StandardError": { "errors.StandardError": {
"type": "object", "type": "object",
"properties": { "properties": {
"description": { "description": {
...@@ -988,6 +1070,34 @@ ...@@ -988,6 +1070,34 @@
} }
} }
}, },
"models.Bin": {
"type": "object",
"properties": {
"date": {
"type": "string"
},
"value": {
"type": "number"
}
}
},
"models.Bins": {
"type": "object",
"properties": {
"bins": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Bin"
}
},
"comparison_mean": {
"type": "string"
},
"count": {
"type": "integer"
}
}
},
"models.CfsGddResponse": { "models.CfsGddResponse": {
"type": "object", "type": "object",
"properties": { "properties": {
...@@ -1195,5 +1305,12 @@ ...@@ -1195,5 +1305,12 @@
} }
} }
} }
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
} }
} }
\ No newline at end of file
definitions: definitions:
common.StandardError: errors.StandardError:
properties: properties:
description: description:
type: string type: string
...@@ -21,6 +21,24 @@ definitions: ...@@ -21,6 +21,24 @@ definitions:
closest_longitude: closest_longitude:
type: number type: number
type: object type: object
models.Bin:
properties:
date:
type: string
value:
type: number
type: object
models.Bins:
properties:
bins:
items:
$ref: '#/definitions/models.Bin'
type: array
comparison_mean:
type: string
count:
type: integer
type: object
models.CfsGddResponse: models.CfsGddResponse:
properties: properties:
closest_latitude: closest_latitude:
...@@ -160,7 +178,6 @@ info: ...@@ -160,7 +178,6 @@ info:
contact: contact:
email: tgsiegel@umd.edu email: tgsiegel@umd.edu
name: API Support name: API Support
description: All operations for GDD/Freezing Date data
title: Dawn GDD Service title: Dawn GDD Service
paths: paths:
/freezing-dates: /freezing-dates:
...@@ -194,7 +211,7 @@ paths: ...@@ -194,7 +211,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: get freezing dates summary: get freezing dates
tags: tags:
- Freezing Dates - Freezing Dates
...@@ -224,7 +241,7 @@ paths: ...@@ -224,7 +241,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get analog year summary: Get analog year
tags: tags:
- Gdd - Gdd
...@@ -279,7 +296,7 @@ paths: ...@@ -279,7 +296,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get GDD values calculated from CFS summary: Get GDD values calculated from CFS
tags: tags:
- Gdd - Gdd
...@@ -332,6 +349,16 @@ paths: ...@@ -332,6 +349,16 @@ paths:
name: longitude name: longitude
required: true required: true
type: number type: number
- description: Plant date, ISO8601 or RFC3339 format
in: query
name: plantingDate
required: true
type: string
- description: number of times to repeat the request. When included with planting
date, will extrapolate plantingdate -> end of repeatYears range
in: query
name: repeatYears
type: number
produces: produces:
- application/json - application/json
responses: responses:
...@@ -342,7 +369,7 @@ paths: ...@@ -342,7 +369,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get confidence interval summary: Get confidence interval
tags: tags:
- Gdd - Gdd
...@@ -452,7 +479,7 @@ paths: ...@@ -452,7 +479,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get gdd data csv summary: Get gdd data csv
tags: tags:
- Gdd - Gdd
...@@ -460,7 +487,6 @@ paths: ...@@ -460,7 +487,6 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: get gdd values
parameters: parameters:
- description: Year to get gdd for - description: Year to get gdd for
in: query in: query
...@@ -470,19 +496,6 @@ paths: ...@@ -470,19 +496,6 @@ paths:
- description: Crop to calculate gdd for - description: Crop to calculate gdd for
enum: enum:
- corn - corn
- soybean
- sunflower
- tomato
- sugar_beet
- peanut
- cotton
- potato
- wheat
- pea
- oat
- spring_wheat
- rice
- sorghum
in: query in: query
name: product name: product
required: true required: true
...@@ -502,6 +515,11 @@ paths: ...@@ -502,6 +515,11 @@ paths:
name: accumulate name: accumulate
required: true required: true
type: boolean type: boolean
- description: Plant date RFC3339 format
in: query
name: plantingDate
required: true
type: string
produces: produces:
- application/json - application/json
responses: responses:
...@@ -512,10 +530,112 @@ paths: ...@@ -512,10 +530,112 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get gdd values security:
- ApiKeyAuth: []
summary: Get GDD Values for given year
tags: tags:
- Gdd - Gdd
- public
/gdd/forecast/freezing:
get:
consumes:
- application/json
description: Get stages
parameters:
- description: Latitude to search for
in: query
name: latitude
required: true
type: number
- description: Longitude to search for
in: query
name: longitude
required: true
type: number
- description: Freezing temperature to use
in: query
name: freezing_temp
required: true
type: number
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
items:
type: string
type: array
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/errors.StandardError'
summary: Get stages
tags:
- Forecast
/gdd/forecast/stages:
get:
consumes:
- application/json
description: Get stages
parameters:
- description: Latitude to search for
in: query
name: latitude
required: true
type: number
- description: Longitude to search for
in: query
name: longitude
required: true
type: number
- description: Plant date, ISO8601 or RFC3339 format
in: query
name: plant_date
required: true
type: string
- description: Mode, rm or gdds_to_maturity
in: query
name: mode
required: true
type: string
- description: Value of mode
in: query
name: value
required: true
type: integer
- description: anchoring stage
in: query
name: anchor_stage
type: string
- description: anchoring date
in: query
name: anchor_date
type: string
- description: comparison. -1 for normals, or any int between 1981 and 2021
for a single year
in: query
name: comparison
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
$ref: '#/definitions/models.Bins'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/errors.StandardError'
summary: Get stages
tags:
- Forecast
/gdd/gefs: /gdd/gefs:
get: get:
consumes: consumes:
...@@ -567,7 +687,7 @@ paths: ...@@ -567,7 +687,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get GDD values calculated from GEFS summary: Get GDD values calculated from GEFS
tags: tags:
- Gdd - Gdd
...@@ -652,7 +772,7 @@ paths: ...@@ -652,7 +772,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get expected maturity date summary: Get expected maturity date
tags: tags:
- Maturity - Maturity
...@@ -676,7 +796,7 @@ paths: ...@@ -676,7 +796,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get all generic corn cultivars summary: Get all generic corn cultivars
tags: tags:
- Maturity - Maturity
...@@ -721,7 +841,7 @@ paths: ...@@ -721,7 +841,7 @@ paths:
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get expected maturity date summary: Get expected maturity date
tags: tags:
- Maturity - Maturity
...@@ -729,24 +849,10 @@ paths: ...@@ -729,24 +849,10 @@ paths:
get: get:
consumes: consumes:
- application/json - application/json
description: get gdd normals
parameters: parameters:
- description: Crop to calculate gdd for - description: Crop to calculate gdd for
enum: enum:
- corn - corn
- soybean
- sunflower
- tomato
- sugar_beet
- peanut
- cotton
- potato
- wheat
- pea
- oat
- spring_wheat
- rice
- sorghum
in: query in: query
name: product name: product
required: true required: true
...@@ -766,67 +872,31 @@ paths: ...@@ -766,67 +872,31 @@ paths:
name: accumulate name: accumulate
required: true required: true
type: boolean type: boolean
produces: - description: number of times to repeat the request. When included with planting
- application/json date, will extrapolate plantingdate -> end of repeatYears range
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.GddResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/common.StandardError'
summary: Get gdd normals
tags:
- Gdd
/gdd/stages:
get:
consumes:
- application/json
description: Get stages
parameters:
- description: Latitude to search for
in: query in: query
name: latitude name: repeatYears
required: true
type: number type: number
- description: Longitude to search for
in: query
name: longitude
required: true
type: number
- description: Plant date, ISO8601 or RFC3339 format
in: query
name: plant_date
required: true
type: string
- description: Mode, rm or gdds_to_maturity
in: query
name: mode
required: true
type: string
- description: Value of mode
in: query
name: value
required: true
type: integer
produces: produces:
- application/json - application/json
responses: responses:
"200": "200":
description: OK description: OK
schema: schema:
additionalProperties: $ref: '#/definitions/models.GddResponse'
items:
type: string
type: array
type: object
"400": "400":
description: Bad Request description: Bad Request
schema: schema:
$ref: '#/definitions/common.StandardError' $ref: '#/definitions/errors.StandardError'
summary: Get stages security:
- ApiKeyAuth: []
summary: Get GDD normals over the past 30 years
tags: tags:
- Maturity - Gdd
- public
securityDefinitions:
ApiKeyAuth:
in: header
name: Authorization
type: apiKey
swagger: "2.0" swagger: "2.0"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment