Commit Graph

323 Commits

Author SHA1 Message Date
Lukas Wagner
268fcfb43a clippy fix: this (Default) impl can be derived
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:29:36 +02:00
Wolfgang Bumiller
34a79cdd0c bump proxmox-api-macro to 1.0.5-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-03 08:25:13 +02:00
Wolfgang Bumiller
8f8d52f148 update d/copyright files to debian copyright-format 1.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-23 13:02:39 +02:00
Wolfgang Bumiller
12674a37e0 api-macro: support non-idents in serde(rename)
For PVE we'll have enum variants like /dev/urandom...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-04-03 10:01:44 +02:00
Fabian Grünbichler
acaf55c437 clippy fix
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-13 14:56:42 +01:00
Wolfgang Bumiller
7bc85c05c9 bump proxmox-api-macro to 1.0.4-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-12 11:34:18 +01:00
Wolfgang Bumiller
38a60d3acb api: support #[default] attribute
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-12-12 11:34:18 +01:00
Fabian Grünbichler
8316fd3899 more workspace dependencies
regex was missed in the first pass, and two intra-workspace dev-dependencies as
well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-12 09:30:30 +01:00
Fabian Grünbichler
4189221470 inherit shared, external dependencies
noteworthy changes:
- proxmox-http had a default_features_false dep on hyper, which is dropped (the
  default feature is empty anyway)
- hyper, libc, nix, tokio and url versions are unified
- missing (cosmetic) bindgen feature on zstd enabled everywhere

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:38 +01:00
Fabian Grünbichler
64959d9ae0 move common metadata to workspace
and switch all crates to 2021 edition as well as a unified "authors" value.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:25 +01:00
Fabian Grünbichler
5ec765f842 update d/control files
debcargo 2.6 changed some minor details

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-06 11:21:43 +01:00
Thomas Lamprecht
f92c8f92cc api-macro: track d/control
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-08-26 12:57:57 +02:00
Wolfgang Bumiller
31a569b425 api-macro: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-27 10:52:07 +02:00
Wolfgang Bumiller
7b1aad429f api-macro: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-29 10:10:07 +02:00
Wolfgang Bumiller
17805f9791 api-macro: doc update
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-05-23 10:34:57 +02:00
Wolfgang Bumiller
b49f3554c7 bump proxmox-api-macro to 1.0.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-05-19 12:04:03 +02:00
Wolfgang Bumiller
7fe84f8e15 api-macro: allow overriding field attributes in the updater
This allows fixing up things such as `skip_serialize_if`
calls like so:

    #[derive(Updater)]
    struct Foo {
        #[serde(skip_serializing_if = "MyType::is_special")]
        #[updater(serde(skip_serializing_if = "Option::is_none"))]
        field: MyType,
    }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-05-11 16:00:42 +02:00
Wolfgang Bumiller
bcf6abaa0d bump proxmox-api-macro to 1.0.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-04-12 14:27:11 +02:00
Dominik Csapak
ca3b25869c proxmox-api-macro: add 'streaming' option
to generate the `Streaming` variants of the ApiHandler

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-04-12 14:23:05 +02:00
Stefan Sterz
0b90f8d802 api-macro: fix "Forgerty" typo
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2022-02-07 15:38:39 +01:00
Wolfgang Bumiller
d871d6849b api-macro: formatting
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:51:09 +01:00
Wolfgang Bumiller
fc80f519f4 api-macro: add #[updater(type = "...")]
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-30 17:21:20 +01:00
Wolfgang Bumiller
e461be1c9f api-macro: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-30 17:02:25 +01:00
Wolfgang Bumiller
d18292192d bump proxmox-api-macro to 1.0.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-12 14:51:35 +02:00
Wolfgang Bumiller
5988a1adf1 drop automatically_derived attribute for now
new rustc seems to *sometimes* complain about it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-12 14:49:11 +02:00
Wolfgang Bumiller
41f3fdfeb9 add proxmox-schema and proxmox-router crates
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-11 11:39:59 +02:00
Wolfgang Bumiller
cb96de1c4d bump proxmox-api-macro to 0.5.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-30 10:46:05 +02:00
Wolfgang Bumiller
76641b0a72 api-macro: allow external schemas in 'returns' specification
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-26 13:34:23 +02:00
Wolfgang Bumiller
0f2caafc4e bump proxmox to 0.13.0-1 and proxmox-api-macro to 0.5.0
and proxmox-http to 0.4.0... urgh

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-25 09:41:17 +02:00
Wolfgang Bumiller
917ce00dd6 rustfmt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-13 13:31:57 +02:00
Wolfgang Bumiller
744d69c2ab more updater cleanups
* Updatable is now named UpdaterType
* UPDATER_IS_OPTION is now assumed to always be true
    While an updater can be a non-optional struct, being an
    updater, all its fields are also Updaters, so after
    expanding all levels of nesting, the resulting list of
    fields can only contain optional values.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-13 11:11:27 +02:00
Wolfgang Bumiller
cb9d57b453 put API_SCHEMA variable into ApiType trait
This way we can assign `API_SCHEMA` constants to `Option`
types.

Here's why:

The api-macro generated code usese `T::API_SCHEMA` when
building ObjectSchemas.

For Updaters we replace `T` with
  `<T as Updatable>::Updater`

This means for "simple" wrappers like our `Authid` or
`Userid`, the ObjectSchema will try to refer to
  `<Authid as Updatable>::Updater::API_SCHEMA`
which resolves to:
  `Option<Authid>::API_SCHEMA`
which does not exist, for which we cannot add a normal
`impl` block to add the schema variable, since `Option` is
not "ours".

But we now have a blanket implementation of `ApiType` for
`Option<T> where T: ApiType` which just points to the
original `T::API_SCHEMA`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-12 10:15:13 +02:00
Wolfgang Bumiller
783cbcb499 fixup schema entry for updaters with explicit types
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 14:17:20 +02:00
Wolfgang Bumiller
34020ea3d6 change updater derivation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 12:03:29 +02:00
Wolfgang Bumiller
017b81712e api macro: assume that field types are api types by default
#[api]
    struct Foo {
        field: Bar,
    }

does not require the use of
    #[api(
        properties: {
            field: {
                type: Bar,
            },
        },
    )]

anymore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 11:42:24 +02:00
Wolfgang Bumiller
8ebcd68a2c refactor serde parsing for later reuse
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 11:42:24 +02:00
Thomas Lamprecht
c75e706006 proxmox-api-macro: bump version to 0.4.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 17:45:29 +02:00
Dietmar Maurer
5cbddad172 update versions in generated control files 2021-07-20 15:45:45 +02:00
Dietmar Maurer
82d7a1cdbf bump proxmox version to 0.12.0-1 2021-07-20 15:45:45 +02:00
Wolfgang Bumiller
6729d41188 bump api-macro to 0.3.4-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-04-14 12:00:01 +02:00
Wolfgang Bumiller
cde2863a68 api-macro: fix Updatable path in generated derive attribute
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-04-14 11:58:32 +02:00
Wolfgang Bumiller
248335df36 api-macro: fix dev-dep versions
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-03-24 11:20:23 +01:00
Wolfgang Bumiller
1f6a2a66c9 bump api-macro to 0.3.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-24 09:37:30 +01:00
Wolfgang Bumiller
857b8ab2b9 Updater: take serde renames into account
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-24 09:21:52 +01:00
Wolfgang Bumiller
4e375ba95c bump api-macro to 0.3.2-1
This got lost in a rebase...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-11 09:00:44 +01:00
Wolfgang Bumiller
50e9148853 api-macro: pull in 'extra-traits' feature from syn
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-04 13:11:34 +01:00
Wolfgang Bumiller
223d7ed55c api-macro: let tests depend on api-macro
the updater tests require both the trait and the proc macros
to be visible, running tests with `--all-features` prevents
them from being imported from two separate locations as
their names are the same, so let's always include the macro
versions in test cases by depending on the `api-macro`
feature in tests in the api-macro crate

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-03 10:54:18 +01:00
Wolfgang Bumiller
dd767723d8 formatting fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-03 10:54:18 +01:00
Wolfgang Bumiller
034dd3fe5e updaters: docs and exports
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-03 10:54:18 +01:00
Wolfgang Bumiller
cc065c175d api-macro: introduce updaters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-03 10:54:18 +01:00