Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
name: Test ${{ matrix.toolchain }} on ${{ matrix.os }} (${{ matrix.features }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
name: Test ${{ matrix.toolchain }} on ${{ matrix.os }} (${{ matrix.features }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
Expand All @@ -19,7 +19,7 @@ jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
name: Test ${{ matrix.toolchain }} on ${{ matrix.os }} (${{ matrix.features }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
name: Test ${{ matrix.toolchain }} on ${{ matrix.os }} (${{ matrix.features }})
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
Expand Down
4 changes: 2 additions & 2 deletions validators-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ proc-macro2 = "1"

enum-ordinalize = { version = "4.2", default-features = false, features = ["derive"] }

educe = { version = "0.5", default-features = false, features = ["Debug"], optional = true }
educe = { version = "0.6", default-features = false, features = ["Debug"], optional = true }
phonenumber = { version = "0.3", optional = true }
regex = { version = "1", optional = true }

Expand Down Expand Up @@ -68,4 +68,4 @@ rocket = []

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
7 changes: 2 additions & 5 deletions validators-derive/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,14 @@ pub(crate) fn unsupported_validator(name: &Path) -> syn::Error {
match name.get_ident() {
Some(name) => syn::Error::new(
span,
format!("unsupported validator `{name}`, available validators:{}", DisplayValidators),
format!("unsupported validator `{name}`, available validators:{DisplayValidators}"),
),
None => {
let name = path_to_string(name);

syn::Error::new(
span,
format!(
"unsupported validator `{name}`, available validators:{}",
DisplayValidators
),
format!("unsupported validator `{name}`, available validators:{DisplayValidators}"),
)
},
}
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/base32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct Base32Handler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::String);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
pub(crate) struct Base32DecodedHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::VecU8);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/base64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct Base64Handler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::String);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
pub(crate) struct Base64DecodedHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::VecU8);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/base64_url/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct Base64UrlHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::String);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{
pub(crate) struct Base64UrlDecodedHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::VecU8);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/bit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
pub(crate) struct BitHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::Bit);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/boolean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct BooleanHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::Boolean);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/byte/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
pub(crate) struct ByteHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::Bit);
Expand Down
8 changes: 8 additions & 0 deletions validators-derive/src/validator_handlers/domain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,28 @@ use crate::{
pub(crate) struct DomainHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowLocal {
domain: TypeEnum,
is_local: TypeEnum,
}

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowPort {
domain: TypeEnum,
port: TypeEnum,
}

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowPortAllowLocal {
domain: TypeEnum,
is_local: TypeEnum,
Expand All @@ -40,13 +44,15 @@ pub struct StructAllowPortAllowLocal {

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowIPv4 {
domain: TypeEnum,
is_ipv4: TypeEnum,
}

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowIPv4AllowLocal {
domain: TypeEnum,
is_ipv4: TypeEnum,
Expand All @@ -55,6 +61,7 @@ pub struct StructAllowIPv4AllowLocal {

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowIPv4AllowPort {
domain: TypeEnum,
is_ipv4: TypeEnum,
Expand All @@ -63,6 +70,7 @@ pub struct StructAllowIPv4AllowPort {

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowIPv4AllowPortAllowLocal {
domain: TypeEnum,
is_ipv4: TypeEnum,
Expand Down
4 changes: 4 additions & 0 deletions validators-derive/src/validator_handlers/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,28 @@ use crate::{
pub(crate) struct HostHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowLocal {
host: TypeEnum,
is_local: TypeEnum,
}

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowPort {
host: TypeEnum,
port: TypeEnum,
}

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowPortAllowLocal {
host: TypeEnum,
is_local: TypeEnum,
Expand Down
2 changes: 2 additions & 0 deletions validators-derive/src/validator_handlers/ip/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ use crate::{
pub(crate) struct IpHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowPort {
ip: TypeEnum,
port: TypeEnum,
Expand Down
2 changes: 2 additions & 0 deletions validators-derive/src/validator_handlers/ipv4/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ use crate::{
pub(crate) struct Ipv4Handler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowPort {
ipv4: TypeEnum,
port: TypeEnum,
Expand Down
2 changes: 2 additions & 0 deletions validators-derive/src/validator_handlers/ipv6/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ use crate::{
pub(crate) struct Ipv6Handler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

#[derive(Educe)]
#[educe(Debug(name = "Struct"))]
#[allow(dead_code)] // Used for parsing
pub struct StructAllowPort {
ipv6: TypeEnum,
port: TypeEnum,
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/json/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct JsonHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::Serde);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/length/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{common::type_enum::TypeEnum, panic};
pub(crate) struct LengthHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::CollectionLength);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/line/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct LineHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::String);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
pub(crate) struct MacAddressHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::U64);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/number/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
pub(crate) struct NumberHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::Number);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/phone/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::{common::type_enum::TypeEnum, panic};
pub(crate) struct PhoneHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::String);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/regex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{common::type_enum::TypeEnum, panic};
pub(crate) struct RegexHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::String);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl RegexAttribute {
rocket_options,
})
} else {
return Err(syn::Error::new(meta.path().span(), "the `regex` parameter is not set"));
Err(syn::Error::new(meta.path().span(), "the `regex` parameter is not set"))
}
}
}
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/semver/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct SemverHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::Version);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/semver_req/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct SemverReqHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::VersionReq);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
pub(crate) struct SignedIntegerHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::SignedInteger);
Expand Down
1 change: 1 addition & 0 deletions validators-derive/src/validator_handlers/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
pub(crate) struct TextHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::String);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::{
pub(crate) struct UnsignedIntegerHandler;

#[derive(Debug)]
#[allow(dead_code)] // Used for parsing
pub struct Struct(TypeEnum);

const ITEM: Struct = Struct(TypeEnum::SignedInteger);
Expand Down
Loading