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