openapiv3 v2 (#607)
This commit is contained in:
parent
2708963c5f
commit
54ea87fa40
|
@ -255,7 +255,7 @@ dependencies = [
|
|||
"built",
|
||||
"clap",
|
||||
"env_logger",
|
||||
"openapiv3",
|
||||
"openapiv3 2.0.0-rc.0",
|
||||
"progenitor",
|
||||
"progenitor-client",
|
||||
"progenitor-impl",
|
||||
|
@ -476,7 +476,7 @@ dependencies = [
|
|||
"hyper",
|
||||
"indexmap 2.0.2",
|
||||
"multer",
|
||||
"openapiv3",
|
||||
"openapiv3 1.0.3",
|
||||
"paste",
|
||||
"percent-encoding",
|
||||
"proc-macro2",
|
||||
|
@ -1264,6 +1264,17 @@ dependencies = [
|
|||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openapiv3"
|
||||
version = "2.0.0-rc.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c282a84bd67f641465bd16b1ba041fdf300ebec6f663f1b37d17d3403387eab1"
|
||||
dependencies = [
|
||||
"indexmap 2.0.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.55"
|
||||
|
@ -1439,7 +1450,7 @@ dependencies = [
|
|||
"http",
|
||||
"hyper",
|
||||
"indexmap 2.0.2",
|
||||
"openapiv3",
|
||||
"openapiv3 2.0.0-rc.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
|
@ -1458,7 +1469,7 @@ dependencies = [
|
|||
name = "progenitor-macro"
|
||||
version = "0.4.0"
|
||||
dependencies = [
|
||||
"openapiv3",
|
||||
"openapiv3 2.0.0-rc.0",
|
||||
"proc-macro2",
|
||||
"progenitor-impl",
|
||||
"quote",
|
||||
|
|
|
@ -19,7 +19,7 @@ progenitor-impl = { version = "0.4.0", path = "../progenitor-impl" }
|
|||
anyhow = "1.0"
|
||||
clap = { version = "4.4.6", features = ["derive"] }
|
||||
env_logger = "0.10.0"
|
||||
openapiv3 = "1.0.3"
|
||||
openapiv3 = "2.0.0-rc.0"
|
||||
rustfmt-wrapper = "0.2.0"
|
||||
serde_json = "1.0"
|
||||
serde_yaml = "0.9"
|
||||
|
|
|
@ -12,7 +12,7 @@ heck = "0.4.1"
|
|||
http = "0.2.9"
|
||||
getopts = "0.2"
|
||||
indexmap = "2.0.2"
|
||||
openapiv3 = "1.0.3"
|
||||
openapiv3 = "2.0.0-rc.0"
|
||||
proc-macro2 = "1.0"
|
||||
quote = "1.0"
|
||||
regex = "1.9"
|
||||
|
|
|
@ -299,17 +299,18 @@ impl Convert<schemars::schema::Schema> for openapiv3::Schema {
|
|||
..Default::default()
|
||||
},
|
||||
|
||||
openapiv3::SchemaKind::Type(openapiv3::Type::Boolean {}) => {
|
||||
schemars::schema::SchemaObject {
|
||||
metadata,
|
||||
instance_type: instance_type(
|
||||
schemars::schema::InstanceType::Boolean,
|
||||
nullable,
|
||||
),
|
||||
extensions,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
openapiv3::SchemaKind::Type(openapiv3::Type::Boolean(
|
||||
openapiv3::BooleanType { enumeration },
|
||||
)) => schemars::schema::SchemaObject {
|
||||
metadata,
|
||||
instance_type: instance_type(
|
||||
schemars::schema::InstanceType::Boolean,
|
||||
nullable,
|
||||
),
|
||||
enum_values: enumeration.convert(),
|
||||
extensions,
|
||||
..Default::default()
|
||||
},
|
||||
|
||||
openapiv3::SchemaKind::OneOf { one_of } => {
|
||||
schemars::schema::SchemaObject {
|
||||
|
@ -744,6 +745,14 @@ impl Convert<Value> for Option<i64> {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl Convert<Value> for Option<bool> {
|
||||
fn convert(&self) -> Value {
|
||||
match self {
|
||||
Some(value) => Value::Bool(*value),
|
||||
None => Value::Null,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn instance_type(
|
||||
instance_type: schemars::schema::InstanceType,
|
||||
|
|
|
@ -11,7 +11,7 @@ readme = "../README.md"
|
|||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
openapiv3 = "1.0.3"
|
||||
openapiv3 = "2.0.0-rc.0"
|
||||
proc-macro2 = "1.0"
|
||||
progenitor-impl = { version = "0.4.0", path = "../progenitor-impl" }
|
||||
quote = "1.0"
|
||||
|
|
Loading…
Reference in New Issue