Use the json.Decoder with DisallowUnknownFields first and if that fails, try json.Unmarshal - if 2nd unmarshal succeeds, trigger an event or send a response back to the user while queuing the unmarshaled message.
Can you do this yourself and submit a Pull Request?
Summary
AS should notify the users about ineffective fields in queued application downlink
Why do we need this?
In order to avoid issues like https://github.com/TheThingsNetwork/lorawan-stack/issues/1757, where typos/mistakes in JSON cause unexpected behavior for users
What is already there? What do you see now?
Ineffective fields in application downlink JSON are silently ignored and downlink is scheduled
What is missing? What do you want to see?
Ineffective fields in application downlink JSON should be communicated to the user in some way, for example, by triggering an event. See https://github.com/TheThingsNetwork/lorawan-stack/issues/1757#issuecomment-567961412 as well.
How do you propose to implement this?
Use the
json.Decoder
withDisallowUnknownFields
first and if that fails, tryjson.Unmarshal
- if 2nd unmarshal succeeds, trigger an event or send a response back to the user while queuing the unmarshaled message.Can you do this yourself and submit a Pull Request?
yes