jsonMessages: basic schema for JSON APIs

JSON APIs are ubiquitous. This schema allows for reusuable
connectors that translate Preserves to and from JSON endpoints.

This schema contradicts the current JSON schema described in the
Preserves spec because it uses symbols for object keys rather than
strings.
This commit is contained in:
Emery Hemingway 2023-07-26 09:56:24 +01:00
parent d8a139b23a
commit 4a30cb442f
1 changed files with 19 additions and 0 deletions

19
schemas/jsonMessages.prs Normal file
View File

@ -0,0 +1,19 @@
version 1 .
JSON =
/ @string string
/ @integer int
/ @double double
/ @boolean bool
/ @null =null
/ @array [JSON ...]
/ @object { symbol: JSON ...:... } .
; Messages that might be exchanged over a point-to-point medium such as a TCP or UNIX socket.
Message = SendJSON / RecvJSON .
; A message destined for a remote endpoint.
SendJSON = <send @data JSON> .
; A message originating from a remote endpoint.
RecvJSON = <recv @data JSON> .