From 209f7cfc89234f54e2ff579f65da6c288d8e5e83 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Tue, 13 Jun 2023 06:04:13 +0800 Subject: [PATCH] Allow disabling http feature --- Cargo.lock | 378 +++++++++++------- Cargo.toml | 2 +- crates/cli/Cargo.toml | 4 +- crates/cli/src/commands/chain.rs | 2 +- crates/cli/src/commands/codegen.rs | 2 +- crates/cli/src/commands/mod.rs | 2 +- crates/cli/src/commands/process/mod.rs | 2 +- crates/cli/src/commands/validate.rs | 2 +- crates/cli/src/main.rs | 3 +- crates/schematools/Cargo.toml | 11 +- crates/schematools/src/lib.rs | 12 + crates/schematools/src/process/dereference.rs | 27 +- crates/schematools/src/process/merge_allof.rs | 15 +- crates/schematools/src/process/mod.rs | 3 +- crates/schematools/src/resolver.rs | 3 +- crates/schematools/src/schema.rs | 11 +- crates/schematools/src/storage.rs | 3 +- 17 files changed, 292 insertions(+), 190 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 399b4db..8c68fb0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,10 +14,11 @@ dependencies = [ [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ + "cfg-if 1.0.0", "getrandom", "once_cell", "serde", @@ -33,6 +34,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "anyhow" +version = "1.0.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" + [[package]] name = "autocfg" version = "1.0.1" @@ -45,6 +52,12 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + [[package]] name = "bit-set" version = "0.5.3" @@ -187,7 +200,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -199,6 +212,22 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + [[package]] name = "cpufeatures" version = "0.2.5" @@ -299,20 +328,44 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fancy-regex" -version = "0.7.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" +checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" dependencies = [ "bit-set", "regex", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.0.0" @@ -325,9 +378,9 @@ dependencies = [ [[package]] name = "fraction" -version = "0.9.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba3510011eee8825018be07f08d9643421de007eaf62a3bde58d89b058abfa7" +checksum = "3027ae1df8d41b4bed2241c8fdad4acc1e7af60c8e17743534b545e77182d678" dependencies = [ "lazy_static", "num", @@ -410,15 +463,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if 1.0.0", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] name = "git2" -version = "0.16.1" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf7f68c2995f392c49fffb4f95ae2c873297830eb25c6bc4c114ce8f4562acc" +checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044" dependencies = [ "bitflags", "libc", @@ -567,16 +622,16 @@ dependencies = [ ] [[package]] -name = "hyper-rustls" -version = "0.23.0" +name = "hyper-tls" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "http", + "bytes 1.2.1", "hyper", - "rustls", + "native-tls", "tokio", - "tokio-rustls", + "tokio-native-tls", ] [[package]] @@ -618,6 +673,15 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "io-lifetimes" version = "1.0.4" @@ -648,9 +712,9 @@ dependencies = [ [[package]] name = "iso8601" -version = "0.4.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5b94fbeb759754d87e1daea745bc8efd3037cd16980331fe1d1524c9a79ce96" +checksum = "924e5d73ea28f59011fec52a0d12185d496a9b075d360657aed2a5707f701153" dependencies = [ "nom", ] @@ -698,20 +762,22 @@ dependencies = [ [[package]] name = "jsonschema" -version = "0.14.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542a96a0cf3c7c919187bd2789b046be6c95622c820928ca9ef442d838569ee3" +checksum = "e48354c4c4f088714424ddf090de1ff84acc82b2f08c192d46d226ae2529a465" dependencies = [ "ahash", - "base64", + "anyhow", + "base64 0.21.2", "bytecount", "fancy-regex", "fraction", + "getrandom", "iso8601", "itoa 1.0.4", - "lazy_static", "memchr", "num-cmp", + "once_cell", "parking_lot", "percent-encoding", "regex", @@ -737,9 +803,9 @@ checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libgit2-sys" -version = "0.14.2+1.5.1" +version = "0.15.2+1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4" +checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa" dependencies = [ "cc", "libc", @@ -751,9 +817,9 @@ dependencies = [ [[package]] name = "libssh2-sys" -version = "0.2.21" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0186af0d8f171ae6b9c4c90ec51898bad5d08a2d5e470903a50d9ad8959cbee" +checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" dependencies = [ "cc", "libc", @@ -847,6 +913,24 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nom" version = "7.1.1" @@ -859,9 +943,9 @@ dependencies = [ [[package]] name = "num" -version = "0.2.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ "num-bigint", "num-complex", @@ -873,9 +957,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.2.6" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ "autocfg", "num-integer", @@ -890,11 +974,10 @@ checksum = "63335b2e2c34fae2fb0aa2cecfd9f0832a1e24b3b32ecec612c3426d46dc8aaa" [[package]] name = "num-complex" -version = "0.2.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ - "autocfg", "num-traits", ] @@ -921,9 +1004,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", "num-bigint", @@ -952,9 +1035,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -962,6 +1045,32 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "openssl" +version = "0.10.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.18", +] + [[package]] name = "openssl-probe" version = "0.1.2" @@ -1045,7 +1154,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1076,7 +1185,7 @@ checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1106,7 +1215,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -1123,18 +1232,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -1171,7 +1280,7 @@ version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" dependencies = [ - "base64", + "base64 0.13.0", "bytes 1.2.1", "encoding_rs", "futures-core", @@ -1180,45 +1289,28 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls", + "hyper-tls", "ipnet", "js-sys", "log", "mime", + "native-tls", "once_cell", "percent-encoding", "pin-project-lite", - "rustls", - "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", - "tokio-rustls", + "tokio-native-tls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", "winreg", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - [[package]] name = "rustix" version = "0.36.6" @@ -1233,27 +1325,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "rustls" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" -dependencies = [ - "base64", -] - [[package]] name = "ryu" version = "1.0.5" @@ -1269,9 +1340,18 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +dependencies = [ + "windows-sys", +] + [[package]] name = "schematools" -version = "0.13.1" +version = "0.14.0" dependencies = [ "Inflector", "digest 0.10.1", @@ -1297,12 +1377,11 @@ dependencies = [ [[package]] name = "schematools-cli" -version = "0.13.1" +version = "0.14.0" dependencies = [ "clap", "env_logger", "log", - "reqwest", "schematools", "serde", "serde_json", @@ -1318,13 +1397,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] -name = "sct" -version = "0.7.0" +name = "security-framework" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ - "ring", - "untrusted", + "core-foundation-sys", + "libc", ] [[package]] @@ -1335,29 +1427,29 @@ checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.18", ] [[package]] name = "serde_json" -version = "1.0.93" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "indexmap", "itoa 1.0.4", @@ -1435,12 +1527,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "strsim" version = "0.10.0" @@ -1458,6 +1544,30 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +dependencies = [ + "cfg-if 1.0.0", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys", +] + [[package]] name = "tera" version = "1.5.0" @@ -1501,7 +1611,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1513,7 +1623,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "test-case-core", ] @@ -1528,22 +1638,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.18", ] [[package]] @@ -1614,14 +1724,13 @@ dependencies = [ ] [[package]] -name = "tokio-rustls" -version = "0.23.4" +name = "tokio-native-tls" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ - "rustls", + "native-tls", "tokio", - "webpki", ] [[package]] @@ -1721,12 +1830,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc7ed8ba44ca06be78ea1ad2c3682a43349126c8818054231ee6f4748012aed2" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "url" version = "2.3.0" @@ -1740,9 +1843,9 @@ dependencies = [ [[package]] name = "uuid" -version = "0.8.2" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2" [[package]] name = "vcpkg" @@ -1804,7 +1907,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -1838,7 +1941,7 @@ checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1859,25 +1962,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" -dependencies = [ - "webpki", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 901eea0..f8303bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://github.com/kstasik/schema-tools" version = "0.14.0" [workspace.dependencies] -reqwest = { version = "0.11.12", default-features = false, features = ["blocking"] } +reqwest = { version = "0.11.12", default-features = false, features = ["default-tls", "blocking"] } serde_json = { version = "1", features = ["preserve_order"] } serde_yaml = "0.9.14" log = "0.4" diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 79316e2..6b20c21 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -7,16 +7,16 @@ repository.workspace = true version.workspace = true [features] -default = ["codegen", "git2", "json-patch"] +default = ["codegen", "git2", "http", "json-patch"] codegen = ["schematools/codegen"] git2 = ["schematools/git2"] +http = ["schematools/http"] json-patch = ["schematools/json-patch"] semver = ["schematools/semver"] [dependencies] serde_json = { workspace = true } serde_yaml = { workspace = true } -reqwest = { workspace = true } log = { workspace = true } thiserror = { workspace = true } diff --git a/crates/cli/src/commands/chain.rs b/crates/cli/src/commands/chain.rs index 40fa2e9..f2ec86f 100644 --- a/crates/cli/src/commands/chain.rs +++ b/crates/cli/src/commands/chain.rs @@ -1,6 +1,6 @@ use clap::{Parser, Subcommand}; -use reqwest::blocking::Client; +use schematools::Client; use schematools::storage::SchemaStorage; use schematools::{discovery::Discovery, schema::Schema}; diff --git a/crates/cli/src/commands/codegen.rs b/crates/cli/src/commands/codegen.rs index be370d7..b49cbce 100644 --- a/crates/cli/src/commands/codegen.rs +++ b/crates/cli/src/commands/codegen.rs @@ -1,5 +1,5 @@ -use reqwest::blocking::Client; use schematools::codegen::jsonschema::JsonSchemaExtractOptions; +use schematools::Client; use serde_json::Value; use std::{fmt::Display, time::Instant}; diff --git a/crates/cli/src/commands/mod.rs b/crates/cli/src/commands/mod.rs index b510232..41b3d4f 100644 --- a/crates/cli/src/commands/mod.rs +++ b/crates/cli/src/commands/mod.rs @@ -4,7 +4,7 @@ use std::io::prelude::*; use clap::{Parser, ValueEnum}; use env_logger::Builder as LoggerBuilder; -use reqwest::blocking::Client; +use schematools::Client; use serde_json::Value; pub mod chain; diff --git a/crates/cli/src/commands/process/mod.rs b/crates/cli/src/commands/process/mod.rs index 3e22b32..1526b0d 100644 --- a/crates/cli/src/commands/process/mod.rs +++ b/crates/cli/src/commands/process/mod.rs @@ -2,9 +2,9 @@ use std::fmt::Display; use crate::commands::GetSchemaCommand; use clap::{Parser, Subcommand}; -use reqwest::blocking::Client; use schematools::storage::SchemaStorage; use schematools::tools; +use schematools::Client; use crate::error::Error; use schematools::process::{dereference, merge_allof, merge_openapi, name}; diff --git a/crates/cli/src/commands/validate.rs b/crates/cli/src/commands/validate.rs index 9918f5b..a027876 100644 --- a/crates/cli/src/commands/validate.rs +++ b/crates/cli/src/commands/validate.rs @@ -1,7 +1,7 @@ use std::fmt::Display; use clap::Parser; -use reqwest::blocking::Client; +use schematools::Client; use crate::error::Error; use schematools::schema::{path_to_url, Schema}; diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 21029c7..a0c1ef8 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -1,4 +1,5 @@ use clap::{Parser, Subcommand}; +use schematools::Client; pub mod commands; pub mod error; @@ -29,7 +30,7 @@ enum Command { fn main() { let opts: Opts = Opts::parse(); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let result = match opts.command { Command::Process(opts) => commands::process::execute(opts, &client), diff --git a/crates/schematools/Cargo.toml b/crates/schematools/Cargo.toml index 94f381d..8dee037 100644 --- a/crates/schematools/Cargo.toml +++ b/crates/schematools/Cargo.toml @@ -8,26 +8,27 @@ repository.workspace = true version.workspace = true [features] -default = ["codegen", "git2", "json-patch"] +default = ["codegen", "git2", "http", "json-patch"] codegen = ["tera", "semver"] +http = ["jsonschema/resolve-http", "reqwest"] [dependencies] serde_json = { workspace = true } serde_yaml = { workspace = true } -reqwest = { workspace = true } +reqwest = { workspace = true, optional = true } log = { workspace = true } thiserror = { workspace = true } url = "2" lazy_static = "1.4.0" regex = "1" -jsonschema = { version = "0.14", default-features = false, features = ["reqwest", "reqwest-rustls-tls"] } +jsonschema = { version = "0.17", default-features = false, features = ["resolve-file"] } tera = { version = "1", default-features = false, optional = true } serde = { version = "1.0", features = ["derive"] } walkdir = "2" -json-patch = { version = "0.2.6", optional = true } +json-patch = { version = "0.2.7", optional = true } semver = { version = "1.0", optional = true } -git2 = { version = "0.16", optional = true } +git2 = { version = "0.17", optional = true } md5 = "0.7.0" Inflector = "0.11" digest = "0.10.1" diff --git a/crates/schematools/src/lib.rs b/crates/schematools/src/lib.rs index 1c39330..34497ea 100644 --- a/crates/schematools/src/lib.rs +++ b/crates/schematools/src/lib.rs @@ -14,4 +14,16 @@ pub mod storage; pub mod tools; pub mod validate; +#[cfg(feature = "http")] +pub use reqwest::blocking::Client; +/// A dummy client to be used when the http feature is disabled +#[cfg(not(feature = "http"))] +pub struct Client; +#[cfg(not(feature = "http"))] +impl Client { + pub fn new() -> Client { + Client {} + } +} + pub const VERSION: &str = "0.14.0"; diff --git a/crates/schematools/src/process/dereference.rs b/crates/schematools/src/process/dereference.rs index 75872e9..88c7953 100644 --- a/crates/schematools/src/process/dereference.rs +++ b/crates/schematools/src/process/dereference.rs @@ -6,8 +6,8 @@ use crate::schema::Schema; use crate::scope::SchemaScope; use crate::storage::{ref_to_url, SchemaStorage}; -use reqwest::Url; use serde_json::Value; +use url::Url; pub struct Dereferencer; @@ -244,7 +244,7 @@ fn process_discriminator(root: &mut Value, ctx: &mut DereferencerContext) { #[cfg(test)] mod tests { use super::*; - use reqwest::Url; + use crate::Client; use serde_json::json; fn spec_from_file(file: &str) -> Schema { @@ -257,7 +257,7 @@ mod tests { fn test_infinite_ref() { let mut spec = spec_from_file("resources/test/json-schemas/07-with-infinite-ref.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options() @@ -270,7 +270,7 @@ mod tests { fn test_string_reference() { let mut spec = spec_from_file("resources/test/json-schemas/16-string-reference.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options().process(&mut spec, &ss); @@ -302,7 +302,7 @@ mod tests { fn test_discriminator() { let mut spec = spec_from_file("resources/test/json-schemas/22-discriminator-root.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options() @@ -372,7 +372,7 @@ mod tests { fn test_with_local_reference() { let mut spec = spec_from_file("resources/test/json-schemas/06-with-local-reference.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options().process(&mut spec, &ss); @@ -422,7 +422,7 @@ mod tests { fn test_create_internal_references() { let mut spec = spec_from_file("resources/test/json-schemas/20-local-reference.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options() @@ -521,11 +521,12 @@ mod tests { } #[test] + #[cfg(feature = "http")] fn test_with_nested_remote_external_reference() { let mut spec = spec_from_file("resources/test/json-schemas/05-with-nested-remote-external-ref.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options().process(&mut spec, &ss); @@ -556,7 +557,7 @@ mod tests { let mut spec = spec_from_file("resources/test/json-schemas/04-with-nested-external-ref.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options().process(&mut spec, &ss); @@ -605,11 +606,12 @@ mod tests { } #[test] + #[cfg(feature = "http")] fn test_skip_references() { let mut spec = spec_from_file("resources/test/json-schemas/05-with-nested-remote-external-ref.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options() @@ -633,11 +635,12 @@ mod tests { } #[test] + #[cfg(feature = "http")] fn test_simple_with_external_reference() { let mut spec = spec_from_file("resources/test/json-schemas/03-simple-with-external-ref.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options().process(&mut spec, &ss); @@ -667,7 +670,7 @@ mod tests { fn test_simple_with_reference() { let mut spec = spec_from_file("resources/test/json-schemas/02-simple-with-reference.json"); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&spec, &client); Dereferencer::options().process(&mut spec, &ss); diff --git a/crates/schematools/src/process/merge_allof.rs b/crates/schematools/src/process/merge_allof.rs index 1dd363e..ed6e39a 100644 --- a/crates/schematools/src/process/merge_allof.rs +++ b/crates/schematools/src/process/merge_allof.rs @@ -157,6 +157,7 @@ fn merge_values(a: &mut Value, b: Value) { #[cfg(test)] mod tests { use super::*; + use crate::Client; use serde_json::json; #[test] @@ -242,7 +243,7 @@ mod tests { let mut schema = Schema::from_json(value); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&schema, &client); Merger::options().process(&mut schema, &ss); @@ -296,7 +297,7 @@ mod tests { let mut schema = Schema::from_json(value); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&schema, &client); Merger::options().process(&mut schema, &ss); @@ -338,7 +339,7 @@ mod tests { let mut schema = Schema::from_json(value); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&schema, &client); Merger::options().process(&mut schema, &ss); @@ -390,7 +391,7 @@ mod tests { let mut schema = Schema::from_json(value); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&schema, &client); Merger::options().process(&mut schema, &ss); @@ -462,7 +463,7 @@ mod tests { let mut schema = Schema::from_json(value); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&schema, &client); Merger::options().process(&mut schema, &ss); @@ -587,7 +588,7 @@ mod tests { let mut schema = Schema::from_json(value); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&schema, &client); Merger::options().process(&mut schema, &ss); @@ -631,7 +632,7 @@ mod tests { let mut schema = Schema::from_json(value); - let client = reqwest::blocking::Client::new(); + let client = Client::new(); let ss = SchemaStorage::new(&schema, &client); Merger::options().process(&mut schema, &ss); diff --git a/crates/schematools/src/process/mod.rs b/crates/schematools/src/process/mod.rs index d6b0001..14e4e69 100644 --- a/crates/schematools/src/process/mod.rs +++ b/crates/schematools/src/process/mod.rs @@ -8,8 +8,8 @@ pub mod merge_openapi; pub mod name; pub mod patch; -use reqwest::Url; use serde_json::Value; +use url::Url; // this function should probably be removed in favor of schema registry pub fn rel_to_absolute_refs(_url: &Url, mut _data: Value) -> Value { @@ -86,7 +86,6 @@ where #[cfg(test)] mod tests { use super::*; - use reqwest::Url; use serde_json::json; #[test] diff --git a/crates/schematools/src/resolver.rs b/crates/schematools/src/resolver.rs index 1b46439..f4d2cf6 100644 --- a/crates/schematools/src/resolver.rs +++ b/crates/schematools/src/resolver.rs @@ -1,6 +1,6 @@ use crate::{error::Error, storage::SchemaStorage}; -use reqwest::Url; use serde_json::Value; +use url::Url; use crate::{schema::Schema, scope::SchemaScope}; @@ -137,7 +137,6 @@ impl<'a> SchemaResolver<'a> { #[cfg(test)] mod tests { use super::*; - use reqwest::Url; #[test] fn test_when_file_and_spec_are_valid() { diff --git a/crates/schematools/src/schema.rs b/crates/schematools/src/schema.rs index d425f40..435217a 100644 --- a/crates/schematools/src/schema.rs +++ b/crates/schematools/src/schema.rs @@ -1,11 +1,10 @@ -use reqwest::blocking::Client; use serde::Deserialize; use serde_json::Value; use std::{fs, path::PathBuf}; use url::Url; use crate::error::Error; -use crate::process; +use crate::{process, Client}; #[derive(Debug, Clone)] pub struct Schema { @@ -15,10 +14,11 @@ pub struct Schema { impl Schema { pub fn load_url(url: Url) -> Result { - let client = reqwest::blocking::Client::new(); + let client = Client::new(); Self::load_url_with_client(url, &client) } + #[allow(unused_variables)] pub fn load_url_with_client(url: Url, client: &Client) -> Result { log::info!("loading: {}", url); @@ -37,8 +37,9 @@ impl Schema { path, })?; - Ok((None, content)) + Ok((None::, content)) } + #[cfg(feature = "http")] "http" | "https" => { let response = client.get(url.to_string()).send().map_err(|error| { Error::SchemaHttpLoad { @@ -107,7 +108,7 @@ impl Schema { } pub fn load_urls(urls: Vec) -> Result { - let client = reqwest::blocking::Client::new(); + let client = Client::new(); Self::load_urls_with_client(urls, &client) } diff --git a/crates/schematools/src/storage.rs b/crates/schematools/src/storage.rs index c10d78d..55bed58 100644 --- a/crates/schematools/src/storage.rs +++ b/crates/schematools/src/storage.rs @@ -1,8 +1,9 @@ use std::collections::HashMap; use crate::schema::Schema; -use reqwest::{blocking::Client, Url}; +use crate::Client; use serde_json::Value; +use url::Url; pub struct SchemaStorage { pub schemas: HashMap,