Skip to content

Commit

Permalink
public.json: Add 'GET /route-stops' and /route-stop/{id} endpoints
Browse files Browse the repository at this point in the history
We only create stops at verification time, but folks will want to have
estimated delivery times while they're shopping for their order.
David confirmed that a single model should store the usual offset
between the start of delivery and a given drop on a route, so we need
to expose that data publically.  This commit specifies that API and
adjusts the stop description to explain that it's only useful for
verified trips.

The duration format specifies ISO 8601 durations [1,2].  I've proposed
it for inclusion in future versions of Swagger [3], but until that's
accepted we're using it as a custom format [4].

[1]: https://tools.ietf.org/html/rfc3339#page-13
[2]: http://en.wikipedia.org/wiki/ISO_8601#Durations
[3]: OAI/OpenAPI-Specification#359
[4]: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
     Swagger uses several known formats to more finely define the data
     type being used. However, the format property is an open
     string-valued property, and can have any value to support
     documentation needs. Formats such as "email", "uuid", etc., can
     be used even though they are not defined by this specification.
  • Loading branch information
wking committed May 7, 2015
1 parent 9bae8db commit d2a35b3
Showing 1 changed file with 155 additions and 3 deletions.
158 changes: 155 additions & 3 deletions public.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,115 @@
}
}
},
"/route-stops": {
"get": {
"summary": "Returns all route-stops from the system that the user has access to",
"description": "Route-stops are ordered for increasing offset from the route's trip cutoff",
"operationId": "findRouteStops",
"tags": [
"stop"
],
"parameters": [
{
"name": "route",
"in": "query",
"description": "route names to filter by",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "csv"
},
{
"name": "drop",
"in": "query",
"description": "drop IDs to filter by",
"required": false,
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"collectionFormat": "csv"
},
{
"name": "limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "start",
"in": "query",
"description": "offset to the first result to return. Use negative numbers to offset from the end of the result list.",
"required": false,
"type": "integer",
"format": "int32"
}
],
"responses": {
"200": {
"description": "route-stop response",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/routeStop"
}
},
"headers": {
"Count": {
"description": "total number of matching results (how many you'd get if you didn't set `limit`)",
"type": "integer",
"format": "int32",
"minimum": 0
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
},
"/route-stop/{id}": {
"get": {
"summary": "Returns a route-stop based on a single ID, if the user has access to the route-stop",
"operationId": "findRouteStopById",
"tags": [
"stop"
],
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of route-stop to fetch",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "route-stop response",
"schema": {
"$ref": "#/definitions/routeStop"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
},
"/stops": {
"get": {
"summary": "Returns all stops from the system that the user has access to",
Expand Down Expand Up @@ -2106,11 +2215,17 @@
"description": "number of days between cutoffs",
"type": "integer",
"format": "int32"
},
"delivery-offset": {
"description": "number of days after cutoff before the first stop",
"type": "integer",
"format": "int32"
}
},
"required": [
"name",
"cutoff-frequency"
"cutoff-frequency",
"delivery-offset"
]
},
"newRoute": {
Expand All @@ -2132,16 +2247,53 @@
"description": "cutoff for placing orders on this trip",
"type": "string",
"format": "date-time"
},
"delivery-start": {
"description": "day of the first stop (in stop-local time)",
"type": "string",
"format": "date"
}
},
"required": [
"id",
"route",
"cutoff"
"cutoff",
"delivery-start"
]
},
"routeStop": {
"description": "a template used to create stops when a trip is verified",
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"route": {
"description": "route name for the route-stop",
"type": "string"
},
"drop": {
"description": "drop ID for the route-stop",
"type": "integer",
"format": "int64"
},
"delivery-offset": {
"description": "offset from midnight on the morning of the trips's delivery start until the usual delivery time for this drop",
"type": "string",
"format": "duration"
}
},
"required": [
"id",
"route",
"drop",
"target-time",
"estimated-time"
]
},
"stop": {
"description": "a trip stop or waypoint",
"description": "a trip stop or waypoint on a verified trip",
"type": "object",
"properties": {
"id": {
Expand Down

0 comments on commit d2a35b3

Please sign in to comment.