-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app: Make app_object schema future proof
Extended the schema by adding 'any' type members so that the schema is future proof and the app can respond to any new additional fields that may be populated by the cloud side Signed-off-by: Balaji Srinivasan <[email protected]>
- Loading branch information
1 parent
0d21a0e
commit 0665ea4
Showing
1 changed file
with
20 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,53 @@ | ||
; Define the basic structure of the JSON object | ||
|
||
; The 'any' type is used in this schema to allow forward compatibility. | ||
; They are inserted into maps that may contain additional fields in the future. | ||
; This prevents cbor decoding from failing in the field when the cloud side has new fields. | ||
app-object = { | ||
? "nrfcloud_mqtt_topic_prefix": tstr, | ||
? "pairing": pairing-type, | ||
"lwm2m": lwm2m-map | ||
"lwm2m": lwm2m-map, | ||
* tstr => any | ||
} | ||
|
||
; Define the pairing object with nested topics | ||
pairing-type = { | ||
"state": tstr, | ||
"topics": { | ||
"d2c": tstr, | ||
"c2d": tstr | ||
} | ||
"c2d": tstr, | ||
* tstr => any | ||
}, | ||
* any => any | ||
} | ||
|
||
lwm2m-map = { | ||
? "14240:1.0": led, | ||
? "14301:1.0": config | ||
? "14301:1.0": config, | ||
* tstr => any | ||
} | ||
|
||
led = { | ||
"0": led_inner_object | ||
"0": led_inner_object, | ||
* tstr => any | ||
} | ||
|
||
led_inner_object = { | ||
"0": int .size 4, | ||
"1": int .size 4, | ||
"2": int .size 4, | ||
"99": int .size 8 | ||
"99": int .size 8, | ||
* tstr => any | ||
} | ||
|
||
config = { | ||
"0": config_inner_object | ||
"0": config_inner_object, | ||
* tstr => any | ||
} | ||
|
||
config_inner_object = { | ||
"0": int .size 8, | ||
"1": bool, | ||
"99": int .size 8 | ||
"99": int .size 8, | ||
* tstr => any | ||
} |