Commit Graph

117 Commits

Author SHA1 Message Date
Thomas Lamprecht
f4868ff519 tree-wide: check in d/control meta changes for newer debcargo
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-11-26 14:44:33 +01:00
Thomas Lamprecht
1c4467841d schema: property description: output indentation where its required
The wrap_text helper accepts and initial indentation, so use that as
central point to add the indentation that glues the list entry
together with its description.

Mostly a small optimization, should not matter in practice, i.e. where
all properties should have a description.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-22 14:51:19 +02:00
Thomas Lamprecht
21c314b56e schema: property description: switch format strings to inline template variables
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-10-18 17:37:30 +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
61e4d35dea schema: bump to 3.2.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-09-05 14:15:11 +02:00
Wolfgang Bumiller
d72ea40c80 schema: bump to 3.1.4-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-28 14:51:23 +02:00
Wolfgang Bumiller
5704cb43b9 schema: add Schema::unwrap_any_object_schema
so we have a version we can use in const fns and const{} expressions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-28 14:50:21 +02:00
Wolfgang Bumiller
00ca04698d schema: seal ObjectSchemaType and assert Send + Sync
While this is technically a breaking API change since the trait is
public, we don't implement it anywhere and it isn't meant to be
implemented from the outside.

Also, encode that these types are all Send + Sync via a super trait
notation.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-28 14:43:42 +02:00
Wolfgang Bumiller
e750bce69b schema: make Schema::any_object a const fn
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-28 14:32:39 +02:00
Wolfgang Bumiller
d166dcff0a schema: rustfmt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-28 14:32:21 +02:00
Wolfgang Bumiller
3fabb14d62 schema: bump to 3.1.3-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-08-14 11:06:44 +02:00
Maximiliano Sandoval
ab3f4a2fc4 schema: remove lazy_static dependency
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-08-14 10:33:42 +02:00
Maximiliano Sandoval
fe7f37e9b3 property_string: clippy: define bound once
Fixes the clippy lint:

warning: bound is defined in more than one place
   --> proxmox-schema/src/property_string.rs:352:14
    |
352 | pub fn parse<T: ApiType>(value: &str) -> Result<T, Error>
    |              ^
353 | where
354 |     T: for<'de> Deserialize<'de>,
    |     ^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#multiple_bound_locations
    = note: `#[warn(clippy::multiple_bound_locations)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-08-07 20:58:04 +02:00
Wolfgang Bumiller
65715bc096 io, serde, schema: doc fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-30 16:16:16 +02:00
Maximiliano Sandoval
c8b975799b fix typos in strings
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-22 08:49:42 +02:00
Maximiliano Sandoval
c88cdd7e67 fix typos in variable and function names
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
3dc013bb57 schema: bump to 3.1.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 14:18:04 +02:00
Wolfgang Bumiller
69c2f94aab schema: drop extra newline in proeprty description
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
f02ce77ad6 schema: make wrap_text less awkward
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
dc7273e888 schema: drop trailing double-newlines in wrap_text
This is completely wrong and make working with it extremely annoying.
Whether or not there should be separation should be decided where
multiple elements are connected, they shouldn't automatically come
with a bunch of trailing new lines for absolutely no reason.

Places using this will need to be fixed as they get noticed.

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
Dietmar Maurer
49b97b6a5f bump proxmox-schema to 3.1.1-1
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-05-16 09:35:50 +02:00
Dietmar Maurer
31b7b070b5 schema: api-types: add ip/cidr api schemas
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-05-16 09:09:37 +02:00
Wolfgang Bumiller
d653ac343b bump proxmox-schema to 3.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-19 11:08:28 +01:00
Dietmar Maurer
1ac8b7f652 proxmox-schema: moved common api types from pbs-api-types
We want to use those types in all of our products.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-03-18 10:19:52 +01:00
Dietmar Maurer
d74fa06253 proxmox-schema: add IP address regex/api-types
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-03-18 10:19:50 +01:00
Dietmar Maurer
0c5e2640d0 proxmox-schema: use const_format to define static strings.
Macro rules are not hygienic, and current rust macro visibility rules
are a nightmare. Using const_format::concatcp!() is a much cleaner
solution.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-03-18 10:19:46 +01:00
Wolfgang Bumiller
05ff6b545a bump proxmox-schema to 3.0.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-21 12:28:02 +01:00
Wolfgang Bumiller
49b2bdf9c6 schema: drop periods after errors
lower case start + period = wrong

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-21 12:05:44 +01:00
Wolfgang Bumiller
9c40144214 schema: add regression tests for additional_properties in AllOf
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-21 12:02:00 +01:00
Wolfgang Bumiller
bae2cf75de schema: AllOf/OneOf: actually perform additional_properties() check
rather than just always allowing additional properties, only return
true if any of the available schemas allows it

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-21 11:43:20 +01:00
Wolfgang Bumiller
245524d0d8 bump proxmox-schema to 3.0.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 13:53:12 +01:00
Wolfgang Bumiller
5df9da2af4 schema: implement split_list iterator
and reuse splitting code in no_schema's SeqAccess as well

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-02-02 12:06:46 +01:00
Wolfgang Bumiller
d48a150835 schema: implement oneOf schema support
A 'oneOf' schema is basically exactly what a rust `enum` is.
Exactly one of the possible values must match the data.

This should ultimately be the base to allow using the
`#[api]` macro on a newtype style enum as well as using this
schema as a configuration for our section config parser.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>
2024-02-02 12:06:28 +01:00
Wolfgang Bumiller
74c3943a89 bump schema to 2.0.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-11-23 09:16:46 +01:00
Dietmar Maurer
578f994e6b proxmox-schema: derive PartialEq for UPID (for GUI)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2023-11-20 11:10:22 +01:00
Gabriel Goller
c1c062bf56 schema: beautify parameter error output
If there is only one error, output in a single line, without any
excessive newlines at the end. If there are multiple errors, show them
in a bulleted list.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2023-10-23 17:40:34 +02:00
Thomas Lamprecht
dc9ee73751 schema: bump version to 2.0.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-09-20 11:46:02 +02:00
Hannes Laimer
92be86d776 schema: serialize enum unit variants
... since deserializing them already works

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
2023-09-07 17:29:36 +02:00
Lukas Wagner
a36769b11a clippy fix: complex type definitions
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:29:36 +02:00
Lukas Wagner
3c7c9fc55d clippy fix: the following explicit lifetimes could be elided
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:29:36 +02:00
Lukas Wagner
6c38a997af clippy fix: useless use of format!
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:29:36 +02:00
Lukas Wagner
58b29dfbcf clippy fix: warning: this let-binding has unit value
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:29:36 +02:00
Lukas Wagner
6f9cc14b9e clippy fix: redundant closure
See:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:29:36 +02:00
Lukas Wagner
81ca4ae6a1 clippy fix: needless borrow
See:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:29:36 +02:00
Lukas Wagner
de6337ae6d clippy fix: the borrowed expression implements the required traits
See: https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-08 11:05:20 +02:00
Wolfgang Bumiller
ac6a52dfd1 bump proxmox-schema to 2.0.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-07-24 10:42:14 +02:00