Don Newton | 276cd1f | 2019-02-06 17:14:03 -0500 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | |
| 3 | package xos; |
| 4 | |
| 5 | import "google/protobuf/empty.proto"; |
| 6 | import "annotations.proto"; |
| 7 | |
| 8 | // This API is used by the UI to validate fields. |
| 9 | |
| 10 | message FieldValidator { |
| 11 | string name = 1; |
| 12 | oneof val_value { |
| 13 | bool bool_value = 2; |
| 14 | int64 int_value = 3; |
| 15 | string str_value = 4; |
| 16 | }; |
| 17 | }; |
| 18 | |
| 19 | message FieldOption { |
| 20 | string id = 1; |
| 21 | string label = 2; |
| 22 | } |
| 23 | |
| 24 | message FieldRelation { |
| 25 | string model = 1; |
| 26 | string type = 2; |
| 27 | string on_field = 3; |
| 28 | }; |
| 29 | |
| 30 | message ModelField { |
| 31 | string name = 1; |
| 32 | string hint = 2; |
| 33 | string type = 3; |
| 34 | FieldRelation relation = 4; |
| 35 | repeated FieldValidator validators = 5; |
| 36 | repeated FieldOption options = 6; |
| 37 | string default = 7; |
| 38 | bool read_only = 8; |
| 39 | }; |
| 40 | |
| 41 | message ModelDef { |
| 42 | string name = 1; |
| 43 | repeated ModelField fields = 2; |
| 44 | repeated FieldRelation relations = 3; |
| 45 | string app = 4; |
| 46 | string verbose_name = 5; |
| 47 | string description = 6; |
| 48 | }; |
| 49 | |
| 50 | message ModelDefs { |
| 51 | repeated ModelDef items = 1; |
| 52 | }; |
| 53 | |
| 54 | service modeldefs { |
| 55 | |
| 56 | rpc ListModelDefs(google.protobuf.Empty) returns (ModelDefs) { |
| 57 | option (googleapi.http) = { |
| 58 | get: "/xosapi/v1/modeldefs" |
| 59 | }; |
| 60 | } |
| 61 | }; |