Commit Graph

347 Commits

Author SHA1 Message Date
Wolfgang Bumiller
d601b57fd0 api-macro: bump to 1.2.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-26 14:52:52 +02:00
Wolfgang Bumiller
2b3c356ece api-macro: allow declaring an additional-properties field
Object schemas can now declare a field which causes
'additional_properties' to be set to true and the field being ignored
in the schema.

This allows adding a flattened HashMap<String, Value> to gather the
additional unspecified properties.

    #[api(additional_properties: "rest")]
    struct Something {
        #[serde(flatten)]
        rest: HashMap<String, Value>,
    }

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-26 12:47:58 +02:00
Wolfgang Bumiller
d6e86d670b tree-wide: unify workspace inherited attributes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-20 08:42:45 +02:00
Wolfgang Bumiller
dfc4e5f866 api-macro: bump to 1.2.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 14:15:11 +02:00
Wolfgang Bumiller
8021f0a7f6 api-macro: support new streaming api methods
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 14:15:11 +02:00
Wolfgang Bumiller
c31eaf0018 router, rest-server, api-macro: rename Streaming api to Serializing
This does not "stream", but rather skips the intermediate step to
serialize the entire output into a local json string.

We now reserve the "Stream*" prefix for actual *streaming*, that is,
producing an API response which gets streamed continuously as it is
asynchronously produced.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 14:15:11 +02:00
Wolfgang Bumiller
c3713cffe5 api-macro: fix warnings in tests
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:23:38 +02:00
Wolfgang Bumiller
15c64a5d00 api-macro: bump to 1.1.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:15:57 +02:00
Wolfgang Bumiller
839f508f55 api-macro: type-key support for derived enums
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:42 +02:00
Wolfgang Bumiller
4d96aa52d2 section-config, api-macro: add SectionConfig enum support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:42 +02:00
Wolfgang Bumiller
51d78fdd2b api-macro: handle renames in updater derive
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-06 14:14:42 +02:00
Maximiliano Sandoval
254a37ae07 fix typos in code documentation
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-22 08:49:42 +02:00
Maximiliano Sandoval
72ab48eb55 fix typos in rust api documentation
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-22 08:49:42 +02:00
Wolfgang Bumiller
4de22b9728 api-macro: fix warnigns
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
0652d81977 tree-wide: enable doc_cfg and doc_auto_cfg for docs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-02 11:59:53 +02:00
Maximiliano Sandoval
d07a0243f4 use const blocks in thread_local! calls
Fixes the clippy warning:

warning: initializer for `thread_local` value can be made `const`
   --> proxmox-router/src/cli/command.rs:221:71
    |
221 |     static HELP_CONTEXT: RefCell<Option<Arc<CommandLineInterface>>> = RefCell::new(None);
    |                                                                       ^^^^^^^^^^^^^^^^^^ help: replace with: `const { RefCell::new(None) }`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const
    = note: `#[warn(clippy::thread_local_initializer_can_be_made_const)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-06-28 10:22:58 +02:00
Fabian Grünbichler
6f532dfb7d various clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-06-06 11:40:49 +02:00
Wolfgang Bumiller
ca6ca904ad bump proxmox-api-macro to 1.0.8-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:56:01 +01:00
Wolfgang Bumiller
1f377da07c bump api-macro to 1.0.7-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 16:02:42 +01:00
Wolfgang Bumiller
2435ab29e2 api-macro: make skip_serializing_if without default an error
except for Option types, since this causes deserialization issues

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 14:39:47 +01:00
Wolfgang Bumiller
89b29415a4 api-macro: add VariantAttrib
separated out of FieldAttrib without the `flatten` attribute, since we
don't support this on enum variants

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 14:39:47 +01:00
Wolfgang Bumiller
fa9a50a0b7 api-macro: rename SerdeAttrib to FieldAttrib
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-12-06 14:39:47 +01:00
Fabian Grünbichler
04e2d0e5c3 bump proxmox-api-macro to 1.0.6-1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-10-03 09:37:01 +02:00
Wolfgang Bumiller
b232b580a0 update to syn 2
This mostly affected attribute parsing (due to the syn::Meta changes).
Also creating `DelimSpan`s for custom-built `syn::Attribute`s is a
bit... ugly.
Upshot: turns out we can drop some helpers in util.rs with the new
`syn::Meta` changes.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-09-29 13:52:21 +02:00
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