Merge branch 'develop' into beta

This commit is contained in:
Athanasius 2022-05-25 14:59:47 +00:00
commit 497a7603f3
6 changed files with 349 additions and 34 deletions

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>SimpleJavaEDDNSubscribe</artifactId>
<version>1.0-SNAPSHOT</version>
<name>SimpleJavaEDDNSubscribe</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.11</maven.compiler.source>
<maven.compiler.target>1.11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.zeromq</groupId>
<artifactId>jeromq</artifactId>
<version>0.5.2</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -0,0 +1,53 @@
package org.eddn.examples;
import java.util.zip.Inflater;
import org.zeromq.SocketType;
import org.zeromq.ZMQ;
import org.zeromq.ZContext;
public class SimpleJavaEDDNSubscribe {
private static final int MAX_MESSAGE_SIZE_KB = 200;
private static final String EDDN_SERVER = "tcp://eddn.edcd.io:9500";
private static ZContext context;
public static void main(String[] args) throws Exception {
context = new ZContext();
String jsonMessage = getOneMessage();
System.out.println(jsonMessage);
context.close();
}
private static String getOneMessage() throws Exception {
byte[] deflatedMessage = receiveOneDeflatedMessage();
return inflateMessage(deflatedMessage);
}
private static byte[] receiveOneDeflatedMessage() {
ZMQ.Socket socket = getEDDNSubscriptionSocket();
byte[] deflatedMessage = socket.recv();
return deflatedMessage;
}
private static ZMQ.Socket getEDDNSubscriptionSocket() {
ZMQ.Socket socket = context.createSocket(SocketType.SUB);
socket.connect(EDDN_SERVER);
// need to subscribe to the empty topic to receive anything
socket.subscribe("");
return socket;
}
public static String inflateMessage(byte[] bytes) throws Exception {
Inflater decompresser = new Inflater();
decompresser.setInput(bytes);
byte[] result = new byte[MAX_MESSAGE_SIZE_KB * 1024];
int resultLength = decompresser.inflate(result);
decompresser.end();
// Decode the bytes into a String
String outputString = new String(result, 0, resultLength, "UTF-8");
return outputString;
}
}

View File

@ -0,0 +1,39 @@
# EDDN FSSAllBodiesFound Schema
## Introduction
Here we document how to take data from an ED `FSSBodySignals` Journal
Event and properly structure it for sending to EDDN.
Please consult [EDDN Schemas README](./README-EDDN-schemas.md) for general
documentation for a schema such as this.
If you find any discrepancies between what this document says and what is
defined in the relevant Schema file, then you should, in the first instance,
assume that it is the Schema file that is correct.
**PLEASE open
[an issue on GitHub](https://github.com/EDCD/EDDN/issues/new/choose)
to report any such anomalies you find so that we can check and resolve the
discrepancy.**
## Senders
The primary data source for this schema is the ED Journal event
`FSSBodySignals`.
### Augmentations
#### horizons and odyssey flags
Please read [horizons and odyssey flags](../docs/Developers.md#horizons-and-odyssey-flags)
in the Developers' documentation.
#### StarPos
You MUST add a `StarPos` array containing the system co-ordinates from the
last `FSDJump`, `CarrierJump`, or `Location` event.
#### Remove _Localised key/values
All keys whose name ends with `_Localised`, i.e. the `Type_Localised`
key/values in Signals.
#### Examples:
```json
{ "timestamp":"2022-05-18T00:10:57Z", "event":"FSSBodySignals", "BodyName":"Phoi Auwsy ZY-Z d132 7 a", "BodyID":37, "SystemAddress":4546986398603, "Signals":[ { "Type":"$SAA_SignalType_Geological;", "Type_Localised":"Geological", "Count":2 } ] }
```

View File

@ -0,0 +1,92 @@
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"id" : "https://eddn.edcd.io/schemas/fssbodysignals/1#",
"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",
"description" : "Contains all properties from the listed events in the client's journal, minus the Localised strings and the properties marked below as 'disallowed'",
"additionalProperties" : false,
"required" : [ "timestamp", "event", "SystemName", "StarPos", "SystemAddress", "BodyID", "Signals" ],
"properties" : {
"timestamp": {
"type" : "string",
"format" : "date-time"
},
"event" : {
"enum" : [ "FSSBodySignals" ]
},
"horizons": {
"type" : "boolean",
"description" : "Whether the sending Cmdr has a Horizons pass."
},
"odyssey": {
"type" : "boolean",
"description" : "Whether the sending Cmdr has an Odyssey expansion."
},
"SystemName": {
"type" : "string",
"minLength" : 1
},
"StarPos": {
"type" : "array",
"items" : { "type": "number" },
"minItems" : 3,
"maxItems" : 3,
"description" : "Must be added by the sender if not present in the journal event"
},
"SystemAddress": {
"type" : "integer"
},
"BodyID" : {
"type" : "integer"
},
"Signals": {
"type" : "array",
"items" : {
"type" : "object",
"additionalProperties" : false,
"required" : [ "Type", "Count" ],
"properties" : {
"Type" : {
"type" : "string"
},
"Count" : {
"type" : "integer"
}
}
}
}
}
}
},
"definitions": {
"disallowed" : { "not" : { "type": [ "array", "boolean", "integer", "number", "null", "object", "string" ] } }
}
}

View File

@ -62,20 +62,45 @@ def process_file(input_file: str) -> None:
# print(matches.group('sender_ip'))
# print('')
software_version = semantic_version.Version.coerce(matches.group('software_version'))
try:
software_version = semantic_version.Version.coerce(matches.group('software_version'))
except ValueError as e:
print(f"Error parsing sofwareVersion for:\n{matches.group('software_version')}\n{line}\n")
next
###################################################################
# Issues we know about and HAVE already alerted their
# developers to.
###################################################################
if matches.group('software_name') == 'EDDiscovery':
# https://github.com/EDDiscovery/EDDiscovery/releases/latest
if software_version >= semantic_version.Version.coerce('12.1.7.0'):
if software_version >= semantic_version.Version.coerce('15.0.0.0'):
if matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/approachsettlement/1':
if matches.group('err_msg') == 'Failed Validation "[<ValidationError: "\'Latitude\' is a required property">]"':
# <https://github.com/EDDiscovery/EDDiscovery/issues/3236>
pass
elif matches.group('err_msg') == 'Failed Validation "[<ValidationError: "Additional properties are not allowed (\'Name_Localised\' was unexpected)">]"':
# <https://github.com/EDDiscovery/EDDiscovery/issues/3237>
pass
else:
print(line)
else:
print(line)
elif software_version >= semantic_version.Version.coerce('12.1.7.0'):
if matches.group('schema_ref') in (
'https://eddn.edcd.io/schemas/shipyard/2',
'https://eddn.edcd.io/schemas/outfitting/2',
):
# Reported via Discord PM to Robby 2022-01-07
if matches.group('err_msg') != 'Failed Validation "[<ValidationError: \'[] is too short\'>]"':
if matches.group('err_msg') == 'Failed Validation "[<ValidationError: \'[] is too short\'>]"':
pass
else:
print(line)
else:
@ -103,7 +128,6 @@ def process_file(input_file: str) -> None:
else:
print(line)
else:
print(line)
@ -114,10 +138,13 @@ def process_file(input_file: str) -> None:
elif matches.group('software_name').startswith('E:D Market Connector'):
# https://github.com/EDCD/EDMarketConnector/releases/latest
if software_version >= semantic_version.Version.coerce('5.2.4'):
if software_version >= semantic_version.Version.coerce('5.3.0'):
if matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/codexentry/1':
# <https://github.com/EDCD/EDMarketConnector/issues/1393>
if matches.group('err_msg') != 'Failed Validation "[<ValidationError: "\'\' is too short">]"':
if matches.group('err_msg') == 'Failed Validation "[<ValidationError: "\'\' is too short">]"':
pass
else:
print(matches.group('err_msg'))
print(line)
@ -142,14 +169,16 @@ def process_file(input_file: str) -> None:
# <https://github.com/EDCD/EDMarketConnector/issues/1403>
pass
elif matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/approachsettlement/1':
if matches.group('err_msg') == 'Failed Validation "[<ValidationError: "\'MarketID\' is a required property">]"':
# <https://github.com/EDCD/EDDN/issues/181>
pass
else:
print(line)
elif matches.group('err_msg') == 'Failed Validation "[<ValidationError: "\'Latitude\' is a required property">]"':
elif matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/approachsettlement/1':
if matches.group('err_msg') == 'Failed Validation "[<ValidationError: "\'Latitude\' is a required property">]"':
# <https://github.com/EDCD/EDMarketConnector/issues/1476>
pass
else:
print(line)
else:
print(line)
@ -158,20 +187,35 @@ def process_file(input_file: str) -> None:
# <https://edcodex.info/?m=tools&entry=212>
if software_version >= semantic_version.Version.coerce('3.7.7888.21039'):
if matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/commodity/3':
if matches.group('err_msg') == 'Failed Validation "[<ValidationError: "Additional properties are not allowed (\'Proportion\', \'Name\' were unexpected)">]"':
# Reported via Frontier forums: <https://forums.frontier.co.uk/threads/elite-g19s-companion-app-with-simulated-space-traffic-control.226782/post-9690204>
if matches.group('err_msg') != 'Failed Validation "[<ValidationError: "Additional properties are not allowed (\'Proportion\', \'Name\' were unexpected)">]"':
print(matches.group('err_msg'))
pass
else:
print(line)
else:
print(line)
elif matches.group('software_name') == 'EDSM':
# It's in-browser, no public source/releases
if software_version >= semantic_version.Version.coerce('1.0.1'):
if software_version >= semantic_version.Version.coerce('1.0.3'):
if matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/journal/1':
if matches.group('journal_event') == 'Scan':
# <https://github.com/EDSM-NET/FrontEnd/issues/466>
if not matches.group('err_msg').startswith(
'Failed Validation "[<ValidationError: "{\'type\': [\'array\', \'boolean\', \'integer\', \'number\', \'null\', \'object\', \'string\']} is not allowed for '
# <https://github.com/EDSM-NET/FrontEnd/issues/472>
if matches.group('err_msg').startswith(
'Failed Validation "[<ValidationError: "None is not of type \'integer\'">]"'
):
pass
elif (
matches.group('err_msg').startswith('Failed Validation "[<ValidationError: "{') and
matches.group('err_msg').endswith('} is not of type \'array\'">]"')
):
# <https://github.com/EDSM-NET/FrontEnd/issues/473>
pass
else:
print(matches.group('err_msg'))
print(line)
@ -205,11 +249,23 @@ def process_file(input_file: str) -> None:
if matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/journal/1':
if matches.group('journal_event') == 'Docked':
# <https://discord.com/channels/164411426939600896/205369618284544000/929102478954340372>
if not matches.group('err_msg').startswith(
if matches.group('err_msg').startswith(
'Failed Validation "[<ValidationError: "{\'type\': [\'array\', \'boolean\', \'integer\', \'number\', \'null\', \'object\', \'string\']} is not allowed for '
):
print(matches.group('err_msg'))
print(line)
pass
print(matches.group('err_msg'))
print(line)
else:
print(line)
elif matches.group('schema_ref') == 'https://eddn.edcd.io/schemas/shipyard/2':
# <https://discord.com/channels/164411426939600896/205369618284544000/955030485791285258>
if matches.group('err_msg').startswith(
'Failed Validation "[<ValidationError: \'[] is too short\'>]"'
):
pass
else:
print(line)

View File

@ -59,25 +59,28 @@ class _Settings(object):
"https://eddn.edcd.io/schemas/journal/1" : "schemas/journal-v1.0.json",
"https://eddn.edcd.io/schemas/journal/1/test" : "schemas/journal-v1.0.json",
"https://eddn.edcd.io/schemas/scanbarycentre/1" : "schemas/scanbarycentre-v1.0.json",
"https://eddn.edcd.io/schemas/scanbarycentre/1/test" : "schemas/scanbarycentre-v1.0.json",
"https://eddn.edcd.io/schemas/scanbarycentre/1" : "schemas/scanbarycentre-v1.0.json",
"https://eddn.edcd.io/schemas/scanbarycentre/1/test" : "schemas/scanbarycentre-v1.0.json",
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1" : "schemas/fssdiscoveryscan-v1.0.json",
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1/test" : "schemas/fssdiscoveryscan-v1.0.json",
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1" : "schemas/fssdiscoveryscan-v1.0.json",
"https://eddn.edcd.io/schemas/fssdiscoveryscan/1/test" : "schemas/fssdiscoveryscan-v1.0.json",
"https://eddn.edcd.io/schemas/codexentry/1" : "schemas/codexentry-v1.0.json",
"https://eddn.edcd.io/schemas/codexentry/1/test" : "schemas/codexentry-v1.0.json",
"https://eddn.edcd.io/schemas/codexentry/1" : "schemas/codexentry-v1.0.json",
"https://eddn.edcd.io/schemas/codexentry/1/test" : "schemas/codexentry-v1.0.json",
"https://eddn.edcd.io/schemas/navbeaconscan/1" : "schemas/navbeaconscan-v1.0.json",
"https://eddn.edcd.io/schemas/navbeaconscan/1/test" : "schemas/navbeaconscan-v1.0.json",
"https://eddn.edcd.io/schemas/navbeaconscan/1" : "schemas/navbeaconscan-v1.0.json",
"https://eddn.edcd.io/schemas/navbeaconscan/1/test" : "schemas/navbeaconscan-v1.0.json",
"https://eddn.edcd.io/schemas/navroute/1" : "schemas/navroute-v1.0.json",
"https://eddn.edcd.io/schemas/navroute/1/test" : "schemas/navroute-v1.0.json",
"https://eddn.edcd.io/schemas/navroute/1" : "schemas/navroute-v1.0.json",
"https://eddn.edcd.io/schemas/navroute/1/test" : "schemas/navroute-v1.0.json",
"https://eddn.edcd.io/schemas/approachsettlement/1" : "schemas/approachsettlement-v1.0.json",
"https://eddn.edcd.io/schemas/approachsettlement/1/test" : "schemas/approachsettlement-v1.0.json",
"https://eddn.edcd.io/schemas/fssallbodiesfound/1" : "schemas/fssallbodiesfound-v1.0.json",
"https://eddn.edcd.io/schemas/fssallbodiesfound/1/test" : "schemas/fssallbodiesfound-v1.0.json",
"https://eddn.edcd.io/schemas/approachsettlement/1" : "schemas/approachsettlement-v1.0.json",
"https://eddn.edcd.io/schemas/approachsettlement/1/test" : "schemas/approachsettlement-v1.0.json",
"https://eddn.edcd.io/schemas/fssallbodiesfound/1" : "schemas/fssallbodiesfound-v1.0.json",
"https://eddn.edcd.io/schemas/fssallbodiesfound/1/test" : "schemas/fssallbodiesfound-v1.0.json",
"https://eddn.edcd.io/schemas/fssbodysignals/1" : "schemas/fssbodysignals-v1.0.json",
"https://eddn.edcd.io/schemas/fssbodysignals/1/test" : "schemas/fssbodysignals-v1.0.json",
}
GATEWAY_OUTDATED_SCHEMAS = [