-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON Validation #1
Comments
1e1aaf8 currently implements an overhaul of the definition and validation system. There are still some huge caveats, primarily performance due to usage of Additionally, capturing the exact format of float values, e.g., the amount of decimal points, in the original JSON is also not possible with this system. Though it does not seem to be throwing too many errors and many floats can be left as strings in the definitions, though this is not ideal. |
Current implementation is failing to handle JSON arrays with mixed types in them such as in
|
While we can validate that all keys and values in the JSON data we receive have a representation in our struct definitions, there's no way to ascertain if there is a field in our struct that is not longer being sent in the corresponding JSON data for a certain packet. This could lead to definition bloat over time but I don't see any way of concretely determining if a field is no longer being used unless the client is reversed. |
|
The JSON data that the servers send us is an absolute nightmare. Thankfully, the client seems to send sanely formatted JSON.
These are the known quirks of the server sent JSON:
"123"
, empty string, e.g.,""
, if the value is effectivelynil
, or as a JSON number, e.g.,123
."1.23"
, empty string, e.g.,""
, if the value is effectivelynil
, or as a JSON number, e.g.,1.23
.""
, ornull
.nil
, it may be represented as an empty JSON array[]
.The current solution to this problem is to use custom types in the packet definitions to facilitate the marshaling and unmarshaling of JSON data, which is far from ideal.
My current idea to remove the custom types from the packet definitions themselves and at runtime, create a dynamic struct based on the static packet definition but with the custom types in them and marshal the data into that.
The text was updated successfully, but these errors were encountered: