Archived
0

implement EDDN parser

This commit is contained in:
iMoHax
2016-09-16 15:14:33 +03:00
parent 7913c742b3
commit 53c7f09b54
20 changed files with 1310 additions and 37 deletions

View File

@@ -0,0 +1,117 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://schemas.elite-markets.net/eddn/commodity/1#",
"type": "object",
"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.",
"additionalProperties": false
}
}
},
"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
},
"supplyLevel": {
"$ref": "#/definitions/levelType"
},
"sellPrice": {
"id": "#sellPrice",
"type": "integer",
"description": "Price to sell to the market",
"additionalProperties": false
},
"demand": {
"id": "#demand",
"type": "integer",
"additionalProperties": false
},
"demandLevel": {
"$ref": "#/definitions/levelType"
},
"timestamp": {
"id": "#timestamp",
"type": "string",
"format": "date-time",
"additionalProperties": false
}
},
"required": [
"systemName",
"stationName",
"itemName",
"stationStock",
"sellPrice",
"demand",
"timestamp"
]
}
},
"required": [
"$schemaRef",
"header",
"message"
],
"definitions" : {
"levelType" : {
"enum": ["Low", "Med", "High"]
}
}
}

View File

@@ -0,0 +1,119 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "http://schemas.elite-markets.net/eddn/commodity/2#",
"type": "object",
"additionalProperties": false,
"properties": {
"$schemaRef": {
"type": "string",
"additionalProperties": false
},
"header": {
"type": "object",
"additionalProperties": true,
"properties": {
"uploaderID": {
"type": "string",
"additionalProperties": false
},
"softwareName": {
"type": "string",
"additionalProperties": false
},
"softwareVersion": {
"type": "string",
"additionalProperties": false
},
"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.",
"additionalProperties": false
}
}
},
"message": {
"type": "object",
"additionalProperties": false,
"properties": {
"systemName": {
"type": "string",
"additionalProperties": false
},
"stationName": {
"type": "string",
"additionalProperties": false
},
"timestamp": {
"type": "string",
"format": "date-time",
"additionalProperties": false
},
"commodities": {
"type": "array",
"additionalProperties": false,
"items": {
"oneOf": [
{
"type" : "object",
"properties": {
"name": {
"type": "string",
"additionalProperties": false
},
"buyPrice": {
"type": "integer",
"description": "Price to buy from the market",
"additionalProperties": false
},
"supply": {
"type": "integer",
"additionalProperties": false
},
"supplyLevel": {
"$ref": "#/definitions/levelType"
},
"sellPrice": {
"type": "integer",
"description": "Price to sell to the market",
"additionalProperties": false
},
"demand": {
"type": "integer",
"additionalProperties": false
},
"demandLevel": {
"$ref": "#/definitions/levelType"
}
},
"required": [
"name",
"buyPrice",
"supply",
"sellPrice",
"demand"
]
}
]
}
}
},
"required": [
"systemName",
"stationName",
"commodities",
"timestamp"
]
}
},
"required": [
"$schemaRef",
"header",
"message"
],
"definitions" : {
"levelType" : {
"enum": ["Low", "Med", "High"]
}
}
}

View File

@@ -0,0 +1,114 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"id" : "http://schemas.elite-markets.net/eddn/commodity/3#",
"type" : "object",
"additionalProperties" : false,
"required": [ "$schemaRef", "header", "message" ],
"properties": {
"$schemaRef": {
"type" : "string"
},
"header": {
"type" : "object",
"additionalProperties" : true,
"required" : [ "uploaderID", "softwareName", "softwareVersion" ],
"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" : [ "system", "station", "timestamp", "commodities" ],
"properties" : {
"system" : {
"$ref" : "#/definitions/systemWithId"
},
"station" : {
"$ref" : "#/definitions/nameWithId"
},
"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
},
"id": {
"type" : "integer",
"description" : "If present should be treated by clients as taking precedence over \"name\""
},
"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": {
"systemWithId" : {
"type" :"object",
"additionalProperties" : false,
"required" : [ "name" ],
"properties" : {
"name" : { "type": "string", "minLength" : 1 },
"id" : { "type": "integer", "description" : "If present should be treated by clients as taking precedence over \"name\"" },
"address" : { "type": "integer" }
}
},
"nameWithId" : {
"type" :"object",
"additionalProperties" : false,
"required" : [ "name" ],
"properties" : {
"name" : { "type": "string", "minLength" : 1 },
"id" : { "type": "integer", "description" : "If present should be treated by clients as taking precedence over \"name\"" }
}
}
}
}

View File

@@ -0,0 +1,21 @@
{
"$schemaRef": "http://schemas.elite-markets.net/eddn/commodity/1",
"header": {
"uploaderID": "abcdef0123456789",
"softwareName": "My Awesome Market Uploader",
"softwareVersion": "v3.14",
"gatewayTimestamp": "2014-11-17T13:35:00+00:00"
},
"message": {
"systemName": "Eranin",
"stationName": "Azeban Orbital",
"itemName": "Gold",
"buyPrice": 1024,
"stationStock": 7,
"supplyLevel": "Low",
"sellPrice": 1138,
"demand": 42,
"demandLevel": "Med",
"timestamp": "2014-11-17T12:34:56+00:00"
}
}

View File

@@ -0,0 +1,13 @@
{
"$schemaRef": "http://schemas.elite-markets.net/eddn/commodity/1",
"header": {
},
"message": {
"itemName": "Gold",
"buyPrice": 1024,
"stationStock": 7,
"sellPrice": 1138,
"demand": 42,
"timestamp": "2014-11-17T12:34:56+00:00"
}
}

View File

@@ -0,0 +1,18 @@
{
"$schemaRef": "http://schemas.elite-markets.net/eddn/commodity/1",
"header": {
"uploaderID": "abcdef0123456789",
"softwareName": "My Awesome Market Uploader",
"softwareVersion": "v3.14"
},
"message": {
"systemName": "Eranin",
"stationName": "Azeban Orbital",
"itemName": "Gold",
"buyPrice": 1024,
"stationStock": 7,
"sellPrice": 1138,
"demand": 42,
"timestamp": "2014-11-17T12:34:56+00:00"
}
}

View File

@@ -0,0 +1,33 @@
{
"$schemaRef": "http://schemas.elite-markets.net/eddn/commodity/2",
"header": {
"uploaderID": "abcdef0123456789",
"softwareName": "My Awesome Market Uploader",
"softwareVersion": "v3.14",
"gatewayTimestamp": "2014-11-17T13:35:00+00:00"
},
"message": {
"systemName": "Eranin",
"stationName": "Azeban Orbital",
"timestamp": "2014-11-17T12:34:56+00:00",
"commodities": [
{
"name": "Gold",
"buyPrice": 1024,
"supply": 7,
"supplyLevel": "Low",
"sellPrice": 1138,
"demand": 42,
"demandLevel": "Med"
},
{
"name": "Explosives",
"buyPrice": 999,
"supply": 1500,
"supplyLevel": "Low",
"sellPrice": 0,
"demand": 0
}
]
}
}

View File

@@ -0,0 +1,13 @@
{
"$schemaRef": "http://schemas.elite-markets.net/eddn/commodity/2",
"header": {
"uploaderID": "abcdef0123456789",
"softwareName": "My Awesome Market Uploader",
"softwareVersion": "v3.14"
},
"message": {
"systemName": "Eranin",
"stationName": "Azeban Orbital",
"timestamp": "2014-11-17T12:34:56+00:00"
}
}

View File

@@ -0,0 +1,22 @@
{
"$schemaRef": "http://schemas.elite-markets.net/eddn/commodity/2",
"header": {
"uploaderID": "abcdef0123456789",
"softwareName": "My Awesome Market Uploader",
"softwareVersion": "v3.14"
},
"message": {
"systemName": "Eranin",
"stationName": "Azeban Orbital",
"timestamp": "2014-11-17T12:34:56+00:00",
"commodities": [
{
"name": "Gold",
"buyPrice": 1024,
"supply": 7,
"sellPrice": 1138,
"demand": 42
}
]
}
}