Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert 146 #180

Merged
merged 9 commits into from
Nov 26, 2018
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
2 changes: 1 addition & 1 deletion generate_schema/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "pypi"
[packages]

[dev-packages]
jsonschema = "==3.0.0a2"
jsonschema = ">=3.0.0a2"
requests = "*"

[requires]
Expand Down
20 changes: 10 additions & 10 deletions generate_schema/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions generate_schema/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@
},
"timestamp": {
"$id": "#/definitions/timestamp",
"title": "Integer milliseconds since Unix epoch",
"title": "Floating-point seconds since Unix epoch",
"type": "number",
"multipleOf": 1.0,
"minimum": 0
"minimum": 0.0
}
}
}
3 changes: 1 addition & 2 deletions generate_schema/generate_provider_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
MDS_FEATURECOLLECTION_ROUTE = "MDS_FeatureCollection_Route"

def get_definition(id):
return f"#/definitions/{id}"
return "#/definitions/{}".format(id)

def get_point_schema():
"""
Expand Down Expand Up @@ -53,7 +53,6 @@ def get_feature_schema(id=None, title=None, geometry=None, properties=None, requ

f_properties = feature["properties"]["properties"]
if required is not None:
del f_properties["oneOf"]
f_properties["required"] = required
if properties is not None:
f_properties["properties"] = properties
Expand Down
8 changes: 6 additions & 2 deletions generate_schema/provider/status_changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,12 @@
},
"event_time": {
"$id": "#/properties/data/properties/status_changes/items/properties/event_time",
"type": "number",
"description": "The time the event occurred, expressed as a Unix Timestamp",
"$ref": "#/definitions/timestamp"
"default": 0.0,
"examples": [
1529968782.421409
]
},
"event_location": {
"$id": "#/properties/data/properties/status_changes/items/properties/event_location",
Expand Down Expand Up @@ -202,4 +206,4 @@
}
},
"additionalProperties": false
}
}
14 changes: 11 additions & 3 deletions generate_schema/provider/trips.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,21 @@
},
"start_time": {
"$id": "#/properties/data/properties/trips/items/properties/start_time",
"type": "number",
"description": "The time the trip began, expressed as a Unix Timestamp",
"$ref": "#/definitions/timestamp"
"default": 0.0,
"examples": [
1529968782.421409
]
},
"end_time": {
"$id": "#/properties/data/properties/trips/items/properties/end_time",
"type": "number",
"description": "The time the trip ended, expressed as a Unix Timestamp",
"$ref": "#/definitions/timestamp"
"default": 0.0,
"examples": [
1531007628.3774529
]
},
"parking_verification_url": {
"$id": "#/properties/data/properties/trips/items/properties/parking_verification_url",
Expand Down Expand Up @@ -167,4 +175,4 @@
}
},
"additionalProperties": false
}
}
9 changes: 5 additions & 4 deletions provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ represented as a GeoJSON [`Feature`](https://tools.ietf.org/html/rfc7946#section
{
"type": "Feature",
"properties": {
"timestamp": 1529968782421
"timestamp": 1529968782.421409
},
"geometry": {
"type": "Point",
Expand All @@ -101,7 +101,8 @@ represented as a GeoJSON [`Feature`](https://tools.ietf.org/html/rfc7946#section

### Timestamps

References to `timestamp` imply integer milliseconds since [Unix epoch](https://en.wikipedia.org/wiki/Unix_time). You can find the implementation of unix timestamp in milliseconds for your programming language [here](https://currentmillis.com/).
References to `timestamp` imply floating-point seconds since [Unix epoch](https://en.wikipedia.org/wiki/Unix_time), such as
the format returned by Python's [`time.time()`](https://docs.python.org/3/library/time.html#time.time) function.

[Top][toc]

Expand Down Expand Up @@ -186,7 +187,7 @@ Routes must include at least 2 points: the start point and end point. Additional
"features": [{
"type": "Feature",
"properties": {
"timestamp": 1529968782421
"timestamp": 1529968782.421409
},
"geometry": {
"type": "Point",
Expand All @@ -199,7 +200,7 @@ Routes must include at least 2 points: the start point and end point. Additional
{
"type": "Feature",
"properties": {
"timestamp": 1531007628377
"timestamp": 1531007628.3774529
},
"geometry": {
"type": "Point",
Expand Down
24 changes: 11 additions & 13 deletions provider/status_changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
]
},
"properties": {
"type": "object",
"required": [
"timestamp"
],
Expand Down Expand Up @@ -149,10 +150,9 @@
},
"timestamp": {
"$id": "#/definitions/timestamp",
"title": "Integer milliseconds since Unix epoch",
"title": "Floating-point seconds since Unix epoch",
"type": "number",
"multipleOf": 1.0,
"minimum": 0
"minimum": 0.0
},
"vehicle_type": {
"$id": "#/definitions/vehicle_type",
Expand Down Expand Up @@ -342,8 +342,12 @@
},
"event_time": {
"$id": "#/properties/data/properties/status_changes/items/properties/event_time",
"type": "number",
"description": "The time the event occurred, expressed as a Unix Timestamp",
"$ref": "#/definitions/timestamp"
"default": 0.0,
"examples": [
1529968782.421409
]
},
"event_location": {
"$id": "#/properties/data/properties/status_changes/items/properties/event_location",
Expand All @@ -352,10 +356,7 @@
},
"battery_pct": {
"$id": "#/properties/data/properties/status_changes/items/properties/battery_pct",
"type": [
"number",
"null"
],
"type": ["number", "null"],
"description": "Percent charge of device battery, expressed between 0 and 1",
"examples": [
0.89
Expand All @@ -365,10 +366,7 @@
},
"associated_trips": {
"$id": "#/properties/data/properties/status_changes/items/properties/associated_trips",
"type": [
"array",
"null"
],
"type": ["array", "null"],
"description": "For 'Reserved' event types, associated trip_ids",
"items": {
"$id": "#/properties/data/properties/status_changes/items/properties/associated_trips/items",
Expand All @@ -387,4 +385,4 @@
}
},
"additionalProperties": false
}
}
35 changes: 17 additions & 18 deletions provider/trips.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
]
},
"properties": {
"type": "object",
"required": [
"timestamp"
],
Expand Down Expand Up @@ -180,10 +181,9 @@
},
"timestamp": {
"$id": "#/definitions/timestamp",
"title": "Integer milliseconds since Unix epoch",
"title": "Floating-point seconds since Unix epoch",
"type": "number",
"multipleOf": 1.0,
"minimum": 0
"minimum": 0.0
},
"vehicle_type": {
"$id": "#/definitions/vehicle_type",
Expand Down Expand Up @@ -333,20 +333,25 @@
},
"start_time": {
"$id": "#/properties/data/properties/trips/items/properties/start_time",
"type": "number",
"description": "The time the trip began, expressed as a Unix Timestamp",
"$ref": "#/definitions/timestamp"
"default": 0.0,
"examples": [
1529968782.421409
]
},
"end_time": {
"$id": "#/properties/data/properties/trips/items/properties/end_time",
"type": "number",
"description": "The time the trip ended, expressed as a Unix Timestamp",
"$ref": "#/definitions/timestamp"
"default": 0.0,
"examples": [
1531007628.3774529
]
},
"parking_verification_url": {
"$id": "#/properties/data/properties/trips/items/properties/parking_verification_url",
"type": [
"string",
"null"
],
"type": ["string", "null"],
"description": "A URL to a photo (or other evidence) of proper vehicle parking",
"examples": [
"https://data.provider.co/parking_verify/1234.jpg"
Expand All @@ -355,21 +360,15 @@
},
"standard_cost": {
"$id": "#/properties/data/properties/trips/items/properties/standard_cost",
"type": [
"integer",
"null"
],
"type": ["integer", "null"],
"description": "The cost, in cents, that it would cost to perform the trip in the standard operation of the System",
"examples": [
500
]
},
"actual_cost": {
"$id": "#/properties/data/properties/trips/items/properties/actual_cost",
"type": [
"integer",
"null"
],
"type": ["integer", "null"],
"description": "The actual cost, in cents, paid by the customer of the mobility as a service provider",
"examples": [
520
Expand All @@ -386,4 +385,4 @@
}
},
"additionalProperties": false
}
}