schemas/commodity: Bring in line with new standards

* There's a lot that's still only in the README, which I would have added when
  creating the README based on EDMC code.
* Specific ellisions now marked in the schema.
* All key renames now marked in the schema.
This commit is contained in:
Athanasius 2022-01-30 15:57:26 +00:00
parent df09dd064e
commit 0ee415deb1
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D
2 changed files with 45 additions and 26 deletions

View File

@ -24,18 +24,12 @@ See [Using CAPI data](#using-capi-data) below.
So, as per the schema, do include it if available. So, as per the schema, do include it if available.
### Key Renames ### Key Renames
Many of the key names have a different case defined in this schema, make Some key names in this Schema are different from how they appear in source
sure you are renaming them as appropriate. Journal data. Look for keys where the object contains a `renamed` key - the
value is what the name would have been in the source Journal data. The names
#### StarSystem to systemName used are as found in the CAPI source data.
Rename the `StarSystem` key name to `systemName`.
### Elisions ### Elisions
#### Remove _Localised key/values
All keys whose name ends with `_Localised`, i.e. the `Name_Localised`
key/values in Items.
#### Other Elisions
You MUST remove the following key/value pairs from the data: You MUST remove the following key/value pairs from the data:
- `StationType` key/value. - `StationType` key/value.
@ -50,15 +44,13 @@ In the list of commodites:
string (not normally traded at this station market). string (not normally traded at this station market).
#### Item Category #### Item Category
Remove not only the `Category_Localised` key/value, as above, but also the Remove not only the `Category_Localised` key:values, but also the
`Category` key/value pair from each Item. `Category` key:value pair from each Item.
### Augmentations ### Augmentations
#### horizons flag #### horizons and odyssey flags
You SHOULD add this key/value pair, using the value from the `LoadGame` event. Please read [horizons and odyssey flags](../../docs/Developers.md#horizons-and-odyssey-flags)
over in the Developers' documentation.
#### odyssey flag
You SHOULD add this key/value pair, using the value from the `LoadGame` event.
### Using CAPI data ### Using CAPI data
It is *not* recommended to use CAPI data as the source as it's fraught with It is *not* recommended to use CAPI data as the source as it's fraught with
@ -66,10 +58,10 @@ additional issues. EDMarketConnector does so in order to facilitate
obtaining data without the player needing to open the commodities screen. obtaining data without the player needing to open the commodities screen.
Please read Please read
[the guidance on checking for CAPI lag](README-EDDN-schemas.md#detecting-capi-data-lag) [the guidance on checking for CAPI lag](../docs/Developers.md#detecting-capi-data-lag)
before utilising CAPI data for EDDN messages. before utilising CAPI data for EDDN messages.
Note that CAPI `/market` data will sometimes have the `StatusFlasg` per Note that CAPI `/market` data will sometimes have the `statusFlasg` per
item, which are defined as optional in this schema (because they're not in item, which are defined as optional in this schema (because they're not in
the Market.json data). You SHOULD include this data in your message if the Market.json data). You SHOULD include this data in your message if
using CAPI as the source. using CAPI as the source.
@ -91,4 +83,4 @@ any of the listed ships or modules have a `sku` value of
#### CAPI odyssey flag #### CAPI odyssey flag
Unfortunately there is no method to be *certain* of this from CAPI data, so Unfortunately there is no method to be *certain* of this from CAPI data, so
you will have to trust in the system/station name check and use the value you will have to trust in the system/station name check and use the value
from the Journal `LoadGame` event. from the Journal `LoadGame` event.

View File

@ -40,10 +40,12 @@
}, },
"stationName": { "stationName": {
"type" : "string", "type" : "string",
"renamed" : "StarSystem",
"minLength" : 1 "minLength" : 1
}, },
"marketId": { "marketId": {
"type" : "integer" "type" : "integer",
"renamed" : "MarketID"
}, },
"horizons": { "horizons": {
"type" : "boolean", "type" : "boolean",
@ -67,31 +69,39 @@
"properties" : { "properties" : {
"name": { "name": {
"type" : "string", "type" : "string",
"renamed" : "Name",
"minLength" : 1, "minLength" : 1,
"description" : "Symbolic name as returned by the Companion API" "description" : "Symbolic name as returned by the Companion API"
}, },
"meanPrice": { "meanPrice": {
"type" : "integer" "type" : "integer",
"renamed" : "MeanPrice"
}, },
"buyPrice": { "buyPrice": {
"type" : "integer", "type" : "integer",
"renaamed" : "BuyPrice",
"description" : "Price to buy from the market" "description" : "Price to buy from the market"
}, },
"stock": { "stock": {
"type" : "integer" "type" : "integer",
"renamed" : "Stock"
}, },
"stockBracket": { "stockBracket": {
"$ref" : "#/definitions/levelType" "$ref" : "#/definitions/levelType",
"renamed" : "StockBracket"
}, },
"sellPrice": { "sellPrice": {
"type" : "integer", "type" : "integer",
"renamed" : "SellPrice",
"description" : "Price to sell to the market" "description" : "Price to sell to the market"
}, },
"demand": { "demand": {
"type" : "integer" "type" : "integer",
"renamed" : "Demand"
}, },
"demandBracket": { "demandBracket": {
"$ref" : "#/definitions/levelType" "$ref" : "#/definitions/levelType",
"renamed" : "DemandBracket"
}, },
"statusFlags": { "statusFlags": {
"type" : "array", "type" : "array",
@ -101,6 +111,18 @@
"type" : "string", "type" : "string",
"minLength" : 1 "minLength" : 1
} }
},
"Producer": {
"$ref" : "#/definitions/disallowed",
"description" : "Not present in CAPI data, so removed from Journal-sourced data"
},
"Rare" : {
"$ref" : "#/definitions/disallowed",
"description" : "Not present in CAPI data, so removed from Journal-sourced data"
},
"id": {
"$ref" : "#/definitions/disallowed",
"description" : "Not wanted for historical reasons?"
} }
} }
} }
@ -130,11 +152,16 @@
"type" : "string", "type" : "string",
"minLength" : 1 "minLength" : 1
} }
},
"StationType": {
"$ref" : "#/definitions/disallowed",
"description" : "Not present in CAPI data, so removed from Journal-sourced data"
} }
} }
} }
}, },
"definitions": { "definitions": {
"disallowed" : { "not" : { "type": [ "array", "boolean", "integer", "number", "null", "object", "string" ] } },
"levelType": { "levelType": {
"enum" : [0, 1, 2, 3, ""], "enum" : [0, 1, 2, 3, ""],
"description" : "Note: A value of \"\" indicates that the commodity is not normally sold/purchased at this station, but is currently temporarily for sale/purchase" "description" : "Note: A value of \"\" indicates that the commodity is not normally sold/purchased at this station, but is currently temporarily for sale/purchase"