TheThingsNetwork / lorawan-stack

The Things Stack, an Open Source LoRaWAN Network Server
https://www.thethingsindustries.com/stack/
Apache License 2.0
989 stars 310 forks source link

Normalized message pre processor not using the json schema #7382

Open peter-quandify opened 5 days ago

peter-quandify commented 5 days ago

Summary

The json schema for the normalized uplink is located in the device-library. It is currently expanding but the message preprocessor is located in the lorawan-stack and does not use the schema supplied in the device-library for validation. Instead it uses a custom go code to validate.

This causes the validators to be out of sync and currently the stack validator is missing quite a few fields.

If only validation is needed in this function, then a library like this could do the trick https://github.com/kaptinlin/jsonschema

Steps to Reproduce

  1. Add a device with a normalized uplink decoder that has the battery or metering field
  2. Check the log output on decoding to see that it fails

Current Result

Generates an error for each field it does not recognize

Expected Result

Should accept everything that the device-library schema accepts

Relevant Logs

No response

URL

No response

Deployment

The Things Stack Community Edition

The Things Stack Version

No response

Client Name and Version

No response

Other Information

No response

Proposed Fix

No response

Contributing

Validation

Code of Conduct

johanstokking commented 1 day ago

@peter-quandify thanks for reporting, we're fixing this.