refactor: Update JSON parsing and schema inflation

- Use `json2.decode[json2.Any]` instead of `json2.raw_decode`
- Add `@[required]` to procedure function signatures
- Improve error handling for missing JSONRPC fields
- Update `encode` to use `prettify: true`
- Add checks for missing schema and content descriptor references
This commit is contained in:
Mahmoud-Emad
2025-10-22 17:44:37 +03:00
parent 37f0aa0e96
commit 0bfb5cfdd0
16 changed files with 783 additions and 1069 deletions

View File

@@ -19,7 +19,7 @@ pub fn decode(data string) !OpenRPC {
mut object := json.decode(OpenRPC, data) or {
return error('Failed to decode json\n=======\n${data}\n===========\n${err}')
}
data_map := json2.raw_decode(data)!.as_map()
data_map := json2.decode[Any](data)!.as_map()
if 'components' in data_map {
object.components = decode_components(data_map) or {
return error('Failed to decode components\n${err}')