diff --git a/schemas/commodity-v0.1.json b/schemas/commodity-v0.1.json index 0e354af..c98b3dd 100644 --- a/schemas/commodity-v0.1.json +++ b/schemas/commodity-v0.1.json @@ -5,32 +5,26 @@ "additionalProperties": false, "properties": { "$schemaRef": { - "id": "#$schemaRef", "type": "string", "additionalProperties": false }, "header": { - "id": "#header", "type": "object", "additionalProperties": true, "properties": { "uploaderID": { - "id": "#uploaderID", "type": "string", "additionalProperties": false }, "softwareName": { - "id": "#softwareName", "type": "string", "additionalProperties": false }, "softwareVersion": { - "id": "#softwareVersion", "type": "string", "additionalProperties": false }, "gatewayTimestamp": { - "id": "#gatewayTimestamp", "type": "string", "format": "date-time", "description": "Timestamp upon receipt at the gateway. If present, this property will be overwritten by the gateway; submitters are not intended to populate this property.", @@ -39,33 +33,27 @@ } }, "message": { - "id": "#message", "type": "object", "additionalProperties": true, "properties": { "systemName": { - "id": "#systemName", "type": "string", "additionalProperties": false }, "stationName": { - "id": "#stationName", "type": "string", "additionalProperties": false }, "itemName": { - "id": "#itemName", "type": "string", "additionalProperties": false }, "buyPrice": { - "id": "#buyPrice", "type": "integer", "description": "Price to buy from the market", "additionalProperties": false }, "stationStock": { - "id": "#stationStock", "type": "integer", "additionalProperties": false }, @@ -73,13 +61,11 @@ "$ref": "#/definitions/levelType" }, "sellPrice": { - "id": "#sellPrice", "type": "integer", "description": "Price to sell to the market", "additionalProperties": false }, "demand": { - "id": "#demand", "type": "integer", "additionalProperties": false }, @@ -87,7 +73,6 @@ "$ref": "#/definitions/levelType" }, "timestamp": { - "id": "#timestamp", "type": "string", "format": "date-time", "additionalProperties": false diff --git a/schemas/commodity-v2.0-draft.json b/schemas/commodity-v2.0-draft.json new file mode 100644 index 0000000..d6ee7c2 --- /dev/null +++ b/schemas/commodity-v2.0-draft.json @@ -0,0 +1,88 @@ +{ + "$schema" : "http://json-schema.org/draft-04/schema#", + "id" : "http://schemas.elite-markets.net/eddn/commodity/2#", + "type" : "object", + "additionalProperties" : false, + "required" : [ "$schemaRef", "header", "message" ], + "properties" : { + "$schemaRef" : { "type": "string" }, + + "header" : { + "type" : "object", + "additionalProperties" : true, + "properties" : { + "uploaderID" : { "type": "string" }, + "softwareName" : { "type": "string" }, + "softwareVersion" : { "type": "string" }, + "gatewayTimestamp" : { + "type": "string", + "format": "date-time", + "description": "Timestamp upon receipt at the gateway. If present, this property will be overwritten by the gateway; submitters are not intended to populate this property." + } + } + }, + + "message": { + "type": "object", + "additionalProperties": false, + "required": [ "systemName", "stationName", "timestamp", "commodities" ], + "properties": { + "systemName": { + "type" : "string" + }, + "stationName": { + "type" : "string" + }, + "timestamp": { + "type" : "string", + "format" : "date-time" + }, + "commodities": { + "type" : "array", + "minItems" : 1, + "items" : { + "oneOf": [ + { + "type" : "object", + "additionalProperties" : false, + "required" : [ "name", "buyPrice", "supply", "sellPrice", "demand" ], + "properties" : { + "name": { + "type" : "string", + "minLength" : 1 + }, + "buyPrice": { + "type": "integer", + "description": "Price to buy from the market" + }, + "supply": { + "type": "integer" + }, + "supplyLevel": { + "$ref": "#/definitions/levelType" + }, + "sellPrice": { + "type": "integer", + "description": "Price to sell to the market" + }, + "demand": { + "type": "integer" + }, + "demandLevel": { + "$ref": "#/definitions/levelType" + } + } + } + ] + } + } + } + } + }, + + "definitions" : { + "levelType" : { + "enum": ["Low", "Med", "High"] + } + } +} \ No newline at end of file diff --git a/setup.py b/setup.py index b76fc59..73815a1 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ setup( long_description="""\ The Elite: Dangerous Data Network allows E:D players to share data. Not affiliated with Frontier Developments. """, - install_requires=["bottle", "enum34", "gevent", "jsonschema", "pyzmq", "simplejson"], + install_requires=["argparse", "bottle", "enum34", "gevent", "jsonschema", "pyzmq", "simplejson"], entry_points={ 'console_scripts': [ 'eddn-gateway = eddn.Gateway:main', diff --git a/src/eddn/conf/Settings.py b/src/eddn/conf/Settings.py index 5ff62fe..10dcfce 100644 --- a/src/eddn/conf/Settings.py +++ b/src/eddn/conf/Settings.py @@ -35,7 +35,8 @@ class _Settings(object): GATEWAY_JSON_SCHEMAS = { "http://schemas.elite-markets.net/eddn/commodity/1": "schemas/commodity-v0.1.json", - "http://schemas.elite-markets.net/eddn/commodity/1/test": "schemas/commodity-v0.1.json" + "http://schemas.elite-markets.net/eddn/commodity/1/test": "schemas/commodity-v0.1.json", + "http://schemas.elite-markets.net/eddn/commodity/2": "schemas/commodity-v2.0-draft.json" } def loadFrom(self, fileName):