Wolfgang Bumiller
4916d5b10d
api-macro: support optional return values
...
The return specification can now include an `optional`
field.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-12-22 07:02:47 +01:00
Wolfgang Bumiller
05749ab419
test fixups
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-10-29 14:51:22 +01:00
Dietmar Maurer
bd4b4bdc15
proxmox/src/api/rpc_environment.rs: use Value to store metadata
...
And impl. Index and IndexMut to make it easy to access/set the metadata.
2020-05-18 09:38:00 +02:00
Wolfgang Bumiller
5dd21ee89b
switch from failure to anyhow
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-17 18:34:21 +02:00
Wolfgang Bumiller
5ae320f577
api-macro: add test for access w/o a description
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-16 09:26:24 +02:00
Dietmar Maurer
076501e17e
proxmox-api-macro/tests/api1.rs: fix test case
2020-04-16 08:42:05 +02:00
Wolfgang Bumiller
973e7ccef0
rename some permission/access items
...
router.permissions(...) -> router.access(...)
to be more consistent with the other builder methods and
struct member names
ApiAccessPermissions -> ApiAccess
shorter, not necessarily with defined permissions, and
gets rid of a singular/plural confusion
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-15 09:19:25 +02:00
Wolfgang Bumiller
510d410b7a
api-macro: support 'access' specification for methods
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-04-14 14:28:12 +02:00
Wolfgang Bumiller
943bc4de52
api-macro: more tests
...
Note that this one tests the fact that we do not do output
schema validation!
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-08 10:58:27 +01:00
Wolfgang Bumiller
58158b495e
api-macro: more invocation tests for api methods
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-08 10:56:45 +01:00
Wolfgang Bumiller
679ad01c03
api-macro: add expanded data to tests for verification
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-08 10:51:00 +01:00
Wolfgang Bumiller
7fd69f8b12
api-macro: test optional value invocation
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-02 11:12:36 +01:00
Wolfgang Bumiller
263b943287
api-macro: allow skipping input
schema
...
when there are no parameters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-02 11:00:04 +01:00
Wolfgang Bumiller
bead1e6b13
api-macro: add test with no parameters
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-02 10:55:28 +01:00
Wolfgang Bumiller
a997502ab1
api-macro: make return schema optional
...
and support returning () from methods
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-02 10:43:10 +01:00
Wolfgang Bumiller
2fc2df9a78
api-macro: tests: remove #![allow(dead_code)]
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-28 09:29:45 +01:00
Wolfgang Bumiller
993eb7d168
api-macro: update tests, cleanup some macro generated paths
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 14:46:20 +01:00
Wolfgang Bumiller
881df81976
api-macro: start actually extracting parameters
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 14:00:41 +01:00
Wolfgang Bumiller
d02a8f4e42
api-macro: begin and explain the parameter mapping strategy
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 12:29:50 +01:00
Wolfgang Bumiller
ebda5a3c5c
api-macro: parse properties as attributes to #[api]
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 11:01:40 +01:00
Wolfgang Bumiller
044af76286
api-macro: test: add 'protected' attribute
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-27 10:06:15 +01:00
Wolfgang Bumiller
366b50dee7
api-macro: understand a 'Returns:' section in function doc comments
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 13:39:20 +01:00
Wolfgang Bumiller
7f7a9fe92f
api-macro: make type optional in some cases
...
Objects and arrays are now optionally identified by their
'properties' or 'items' property if their 'type' is left
out.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 13:27:54 +01:00
Wolfgang Bumiller
5a2fe67cd8
api-macro: rename elements to properties
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 12:16:05 +01:00
Wolfgang Bumiller
a646146f75
replace builder-pattern api macro parser with json
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-26 12:12:49 +01:00
Wolfgang Bumiller
5721d21a5e
import a first draft of api macros
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-11-22 15:23:24 +01:00