Compare commits
4 changed files with 6 additions and 19 deletions
|
|
@ -13,6 +13,8 @@ anode = { path = "./anode" }
|
||||||
anode-macros-input = { path = "./anode-macros-input" }
|
anode-macros-input = { path = "./anode-macros-input" }
|
||||||
anode-macros = { path = "./anode-macros" }
|
anode-macros = { path = "./anode-macros" }
|
||||||
anode-build = { path = "./anode-build" }
|
anode-build = { path = "./anode-build" }
|
||||||
|
# git
|
||||||
|
forgejo-openapi = { git = "https://git.dzuchun.ing/dzu/forgejo-openapi.git", default-features = false }
|
||||||
# crates.io
|
# crates.io
|
||||||
syn = { version = "2", default-features = false }
|
syn = { version = "2", default-features = false }
|
||||||
quote = { version = "1", default-features = false }
|
quote = { version = "1", default-features = false }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
// WARN: be aware that both source code file path and output path and hard-coded. they might not work for you; if you have any suggestion for heuristics would determine these paths in a universal way, please let me know
|
|
||||||
use syn::{File, punctuated::Punctuated};
|
use syn::{File, punctuated::Punctuated};
|
||||||
|
|
||||||
use anode_macros_input::pretty_span;
|
use anode_macros_input::pretty_span;
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,7 @@ edition = "2024"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anode-macros.workspace = true
|
anode-macros.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
|
forgejo-openapi = { workspace = true, optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
forge-forgejo = [ "dep:forgejo-openapi" ]
|
||||||
|
|
|
||||||
|
|
@ -70,24 +70,6 @@ pub mod __default_parser {
|
||||||
pub fn PathBuf(input: OsString) -> Result<PathBuf, core::convert::Infallible> {
|
pub fn PathBuf(input: OsString) -> Result<PathBuf, core::convert::Infallible> {
|
||||||
Ok(input.into())
|
Ok(input.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
|
||||||
#[error("Unknown boolean value: {}", _0.display())]
|
|
||||||
pub struct UnknownBoolean(OsString);
|
|
||||||
|
|
||||||
pub fn bool(input: OsString) -> Result<bool, UnknownBoolean> {
|
|
||||||
const VALID_TRUE: &[&[u8]] = &[b"TRUE", b"True", b"true", b"1"];
|
|
||||||
const VALID_FALSE: &[&[u8]] = &[b"FALSE", b"False", b"false", b"0"];
|
|
||||||
if VALID_TRUE.contains(&input.as_bytes()) {
|
|
||||||
return Ok(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if VALID_FALSE.contains(&input.as_bytes()) {
|
|
||||||
return Ok(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Err(UnknownBoolean(input))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod parse {
|
pub mod parse {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue