mirror of
https://github.com/EDCD/EDDN.git
synced 2025-06-07 19:03:10 +03:00
Refactoring and Validation
- Removed useless "additionalProperties" - Ensure validation of commodities name - Refactored formating for readability
This commit is contained in:
parent
beb003ba2e
commit
bf7e64e97a
@ -3,117 +3,106 @@
|
|||||||
"id" : "http://schemas.elite-markets.net/eddn/commodity/2#",
|
"id" : "http://schemas.elite-markets.net/eddn/commodity/2#",
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
"additionalProperties" : false,
|
"additionalProperties" : false,
|
||||||
|
"required" : [ "$schemaRef", "header", "message" ],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"$schemaRef" : {
|
"$schemaRef" : {
|
||||||
"type": "string",
|
"type" : "string"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"header" : {
|
"header" : {
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
"additionalProperties" : true,
|
"additionalProperties" : true,
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"uploaderID": {
|
"uploaderID" : { "type": "string" },
|
||||||
"type": "string",
|
"softwareName" : { "type": "string" },
|
||||||
"additionalProperties": false
|
"softwareVersion" : { "type": "string" },
|
||||||
},
|
|
||||||
"softwareName": {
|
|
||||||
"type": "string",
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"softwareVersion": {
|
|
||||||
"type": "string",
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"gatewayTimestamp": {
|
"gatewayTimestamp": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"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.",
|
"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": {
|
"message": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
"required": [ "systemName", "stationName", "timestamp", "commodities" ],
|
||||||
"properties": {
|
"properties": {
|
||||||
"systemName": {
|
"systemName": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"stationName": {
|
"stationName": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"timestamp": {
|
"timestamp": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"commodities": {
|
"commodities": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"additionalProperties": false,
|
|
||||||
"items": {
|
"items": {
|
||||||
"oneOf": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"type" : "object",
|
"type" : "object",
|
||||||
|
"additionalProperties" : false,
|
||||||
|
"required" : [ "name", "buyPrice", "supply", "sellPrice", "demand" ],
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"$ref": "#/definitions/commoditiesName"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"buyPrice": {
|
"buyPrice": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "Price to buy from the market",
|
"description": "Price to buy from the market"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"supply": {
|
"supply": {
|
||||||
"type": "integer",
|
"type": "integer"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"supplyLevel": {
|
"supplyLevel": {
|
||||||
"$ref": "#/definitions/levelType"
|
"$ref": "#/definitions/levelType"
|
||||||
},
|
},
|
||||||
"sellPrice": {
|
"sellPrice": {
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "Price to sell to the market",
|
"description": "Price to sell to the market"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"demand": {
|
"demand": {
|
||||||
"type": "integer",
|
"type": "integer"
|
||||||
"additionalProperties": false
|
|
||||||
},
|
},
|
||||||
"demandLevel": {
|
"demandLevel": {
|
||||||
"$ref": "#/definitions/levelType"
|
"$ref": "#/definitions/levelType"
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"required": [
|
|
||||||
"name",
|
|
||||||
"buyPrice",
|
|
||||||
"supply",
|
|
||||||
"sellPrice",
|
|
||||||
"demand"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
"required": [
|
|
||||||
"systemName",
|
|
||||||
"stationName",
|
|
||||||
"commodities",
|
|
||||||
"timestamp"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
|
||||||
"$schemaRef",
|
|
||||||
"header",
|
|
||||||
"message"
|
|
||||||
],
|
|
||||||
"definitions" : {
|
"definitions" : {
|
||||||
"levelType" : {
|
"levelType" : {
|
||||||
"enum": ["Low", "Med", "High"]
|
"enum": ["Low", "Med", "High"]
|
||||||
|
},
|
||||||
|
"commoditiesName" : {
|
||||||
|
"enum": [
|
||||||
|
"explosives", "hydrogen fuel", "mineral oil", "pesticides",
|
||||||
|
"clothing", "consumer technology", "domestic appliances",
|
||||||
|
"beer", "liquor", "narcotics", "tobacco", "wine",
|
||||||
|
"algae", "animal meat", "coffee", "fish", "food cartridges", "fruit and vegetables", "grain", "synthetic meat", "tea",
|
||||||
|
"polymers", "semiconductors", "superconductors",
|
||||||
|
"atmospheric processors", "crop harvesters", "marine equipment", "microbial furnaces", "mineral extractors", "power generators", "water purifiers",
|
||||||
|
"agri-medicines", "basic medicines", "combat stabilisers", "performance enhancers", "progenitor cells",
|
||||||
|
"aluminium", "beryllium", "cobalt", "copper", "gallium", "gold", "indium", "lithium", "palladium", "platinum", "silver", "tantalum", "titanium", "uranium",
|
||||||
|
"bauxite", "bertrandite", "coltan", "gallite", "indite", "lepidolite", "painite", "rutile", "uraninite",
|
||||||
|
"imperial slaves", "slaves",
|
||||||
|
"advanced catalysers", "animal monitors", "aquaponic systems", "auto-fabricators", "bioreducing lichen", "computer components", "h.e. suits",
|
||||||
|
"land enrichment systems", "resonating separators", "robotics", "terrain enrichment systems",
|
||||||
|
"leather", "natural fabrics", "synthetic fabrics",
|
||||||
|
"biowaste", "chemical waste", "scrap", "toxic waste",
|
||||||
|
"battle weapons", "non-lethal weapons", "personal weapons", "reactive armour"
|
||||||
|
],
|
||||||
|
"description": "Valid commodities names. Have to be lowercase."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user