mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-01-30 23:53:54 +00:00
api: Ignore unknown fields (Rust JSON decode).
The JSON encoding should only be used for debugging purposes! However this change avoids showing errors in case there are unknown fields in the JSON payload. This would happen when for example the MQTT Forwarder and ChirpStack uses a different API version (which in case of Protobuf would be fine, as long as the major version remains the same).
This commit is contained in:
parent
d9a2eeba3c
commit
c82bfa5a72
5
api/rust/build.rs
vendored
5
api/rust/build.rs
vendored
@ -41,6 +41,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let descriptor_set = std::fs::read(out_dir.join("common").join("proto_descriptor.bin"))?;
|
||||
pbjson_build::Builder::new()
|
||||
.register_descriptors(&descriptor_set)?
|
||||
.ignore_unknown_fields()
|
||||
.out_dir(out_dir.join("common"))
|
||||
.build(&[".common"])?;
|
||||
}
|
||||
@ -65,6 +66,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let descriptor_set = std::fs::read(out_dir.join("gw").join("proto_descriptor.bin"))?;
|
||||
pbjson_build::Builder::new()
|
||||
.register_descriptors(&descriptor_set)?
|
||||
.ignore_unknown_fields()
|
||||
.out_dir(out_dir.join("gw"))
|
||||
.extern_path(".common", "crate::common")
|
||||
.build(&[".gw"])?;
|
||||
@ -94,6 +96,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let descriptor_set = std::fs::read(out_dir.join("internal").join("proto_descriptor.bin"))?;
|
||||
pbjson_build::Builder::new()
|
||||
.register_descriptors(&descriptor_set)?
|
||||
.ignore_unknown_fields()
|
||||
.out_dir(out_dir.join("internal"))
|
||||
.extern_path(".common", "crate::common")
|
||||
.build(&[".internal"])?;
|
||||
@ -126,6 +129,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
pbjson_build::Builder::new()
|
||||
.emit_fields()
|
||||
.register_descriptors(&descriptor_set)?
|
||||
.ignore_unknown_fields()
|
||||
.out_dir(out_dir.join("integration"))
|
||||
.extern_path(".common", "crate::common")
|
||||
.extern_path(".gw", "crate::gw")
|
||||
@ -149,6 +153,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let descriptor_set = std::fs::read(out_dir.join("meta").join("proto_descriptor.bin"))?;
|
||||
pbjson_build::Builder::new()
|
||||
.register_descriptors(&descriptor_set)?
|
||||
.ignore_unknown_fields()
|
||||
.out_dir(out_dir.join("meta"))
|
||||
.extern_path(".common", "crate::common")
|
||||
.extern_path(".gw", "crate::gw")
|
||||
|
Loading…
x
Reference in New Issue
Block a user