github.com/vcilabs/webrpc@v0.5.2-0.20201116131534-162e27b1b33b/schema/README.md (about) 1 WebRPC Schema 2 ============= 3 4 WebRPC is a design/schema driven approach to writing backend servers, with fully-generated 5 client libraries. Write your schema, and it will generate strongly-typed bindings between 6 your server and client. The type system is described below. 7 8 Some example webrpc schemas: 9 * from the _examples/, here is a schema in [RIDL](../_examples/golang-basics/example.ridl) or 10 in [JSON](../_examples/golang-basics/example.webrpc.json) 11 * ..find more in ./_examples 12 13 14 ## Type system 15 16 ### Basics 17 18 - `byte` (aka uint8) 19 - `bool` 20 - `any` 21 - `null` 22 23 24 ### Integers 25 26 - `uint8` 27 - `uint16` 28 - `uint32` 29 - `uint64` 30 31 - `int8` 32 - `int16` 33 - `int32` 34 - `int64` 35 36 37 ### Floats 38 39 - `float32` 40 - `float64` 41 42 43 ### Strings 44 45 - `string` 46 47 48 ### Timestamps (date/time) 49 50 - `timestamp` - for date/time 51 52 53 ### Lists 54 55 - form: `[]<type>` 56 - ie. 57 * `[]string` 58 * `[]uint8` 59 * `[][]string` 60 * .. 61 62 63 ### Map 64 65 - form: `map<key,value>` 66 - ie. 67 * `map<string,any>` 68 * `map<string,map<string,any>>` 69 * `map<string,[]uint8>` 70 * `map<int64,[]string>` 71 * `map<string,User>` - where `User` is a struct type defined in schema 72 73 74 ### Enums 75 76 - enum, see examples 77 78 79 ### Binary (future / v2) 80 81 - `blob` aka.. `[]byte` 82 * TODO: https://github.com/PsychoLlama/bin-json might have some ideas for us 83 84 85 ### Structs aka Objects / Messages 86 87 - struct or object 88 * think of it just as a Javascript object or JSON object 89 90 91 #### Some notes on structs 92 93 - fields of an object can be `optional` 94 - fields of an object are by default required, unless made optional 95 - fields of an object always return default values by default, ie. default of int is 0, string is "", etc. (like in Go) 96 - otherwise someone should make it optional which will have it be nullable 97