Commit Graph

10 Commits

Author SHA1 Message Date
Wolfgang Bumiller
cc065c175d api-macro: introduce updaters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-03 10:54:18 +01:00
Wolfgang Bumiller
34651099d1 api-macro: support flattened parameters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-12-22 07:21:43 +01:00
Wolfgang Bumiller
75530cb68c api-macro: object schema entry tuple -> struct
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-12-22 07:20:48 +01:00
Wolfgang Bumiller
9d9231313d api-macro: suport AllOf on structs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-12-22 07:19:40 +01:00
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
273ce60242 api-macro: forbid description on incompatible schemas
References to external schemas (or types) already include
the description in the external schema and therefore are
illegal.

The implementation consists of multiple parts:

* Introduce a `Maybe` type which can be `Explicit`,
  `Derived` or `None`.
* Forbid `Explicit` descriptions on references.
* Instead of bailing out on such errors which causes all of
  the generated code to vanish and create heaps of
  additional nonsensical errors, add a way to *add* errors
  without bailing out immediately via the `error!()` macro.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-12-07 15:09:45 +01:00
Wolfgang Bumiller
ef5c719150 formatting fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-10-02 09:59:52 +02:00
Dominik Csapak
3458d3fa69 api-macro: replace ident hashmap with simple find
after benchmarking (again), i found that doing a simple find instead
of saving the inidices for the ident strings in a hashmap has
no real performance impact (the max list size for the properties
are max ~25 at the moment, so this should not be impacting compile
times much) but it is much simpler

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-09-19 06:28:36 +02:00
Dominik Csapak
29763449f0 api-macro: fix broken binary ident search
the 'properties_' list is sorted by the the literal string of a
fieldname, but we binary-search for the 'ident_str' (which may be
different, since we map '-' to '_' for example)

by creating a hashmap to map from ident to index, we can do a simple
lookup in that case that will work

benchmarks showed no measurable performance difference

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-09-17 08:20:44 +02:00
Wolfgang Bumiller
f165dee496 switch to using mod.rs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-07-28 15:11:38 +02:00