Alternative proposal.

This commit is contained in:
Jonathan Harris 2016-01-22 18:48:39 +00:00
parent 172dfd1913
commit a14f92b2e8
3 changed files with 348 additions and 0 deletions

114
schemas/commodity-v3.0.json Normal file
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,154 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"id" : "http://schemas.elite-markets.net/eddn/outfitting/2#",
"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", "modules" ],
"properties": {
"system" : {
"$ref" : "#/definitions/systemWithId"
},
"station" : {
"$ref" : "#/definitions/nameWithId"
},
"timestamp": {
"type" : "string",
"format" : "date-time"
},
"modules": {
"type" : "array",
"description" : "List of available modules in English as displayed in-game. Modules that depend on the Cmdr's purchases (e.g. paintjobs) or rank (e.g. decals and PowerPlay faction-specific modules) should be omitted.",
"uniqueItems" : true,
"items" : {
"oneOf": [
{
"type" : "object",
"properties" : {
"id": {
"type" : "integer",
"description" : "If present should be treated by clients as taking precedence over \"name\""
},
"category" : { "enum": [ "hardpoint" ] },
"name" : { "type": "string", "minLength": 1 },
"mount" : { "$ref": "#/definitions/mount" },
"guidance" : { "$ref": "#/definitions/guidance" },
"class" : { "$ref": "#/definitions/class" },
"rating" : { "$ref": "#/definitions/rating" }
},
"required" : [ "category", "name", "mount", "class", "rating" ],
"additionalProperties" : false
},
{
"type" : "object",
"properties" : {
"id": {
"type" : "integer",
"description" : "If present should be treated by clients as taking precedence over \"name\""
},
"category" : { "enum": [ "utility" ] },
"name" : { "type": "string", "minLength": 1 },
"class" : { "$ref": "#/definitions/class" },
"rating" : { "$ref": "#/definitions/rating" }
},
"required" : [ "category", "name", "class", "rating" ],
"additionalProperties" : false
},
{
"type" : "object",
"properties" : {
"id": {
"type" : "integer",
"description" : "If present should be treated by clients as taking precedence over \"name\""
},
"category" : { "enum": [ "standard" ] },
"name" : { "type": "string", "minLength": 1 },
"ship" : { "type": "string",
"minLength" : 1,
"description" : "For ship-specific modules (e.g. armour) must be one of the ship names defined in http://schemas.elite-markets.net/eddn/shipyard/1" },
"class" : { "$ref": "#/definitions/class" },
"rating" : { "$ref": "#/definitions/rating" }
},
"required" : [ "category", "name", "class", "rating" ],
"additionalProperties" : false
},
{
"type" : "object",
"properties" : {
"id": {
"type" : "integer",
"description" : "If present should be treated by clients as taking precedence over \"name\""
},
"category" : { "enum": [ "internal" ] },
"name" : { "type": "string", "minLength": 1 },
"class" : { "$ref": "#/definitions/class" },
"rating" : { "$ref": "#/definitions/rating" }
},
"required" : [ "category", "name", "class", "rating" ],
"additionalProperties" : false
}
]
}
}
}
}
},
"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\"" }
}
},
"class": {
"enum": [ "0", "1", "2", "3", "4", "5", "6", "7", "8" ]
},
"rating": {
"enum": [ "I", "A", "B", "C", "D", "E", "F", "G", "H" ]
},
"mount": {
"enum": [ "Fixed", "Gimballed", "Turreted" ],
"description": "Weapon mounting mode"
},
"guidance": {
"enum": [ "Dumbfire", "Seeker" ],
"description": "Missile and Torpedo weapon guidance mode"
}
}
}

View File

@ -0,0 +1,80 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"id" : "http://schemas.elite-markets.net/eddn/shipyard/2#",
"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", "ships" ],
"properties" : {
"system" : {
"$ref" : "#/definitions/systemWithId"
},
"station" : {
"$ref" : "#/definitions/nameWithId"
},
"timestamp": {
"type" : "string",
"format" : "date-time"
},
"ships": {
"type" : "array",
"uniqueItems" : true,
"items" : {
"$ref" : "#/definitions/nameWithId"
},
"description" : "Ship names in English as displayed in-game. i.e. one of: Adder, Anaconda, Asp, Asp Scout, Cobra Mk III, Cobra MkIV, DiamondBack Scout, Diamondback Explorer, Eagle, Federal Assault Ship, Federal Corvette, Federal Dropship, Federal Gunship, Fer-de-Lance, Hauler, Imperial Clipper, Imperial Courier, Imperial Cutter, Imperial Eagle, Keelback, Orca, Python, Sidewinder, Type-6 Transporter, Type-7 Transporter, Type-9 Heavy, Viper, Viper MkIV, Vulture"
}
}
}
},
"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\"" }
}
}
}
}