spikard 0.17.0 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/spikard_rb/native/Cargo.lock +216 -366
- data/ext/spikard_rb/native/Cargo.toml +7 -7
- data/ext/spikard_rb/src/lib.rs +130 -89
- data/lib/spikard/native.rb +5 -9
- data/lib/spikard/version.rb +2 -2
- data/sig/types.rbs +13 -14
- metadata +1 -1
data/ext/spikard_rb/src/lib.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:72cee06b09b03313dcc351fbc7c7b46dd974c59bdab5873558a75948a4cb32e4
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -311,7 +311,7 @@ impl AsyncApiConfig {
|
|
|
311
311
|
})?,
|
|
312
312
|
None => Default::default(),
|
|
313
313
|
},
|
|
314
|
-
spec: match kwargs.get(ruby.to_symbol("spec")) {
|
|
314
|
+
spec: match kwargs.get(ruby.to_symbol("spec")).filter(|v| !v.is_nil()) {
|
|
315
315
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
316
316
|
magnus::Error::new(
|
|
317
317
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -497,7 +497,7 @@ impl BackgroundJobMetadata {
|
|
|
497
497
|
})?,
|
|
498
498
|
None => "background_task".to_string(),
|
|
499
499
|
},
|
|
500
|
-
request_id: match kwargs.get(ruby.to_symbol("request_id")) {
|
|
500
|
+
request_id: match kwargs.get(ruby.to_symbol("request_id")).filter(|v| !v.is_nil()) {
|
|
501
501
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
502
502
|
magnus::Error::new(
|
|
503
503
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -791,7 +791,7 @@ impl ContactInfo {
|
|
|
791
791
|
let (kwargs_opt,) = args.optional;
|
|
792
792
|
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
793
793
|
Ok(Self {
|
|
794
|
-
name: match kwargs.get(ruby.to_symbol("name")) {
|
|
794
|
+
name: match kwargs.get(ruby.to_symbol("name")).filter(|v| !v.is_nil()) {
|
|
795
795
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
796
796
|
magnus::Error::new(
|
|
797
797
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -800,7 +800,7 @@ impl ContactInfo {
|
|
|
800
800
|
})?),
|
|
801
801
|
None => None,
|
|
802
802
|
},
|
|
803
|
-
email: match kwargs.get(ruby.to_symbol("email")) {
|
|
803
|
+
email: match kwargs.get(ruby.to_symbol("email")).filter(|v| !v.is_nil()) {
|
|
804
804
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
805
805
|
magnus::Error::new(
|
|
806
806
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -809,7 +809,7 @@ impl ContactInfo {
|
|
|
809
809
|
})?),
|
|
810
810
|
None => None,
|
|
811
811
|
},
|
|
812
|
-
url: match kwargs.get(ruby.to_symbol("url")) {
|
|
812
|
+
url: match kwargs.get(ruby.to_symbol("url")).filter(|v| !v.is_nil()) {
|
|
813
813
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
814
814
|
magnus::Error::new(
|
|
815
815
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -922,7 +922,7 @@ impl CorsConfig {
|
|
|
922
922
|
})?,
|
|
923
923
|
None => Default::default(),
|
|
924
924
|
},
|
|
925
|
-
expose_headers: match kwargs.get(ruby.to_symbol("expose_headers")) {
|
|
925
|
+
expose_headers: match kwargs.get(ruby.to_symbol("expose_headers")).filter(|v| !v.is_nil()) {
|
|
926
926
|
Some(v) => Some(<Vec<String>>::try_convert(v).map_err(|e| {
|
|
927
927
|
magnus::Error::new(
|
|
928
928
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -931,7 +931,7 @@ impl CorsConfig {
|
|
|
931
931
|
})?),
|
|
932
932
|
None => None,
|
|
933
933
|
},
|
|
934
|
-
max_age: match kwargs.get(ruby.to_symbol("max_age")) {
|
|
934
|
+
max_age: match kwargs.get(ruby.to_symbol("max_age")).filter(|v| !v.is_nil()) {
|
|
935
935
|
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
936
936
|
magnus::Error::new(
|
|
937
937
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -940,7 +940,7 @@ impl CorsConfig {
|
|
|
940
940
|
})?),
|
|
941
941
|
None => None,
|
|
942
942
|
},
|
|
943
|
-
allow_credentials: match kwargs.get(ruby.to_symbol("allow_credentials")) {
|
|
943
|
+
allow_credentials: match kwargs.get(ruby.to_symbol("allow_credentials")).filter(|v| !v.is_nil()) {
|
|
944
944
|
Some(v) => Some(bool::try_convert(v).map_err(|e| {
|
|
945
945
|
magnus::Error::new(
|
|
946
946
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1117,7 +1117,7 @@ impl DynamicSchemaConfig {
|
|
|
1117
1117
|
})?,
|
|
1118
1118
|
None => Default::default(),
|
|
1119
1119
|
},
|
|
1120
|
-
max_complexity: match kwargs.get(ruby.to_symbol("max_complexity")) {
|
|
1120
|
+
max_complexity: match kwargs.get(ruby.to_symbol("max_complexity")).filter(|v| !v.is_nil()) {
|
|
1121
1121
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
1122
1122
|
magnus::Error::new(
|
|
1123
1123
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1126,7 +1126,7 @@ impl DynamicSchemaConfig {
|
|
|
1126
1126
|
})?),
|
|
1127
1127
|
None => None,
|
|
1128
1128
|
},
|
|
1129
|
-
max_depth: match kwargs.get(ruby.to_symbol("max_depth")) {
|
|
1129
|
+
max_depth: match kwargs.get(ruby.to_symbol("max_depth")).filter(|v| !v.is_nil()) {
|
|
1130
1130
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
1131
1131
|
magnus::Error::new(
|
|
1132
1132
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1295,7 +1295,7 @@ impl FullSchemaConfig {
|
|
|
1295
1295
|
})?,
|
|
1296
1296
|
None => true,
|
|
1297
1297
|
},
|
|
1298
|
-
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")) {
|
|
1298
|
+
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")).filter(|v| !v.is_nil()) {
|
|
1299
1299
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
1300
1300
|
magnus::Error::new(
|
|
1301
1301
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1304,7 +1304,7 @@ impl FullSchemaConfig {
|
|
|
1304
1304
|
})?),
|
|
1305
1305
|
None => None,
|
|
1306
1306
|
},
|
|
1307
|
-
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")) {
|
|
1307
|
+
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")).filter(|v| !v.is_nil()) {
|
|
1308
1308
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
1309
1309
|
magnus::Error::new(
|
|
1310
1310
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1434,7 +1434,7 @@ unsafe impl TryConvertOwned for GraphQLSubscriptionSnapshot {}
|
|
|
1434
1434
|
#[cfg(not(target_arch = "wasm32"))]
|
|
1435
1435
|
impl Default for GraphQLSubscriptionSnapshot {
|
|
1436
1436
|
fn default() -> Self {
|
|
1437
|
-
spikard_http::testing::
|
|
1437
|
+
spikard_http::testing::GraphQLSubscriptionSnapshot::default().into()
|
|
1438
1438
|
}
|
|
1439
1439
|
}
|
|
1440
1440
|
|
|
@@ -1464,7 +1464,7 @@ impl GraphQLSubscriptionSnapshot {
|
|
|
1464
1464
|
})?,
|
|
1465
1465
|
None => Default::default(),
|
|
1466
1466
|
},
|
|
1467
|
-
event: match kwargs.get(ruby.to_symbol("event")) {
|
|
1467
|
+
event: match kwargs.get(ruby.to_symbol("event")).filter(|v| !v.is_nil()) {
|
|
1468
1468
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
1469
1469
|
magnus::Error::new(
|
|
1470
1470
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1606,7 +1606,7 @@ impl GrpcConfig {
|
|
|
1606
1606
|
})?,
|
|
1607
1607
|
None => true,
|
|
1608
1608
|
},
|
|
1609
|
-
request_timeout: match kwargs.get(ruby.to_symbol("request_timeout")) {
|
|
1609
|
+
request_timeout: match kwargs.get(ruby.to_symbol("request_timeout")).filter(|v| !v.is_nil()) {
|
|
1610
1610
|
Some(v) => Some(u64::try_convert(v).map_err(|e| {
|
|
1611
1611
|
magnus::Error::new(
|
|
1612
1612
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1651,7 +1651,10 @@ impl GrpcConfig {
|
|
|
1651
1651
|
})?,
|
|
1652
1652
|
None => 20,
|
|
1653
1653
|
},
|
|
1654
|
-
max_stream_response_bytes: match kwargs
|
|
1654
|
+
max_stream_response_bytes: match kwargs
|
|
1655
|
+
.get(ruby.to_symbol("max_stream_response_bytes"))
|
|
1656
|
+
.filter(|v| !v.is_nil())
|
|
1657
|
+
{
|
|
1655
1658
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
1656
1659
|
magnus::Error::new(
|
|
1657
1660
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1700,6 +1703,25 @@ impl GrpcConfig {
|
|
|
1700
1703
|
}
|
|
1701
1704
|
}
|
|
1702
1705
|
|
|
1706
|
+
#[derive(Clone)]
|
|
1707
|
+
#[magnus::wrap(class = "Spikard::HookRegistry")]
|
|
1708
|
+
pub struct HookRegistry {
|
|
1709
|
+
inner: Arc<spikard_http::lifecycle::adapter::HookRegistry>,
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
unsafe impl IntoValueFromNative for HookRegistry {}
|
|
1713
|
+
|
|
1714
|
+
impl magnus::TryConvert for HookRegistry {
|
|
1715
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1716
|
+
let r: &HookRegistry = magnus::TryConvert::try_convert(val)?;
|
|
1717
|
+
Ok(r.clone())
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
unsafe impl TryConvertOwned for HookRegistry {}
|
|
1722
|
+
|
|
1723
|
+
impl HookRegistry {}
|
|
1724
|
+
|
|
1703
1725
|
#[derive(Clone, Debug, serde::Serialize)]
|
|
1704
1726
|
#[serde(default)]
|
|
1705
1727
|
#[magnus::wrap(class = "Spikard::JsonRpcConfig")]
|
|
@@ -1891,7 +1913,7 @@ impl JsonRpcMethodInfo {
|
|
|
1891
1913
|
})?,
|
|
1892
1914
|
None => Default::default(),
|
|
1893
1915
|
},
|
|
1894
|
-
description: match kwargs.get(ruby.to_symbol("description")) {
|
|
1916
|
+
description: match kwargs.get(ruby.to_symbol("description")).filter(|v| !v.is_nil()) {
|
|
1895
1917
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
1896
1918
|
magnus::Error::new(
|
|
1897
1919
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1900,7 +1922,7 @@ impl JsonRpcMethodInfo {
|
|
|
1900
1922
|
})?),
|
|
1901
1923
|
None => None,
|
|
1902
1924
|
},
|
|
1903
|
-
params_schema: match kwargs.get(ruby.to_symbol("params_schema")) {
|
|
1925
|
+
params_schema: match kwargs.get(ruby.to_symbol("params_schema")).filter(|v| !v.is_nil()) {
|
|
1904
1926
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
1905
1927
|
magnus::Error::new(
|
|
1906
1928
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -1909,7 +1931,7 @@ impl JsonRpcMethodInfo {
|
|
|
1909
1931
|
})?),
|
|
1910
1932
|
None => None,
|
|
1911
1933
|
},
|
|
1912
|
-
result_schema: match kwargs.get(ruby.to_symbol("result_schema")) {
|
|
1934
|
+
result_schema: match kwargs.get(ruby.to_symbol("result_schema")).filter(|v| !v.is_nil()) {
|
|
1913
1935
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
1914
1936
|
magnus::Error::new(
|
|
1915
1937
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2042,7 +2064,7 @@ impl JwtAuthConfig {
|
|
|
2042
2064
|
})?,
|
|
2043
2065
|
None => true,
|
|
2044
2066
|
},
|
|
2045
|
-
secret: match kwargs.get(ruby.to_symbol("secret")) {
|
|
2067
|
+
secret: match kwargs.get(ruby.to_symbol("secret")).filter(|v| !v.is_nil()) {
|
|
2046
2068
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
2047
2069
|
magnus::Error::new(
|
|
2048
2070
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2051,7 +2073,7 @@ impl JwtAuthConfig {
|
|
|
2051
2073
|
})?),
|
|
2052
2074
|
None => None,
|
|
2053
2075
|
},
|
|
2054
|
-
public_key: match kwargs.get(ruby.to_symbol("public_key")) {
|
|
2076
|
+
public_key: match kwargs.get(ruby.to_symbol("public_key")).filter(|v| !v.is_nil()) {
|
|
2055
2077
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
2056
2078
|
magnus::Error::new(
|
|
2057
2079
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2069,7 +2091,7 @@ impl JwtAuthConfig {
|
|
|
2069
2091
|
})?,
|
|
2070
2092
|
None => "HS256".to_string(),
|
|
2071
2093
|
},
|
|
2072
|
-
audience: match kwargs.get(ruby.to_symbol("audience")) {
|
|
2094
|
+
audience: match kwargs.get(ruby.to_symbol("audience")).filter(|v| !v.is_nil()) {
|
|
2073
2095
|
Some(v) => Some(<Vec<String>>::try_convert(v).map_err(|e| {
|
|
2074
2096
|
magnus::Error::new(
|
|
2075
2097
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2078,7 +2100,7 @@ impl JwtAuthConfig {
|
|
|
2078
2100
|
})?),
|
|
2079
2101
|
None => None,
|
|
2080
2102
|
},
|
|
2081
|
-
issuer: match kwargs.get(ruby.to_symbol("issuer")) {
|
|
2103
|
+
issuer: match kwargs.get(ruby.to_symbol("issuer")).filter(|v| !v.is_nil()) {
|
|
2082
2104
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
2083
2105
|
magnus::Error::new(
|
|
2084
2106
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2211,7 +2233,7 @@ impl JwtConfig {
|
|
|
2211
2233
|
})?,
|
|
2212
2234
|
None => "HS256".to_string(),
|
|
2213
2235
|
},
|
|
2214
|
-
audience: match kwargs.get(ruby.to_symbol("audience")) {
|
|
2236
|
+
audience: match kwargs.get(ruby.to_symbol("audience")).filter(|v| !v.is_nil()) {
|
|
2215
2237
|
Some(v) => Some(<Vec<String>>::try_convert(v).map_err(|e| {
|
|
2216
2238
|
magnus::Error::new(
|
|
2217
2239
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2220,7 +2242,7 @@ impl JwtConfig {
|
|
|
2220
2242
|
})?),
|
|
2221
2243
|
None => None,
|
|
2222
2244
|
},
|
|
2223
|
-
issuer: match kwargs.get(ruby.to_symbol("issuer")) {
|
|
2245
|
+
issuer: match kwargs.get(ruby.to_symbol("issuer")).filter(|v| !v.is_nil()) {
|
|
2224
2246
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
2225
2247
|
magnus::Error::new(
|
|
2226
2248
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2313,7 +2335,7 @@ impl LicenseInfo {
|
|
|
2313
2335
|
})?,
|
|
2314
2336
|
None => Default::default(),
|
|
2315
2337
|
},
|
|
2316
|
-
url: match kwargs.get(ruby.to_symbol("url")) {
|
|
2338
|
+
url: match kwargs.get(ruby.to_symbol("url")).filter(|v| !v.is_nil()) {
|
|
2317
2339
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
2318
2340
|
magnus::Error::new(
|
|
2319
2341
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2421,7 +2443,7 @@ impl LifecycleHookRef {
|
|
|
2421
2443
|
})?,
|
|
2422
2444
|
None => Default::default(),
|
|
2423
2445
|
},
|
|
2424
|
-
config: match kwargs.get(ruby.to_symbol("config")) {
|
|
2446
|
+
config: match kwargs.get(ruby.to_symbol("config")).filter(|v| !v.is_nil()) {
|
|
2425
2447
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
2426
2448
|
magnus::Error::new(
|
|
2427
2449
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2430,7 +2452,7 @@ impl LifecycleHookRef {
|
|
|
2430
2452
|
})?),
|
|
2431
2453
|
None => None,
|
|
2432
2454
|
},
|
|
2433
|
-
order: match kwargs.get(ruby.to_symbol("order")) {
|
|
2455
|
+
order: match kwargs.get(ruby.to_symbol("order")).filter(|v| !v.is_nil()) {
|
|
2434
2456
|
Some(v) => Some(u32::try_convert(v).map_err(|e| {
|
|
2435
2457
|
magnus::Error::new(
|
|
2436
2458
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2685,7 +2707,7 @@ impl OpenApiConfig {
|
|
|
2685
2707
|
})?,
|
|
2686
2708
|
None => "1.0.0".to_string(),
|
|
2687
2709
|
},
|
|
2688
|
-
description: match kwargs.get(ruby.to_symbol("description")) {
|
|
2710
|
+
description: match kwargs.get(ruby.to_symbol("description")).filter(|v| !v.is_nil()) {
|
|
2689
2711
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
2690
2712
|
magnus::Error::new(
|
|
2691
2713
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2721,7 +2743,7 @@ impl OpenApiConfig {
|
|
|
2721
2743
|
})?,
|
|
2722
2744
|
None => "/openapi.json".to_string(),
|
|
2723
2745
|
},
|
|
2724
|
-
contact: match kwargs.get(ruby.to_symbol("contact")) {
|
|
2746
|
+
contact: match kwargs.get(ruby.to_symbol("contact")).filter(|v| !v.is_nil()) {
|
|
2725
2747
|
Some(v) => Some(ContactInfo::try_convert(v).map_err(|e| {
|
|
2726
2748
|
magnus::Error::new(
|
|
2727
2749
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -2730,7 +2752,7 @@ impl OpenApiConfig {
|
|
|
2730
2752
|
})?),
|
|
2731
2753
|
None => None,
|
|
2732
2754
|
},
|
|
2733
|
-
license: match kwargs.get(ruby.to_symbol("license")) {
|
|
2755
|
+
license: match kwargs.get(ruby.to_symbol("license")).filter(|v| !v.is_nil()) {
|
|
2734
2756
|
Some(v) => Some(LicenseInfo::try_convert(v).map_err(|e| {
|
|
2735
2757
|
magnus::Error::new(
|
|
2736
2758
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3070,7 +3092,7 @@ impl ParsedChannel {
|
|
|
3070
3092
|
})?,
|
|
3071
3093
|
None => Default::default(),
|
|
3072
3094
|
},
|
|
3073
|
-
bindings: match kwargs.get(ruby.to_symbol("bindings")) {
|
|
3095
|
+
bindings: match kwargs.get(ruby.to_symbol("bindings")).filter(|v| !v.is_nil()) {
|
|
3074
3096
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
3075
3097
|
magnus::Error::new(
|
|
3076
3098
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3150,7 +3172,7 @@ impl ParsedMessage {
|
|
|
3150
3172
|
})?,
|
|
3151
3173
|
None => Default::default(),
|
|
3152
3174
|
},
|
|
3153
|
-
schema: match kwargs.get(ruby.to_symbol("schema")) {
|
|
3175
|
+
schema: match kwargs.get(ruby.to_symbol("schema")).filter(|v| !v.is_nil()) {
|
|
3154
3176
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
3155
3177
|
magnus::Error::new(
|
|
3156
3178
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3261,6 +3283,7 @@ impl ParsedOperation {
|
|
|
3261
3283
|
#[serde(default)]
|
|
3262
3284
|
#[magnus::wrap(class = "Spikard::ProblemDetails")]
|
|
3263
3285
|
pub struct ProblemDetails {
|
|
3286
|
+
#[serde(rename = "type")]
|
|
3264
3287
|
type_uri: String,
|
|
3265
3288
|
title: String,
|
|
3266
3289
|
status: u16,
|
|
@@ -3345,7 +3368,7 @@ impl ProblemDetails {
|
|
|
3345
3368
|
})?,
|
|
3346
3369
|
None => 500,
|
|
3347
3370
|
},
|
|
3348
|
-
detail: match kwargs.get(ruby.to_symbol("detail")) {
|
|
3371
|
+
detail: match kwargs.get(ruby.to_symbol("detail")).filter(|v| !v.is_nil()) {
|
|
3349
3372
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
3350
3373
|
magnus::Error::new(
|
|
3351
3374
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3354,7 +3377,7 @@ impl ProblemDetails {
|
|
|
3354
3377
|
})?),
|
|
3355
3378
|
None => None,
|
|
3356
3379
|
},
|
|
3357
|
-
instance: match kwargs.get(ruby.to_symbol("instance")) {
|
|
3380
|
+
instance: match kwargs.get(ruby.to_symbol("instance")).filter(|v| !v.is_nil()) {
|
|
3358
3381
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
3359
3382
|
magnus::Error::new(
|
|
3360
3383
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3591,7 +3614,7 @@ impl QueryMutationConfig {
|
|
|
3591
3614
|
})?,
|
|
3592
3615
|
None => true,
|
|
3593
3616
|
},
|
|
3594
|
-
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")) {
|
|
3617
|
+
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")).filter(|v| !v.is_nil()) {
|
|
3595
3618
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
3596
3619
|
magnus::Error::new(
|
|
3597
3620
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3600,7 +3623,7 @@ impl QueryMutationConfig {
|
|
|
3600
3623
|
})?),
|
|
3601
3624
|
None => None,
|
|
3602
3625
|
},
|
|
3603
|
-
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")) {
|
|
3626
|
+
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")).filter(|v| !v.is_nil()) {
|
|
3604
3627
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
3605
3628
|
magnus::Error::new(
|
|
3606
3629
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3684,7 +3707,7 @@ impl QueryOnlyConfig {
|
|
|
3684
3707
|
})?,
|
|
3685
3708
|
None => true,
|
|
3686
3709
|
},
|
|
3687
|
-
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")) {
|
|
3710
|
+
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")).filter(|v| !v.is_nil()) {
|
|
3688
3711
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
3689
3712
|
magnus::Error::new(
|
|
3690
3713
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3693,7 +3716,7 @@ impl QueryOnlyConfig {
|
|
|
3693
3716
|
})?),
|
|
3694
3717
|
None => None,
|
|
3695
3718
|
},
|
|
3696
|
-
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")) {
|
|
3719
|
+
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")).filter(|v| !v.is_nil()) {
|
|
3697
3720
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
3698
3721
|
magnus::Error::new(
|
|
3699
3722
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -3927,7 +3950,7 @@ impl Response {
|
|
|
3927
3950
|
let (kwargs_opt,) = args.optional;
|
|
3928
3951
|
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
3929
3952
|
Ok(Self {
|
|
3930
|
-
content: match kwargs.get(ruby.to_symbol("content")) {
|
|
3953
|
+
content: match kwargs.get(ruby.to_symbol("content")).filter(|v| !v.is_nil()) {
|
|
3931
3954
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
3932
3955
|
magnus::Error::new(
|
|
3933
3956
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4361,7 +4384,7 @@ impl SchemaConfig {
|
|
|
4361
4384
|
})?,
|
|
4362
4385
|
None => true,
|
|
4363
4386
|
},
|
|
4364
|
-
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")) {
|
|
4387
|
+
complexity_limit: match kwargs.get(ruby.to_symbol("complexity_limit")).filter(|v| !v.is_nil()) {
|
|
4365
4388
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
4366
4389
|
magnus::Error::new(
|
|
4367
4390
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4370,7 +4393,7 @@ impl SchemaConfig {
|
|
|
4370
4393
|
})?),
|
|
4371
4394
|
None => None,
|
|
4372
4395
|
},
|
|
4373
|
-
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")) {
|
|
4396
|
+
depth_limit: match kwargs.get(ruby.to_symbol("depth_limit")).filter(|v| !v.is_nil()) {
|
|
4374
4397
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
4375
4398
|
magnus::Error::new(
|
|
4376
4399
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4500,7 +4523,7 @@ impl ServerConfig {
|
|
|
4500
4523
|
})?,
|
|
4501
4524
|
None => false,
|
|
4502
4525
|
},
|
|
4503
|
-
max_body_size: match kwargs.get(ruby.to_symbol("max_body_size")) {
|
|
4526
|
+
max_body_size: match kwargs.get(ruby.to_symbol("max_body_size")).filter(|v| !v.is_nil()) {
|
|
4504
4527
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
4505
4528
|
magnus::Error::new(
|
|
4506
4529
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4509,7 +4532,7 @@ impl ServerConfig {
|
|
|
4509
4532
|
})?),
|
|
4510
4533
|
None => None,
|
|
4511
4534
|
},
|
|
4512
|
-
request_timeout: match kwargs.get(ruby.to_symbol("request_timeout")) {
|
|
4535
|
+
request_timeout: match kwargs.get(ruby.to_symbol("request_timeout")).filter(|v| !v.is_nil()) {
|
|
4513
4536
|
Some(v) => Some(u64::try_convert(v).map_err(|e| {
|
|
4514
4537
|
magnus::Error::new(
|
|
4515
4538
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4518,7 +4541,7 @@ impl ServerConfig {
|
|
|
4518
4541
|
})?),
|
|
4519
4542
|
None => None,
|
|
4520
4543
|
},
|
|
4521
|
-
compression: match kwargs.get(ruby.to_symbol("compression")) {
|
|
4544
|
+
compression: match kwargs.get(ruby.to_symbol("compression")).filter(|v| !v.is_nil()) {
|
|
4522
4545
|
Some(v) => Some(CompressionConfig::try_convert(v).map_err(|e| {
|
|
4523
4546
|
magnus::Error::new(
|
|
4524
4547
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4527,7 +4550,7 @@ impl ServerConfig {
|
|
|
4527
4550
|
})?),
|
|
4528
4551
|
None => None,
|
|
4529
4552
|
},
|
|
4530
|
-
rate_limit: match kwargs.get(ruby.to_symbol("rate_limit")) {
|
|
4553
|
+
rate_limit: match kwargs.get(ruby.to_symbol("rate_limit")).filter(|v| !v.is_nil()) {
|
|
4531
4554
|
Some(v) => Some(RateLimitConfig::try_convert(v).map_err(|e| {
|
|
4532
4555
|
magnus::Error::new(
|
|
4533
4556
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4536,7 +4559,7 @@ impl ServerConfig {
|
|
|
4536
4559
|
})?),
|
|
4537
4560
|
None => None,
|
|
4538
4561
|
},
|
|
4539
|
-
jwt_auth: match kwargs.get(ruby.to_symbol("jwt_auth")) {
|
|
4562
|
+
jwt_auth: match kwargs.get(ruby.to_symbol("jwt_auth")).filter(|v| !v.is_nil()) {
|
|
4540
4563
|
Some(v) => Some(JwtConfig::try_convert(v).map_err(|e| {
|
|
4541
4564
|
magnus::Error::new(
|
|
4542
4565
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4545,7 +4568,7 @@ impl ServerConfig {
|
|
|
4545
4568
|
})?),
|
|
4546
4569
|
None => None,
|
|
4547
4570
|
},
|
|
4548
|
-
api_key_auth: match kwargs.get(ruby.to_symbol("api_key_auth")) {
|
|
4571
|
+
api_key_auth: match kwargs.get(ruby.to_symbol("api_key_auth")).filter(|v| !v.is_nil()) {
|
|
4549
4572
|
Some(v) => Some(ApiKeyConfig::try_convert(v).map_err(|e| {
|
|
4550
4573
|
magnus::Error::new(
|
|
4551
4574
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4581,7 +4604,7 @@ impl ServerConfig {
|
|
|
4581
4604
|
})?,
|
|
4582
4605
|
None => 30,
|
|
4583
4606
|
},
|
|
4584
|
-
asyncapi: match kwargs.get(ruby.to_symbol("asyncapi")) {
|
|
4607
|
+
asyncapi: match kwargs.get(ruby.to_symbol("asyncapi")).filter(|v| !v.is_nil()) {
|
|
4585
4608
|
Some(v) => Some(AsyncApiConfig::try_convert(v).map_err(|e| {
|
|
4586
4609
|
magnus::Error::new(
|
|
4587
4610
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4590,7 +4613,7 @@ impl ServerConfig {
|
|
|
4590
4613
|
})?),
|
|
4591
4614
|
None => None,
|
|
4592
4615
|
},
|
|
4593
|
-
openapi: match kwargs.get(ruby.to_symbol("openapi")) {
|
|
4616
|
+
openapi: match kwargs.get(ruby.to_symbol("openapi")).filter(|v| !v.is_nil()) {
|
|
4594
4617
|
Some(v) => Some(OpenApiConfig::try_convert(v).map_err(|e| {
|
|
4595
4618
|
magnus::Error::new(
|
|
4596
4619
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4599,7 +4622,7 @@ impl ServerConfig {
|
|
|
4599
4622
|
})?),
|
|
4600
4623
|
None => None,
|
|
4601
4624
|
},
|
|
4602
|
-
jsonrpc: match kwargs.get(ruby.to_symbol("jsonrpc")) {
|
|
4625
|
+
jsonrpc: match kwargs.get(ruby.to_symbol("jsonrpc")).filter(|v| !v.is_nil()) {
|
|
4603
4626
|
Some(v) => Some(JsonRpcConfig::try_convert(v).map_err(|e| {
|
|
4604
4627
|
magnus::Error::new(
|
|
4605
4628
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4609,7 +4632,7 @@ impl ServerConfig {
|
|
|
4609
4632
|
None => None,
|
|
4610
4633
|
},
|
|
4611
4634
|
#[cfg(not(target_arch = "wasm32"))]
|
|
4612
|
-
grpc: match kwargs.get(ruby.to_symbol("grpc")) {
|
|
4635
|
+
grpc: match kwargs.get(ruby.to_symbol("grpc")).filter(|v| !v.is_nil()) {
|
|
4613
4636
|
Some(v) => Some(GrpcConfig::try_convert(v).map_err(|e| {
|
|
4614
4637
|
magnus::Error::new(
|
|
4615
4638
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4772,7 +4795,7 @@ impl ServerInfo {
|
|
|
4772
4795
|
})?,
|
|
4773
4796
|
None => Default::default(),
|
|
4774
4797
|
},
|
|
4775
|
-
description: match kwargs.get(ruby.to_symbol("description")) {
|
|
4798
|
+
description: match kwargs.get(ruby.to_symbol("description")).filter(|v| !v.is_nil()) {
|
|
4776
4799
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
4777
4800
|
magnus::Error::new(
|
|
4778
4801
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4837,7 +4860,7 @@ impl SseEvent {
|
|
|
4837
4860
|
let (kwargs_opt,) = args.optional;
|
|
4838
4861
|
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
4839
4862
|
Ok(Self {
|
|
4840
|
-
event_type: match kwargs.get(ruby.to_symbol("event_type")) {
|
|
4863
|
+
event_type: match kwargs.get(ruby.to_symbol("event_type")).filter(|v| !v.is_nil()) {
|
|
4841
4864
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
4842
4865
|
magnus::Error::new(
|
|
4843
4866
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4855,7 +4878,7 @@ impl SseEvent {
|
|
|
4855
4878
|
})?,
|
|
4856
4879
|
None => Default::default(),
|
|
4857
4880
|
},
|
|
4858
|
-
id: match kwargs.get(ruby.to_symbol("id")) {
|
|
4881
|
+
id: match kwargs.get(ruby.to_symbol("id")).filter(|v| !v.is_nil()) {
|
|
4859
4882
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
4860
4883
|
magnus::Error::new(
|
|
4861
4884
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -4864,7 +4887,7 @@ impl SseEvent {
|
|
|
4864
4887
|
})?),
|
|
4865
4888
|
None => None,
|
|
4866
4889
|
},
|
|
4867
|
-
retry: match kwargs.get(ruby.to_symbol("retry")) {
|
|
4890
|
+
retry: match kwargs.get(ruby.to_symbol("retry")).filter(|v| !v.is_nil()) {
|
|
4868
4891
|
Some(v) => Some(u64::try_convert(v).map_err(|e| {
|
|
4869
4892
|
magnus::Error::new(
|
|
4870
4893
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -5009,7 +5032,7 @@ impl StaticFilesConfig {
|
|
|
5009
5032
|
})?,
|
|
5010
5033
|
None => true,
|
|
5011
5034
|
},
|
|
5012
|
-
cache_control: match kwargs.get(ruby.to_symbol("cache_control")) {
|
|
5035
|
+
cache_control: match kwargs.get(ruby.to_symbol("cache_control")).filter(|v| !v.is_nil()) {
|
|
5013
5036
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
5014
5037
|
magnus::Error::new(
|
|
5015
5038
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -5042,7 +5065,7 @@ impl StaticFilesConfig {
|
|
|
5042
5065
|
#[derive(Clone)]
|
|
5043
5066
|
#[magnus::wrap(class = "Spikard::TestClient")]
|
|
5044
5067
|
pub struct TestClient {
|
|
5045
|
-
inner: Arc<spikard_http::testing::
|
|
5068
|
+
inner: Arc<spikard_http::testing::TestClient>,
|
|
5046
5069
|
}
|
|
5047
5070
|
|
|
5048
5071
|
#[cfg(not(target_arch = "wasm32"))]
|
|
@@ -5351,7 +5374,7 @@ impl UploadFile {
|
|
|
5351
5374
|
})?,
|
|
5352
5375
|
None => Default::default(),
|
|
5353
5376
|
},
|
|
5354
|
-
content_type: match kwargs.get(ruby.to_symbol("content_type")) {
|
|
5377
|
+
content_type: match kwargs.get(ruby.to_symbol("content_type")).filter(|v| !v.is_nil()) {
|
|
5355
5378
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
5356
5379
|
magnus::Error::new(
|
|
5357
5380
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -5360,7 +5383,7 @@ impl UploadFile {
|
|
|
5360
5383
|
})?),
|
|
5361
5384
|
None => None,
|
|
5362
5385
|
},
|
|
5363
|
-
size: match kwargs.get(ruby.to_symbol("size")) {
|
|
5386
|
+
size: match kwargs.get(ruby.to_symbol("size")).filter(|v| !v.is_nil()) {
|
|
5364
5387
|
Some(v) => Some(usize::try_convert(v).map_err(|e| {
|
|
5365
5388
|
magnus::Error::new(
|
|
5366
5389
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -5378,7 +5401,7 @@ impl UploadFile {
|
|
|
5378
5401
|
})?,
|
|
5379
5402
|
None => Default::default(),
|
|
5380
5403
|
},
|
|
5381
|
-
content_encoding: match kwargs.get(ruby.to_symbol("content_encoding")) {
|
|
5404
|
+
content_encoding: match kwargs.get(ruby.to_symbol("content_encoding")).filter(|v| !v.is_nil()) {
|
|
5382
5405
|
Some(v) => Some(String::try_convert(v).map_err(|e| {
|
|
5383
5406
|
magnus::Error::new(
|
|
5384
5407
|
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
@@ -5640,7 +5663,7 @@ impl ValidationResponse {
|
|
|
5640
5663
|
}
|
|
5641
5664
|
}
|
|
5642
5665
|
|
|
5643
|
-
#[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
|
|
5666
|
+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
5644
5667
|
pub enum LifecycleHookPhase {
|
|
5645
5668
|
OnRequest,
|
|
5646
5669
|
PreValidation,
|
|
@@ -5670,7 +5693,14 @@ impl magnus::IntoValue for LifecycleHookPhase {
|
|
|
5670
5693
|
|
|
5671
5694
|
impl magnus::TryConvert for LifecycleHookPhase {
|
|
5672
5695
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
5673
|
-
|
|
5696
|
+
// IntoValue emits Symbols, including when this enum is a Hash key.
|
|
5697
|
+
// Accept that exact representation as well as String inputs; do not
|
|
5698
|
+
// coerce arbitrary objects through to_s.
|
|
5699
|
+
let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
|
|
5700
|
+
symbol.name()?.into_owned()
|
|
5701
|
+
} else {
|
|
5702
|
+
magnus::TryConvert::try_convert(val)?
|
|
5703
|
+
};
|
|
5674
5704
|
// Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
|
|
5675
5705
|
// emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
|
|
5676
5706
|
// existing consumer code written in any of those styles keep working.
|
|
@@ -5691,7 +5721,7 @@ impl magnus::TryConvert for LifecycleHookPhase {
|
|
|
5691
5721
|
unsafe impl IntoValueFromNative for LifecycleHookPhase {}
|
|
5692
5722
|
unsafe impl TryConvertOwned for LifecycleHookPhase {}
|
|
5693
5723
|
|
|
5694
|
-
#[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
|
|
5724
|
+
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, serde::Serialize, serde::Deserialize)]
|
|
5695
5725
|
pub enum Method {
|
|
5696
5726
|
Get,
|
|
5697
5727
|
Post,
|
|
@@ -5729,7 +5759,14 @@ impl magnus::IntoValue for Method {
|
|
|
5729
5759
|
|
|
5730
5760
|
impl magnus::TryConvert for Method {
|
|
5731
5761
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
5732
|
-
|
|
5762
|
+
// IntoValue emits Symbols, including when this enum is a Hash key.
|
|
5763
|
+
// Accept that exact representation as well as String inputs; do not
|
|
5764
|
+
// coerce arbitrary objects through to_s.
|
|
5765
|
+
let s: String = if let Some(symbol) = magnus::Symbol::from_value(val) {
|
|
5766
|
+
symbol.name()?.into_owned()
|
|
5767
|
+
} else {
|
|
5768
|
+
magnus::TryConvert::try_convert(val)?
|
|
5769
|
+
};
|
|
5733
5770
|
// Accept the real serde wire value, the legacy always-snake_case symbol Magnus used to
|
|
5734
5771
|
// emit unconditionally, and the verbatim PascalCase Rust variant name, so fixtures and
|
|
5735
5772
|
// existing consumer code written in any of those styles keep working.
|
|
@@ -5787,7 +5824,8 @@ impl magnus::IntoValue for SecuritySchemeInfo {
|
|
|
5787
5824
|
|
|
5788
5825
|
impl magnus::TryConvert for SecuritySchemeInfo {
|
|
5789
5826
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
5790
|
-
//
|
|
5827
|
+
// Generated Data variants carry native DTOs, not JSON-compatible display strings.
|
|
5828
|
+
let class_name: Option<String> = val.class().funcall("name", ())?; // For data enums with fields (e.g., PageAction), try to deserialize from JSON first.
|
|
5791
5829
|
// For unit enums or when passed as a string, fall back to string-based conversion.
|
|
5792
5830
|
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
5793
5831
|
s
|
|
@@ -5819,17 +5857,18 @@ impl magnus::TryConvert for SecuritySchemeInfo {
|
|
|
5819
5857
|
|
|
5820
5858
|
unsafe impl IntoValueFromNative for SecuritySchemeInfo {}
|
|
5821
5859
|
unsafe impl TryConvertOwned for SecuritySchemeInfo {}
|
|
5860
|
+
|
|
5822
5861
|
impl SecuritySchemeInfo {}
|
|
5823
5862
|
|
|
5824
5863
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
5825
5864
|
pub enum SnapshotError {
|
|
5826
|
-
InvalidHeader
|
|
5827
|
-
Decompression
|
|
5865
|
+
InvalidHeader(String),
|
|
5866
|
+
Decompression(String),
|
|
5828
5867
|
}
|
|
5829
5868
|
|
|
5830
5869
|
impl Default for SnapshotError {
|
|
5831
5870
|
fn default() -> Self {
|
|
5832
|
-
Self::InvalidHeader
|
|
5871
|
+
Self::InvalidHeader(Default::default())
|
|
5833
5872
|
}
|
|
5834
5873
|
}
|
|
5835
5874
|
|
|
@@ -5878,16 +5917,16 @@ unsafe impl TryConvertOwned for SnapshotError {}
|
|
|
5878
5917
|
|
|
5879
5918
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
5880
5919
|
pub enum WebSocketMessage {
|
|
5881
|
-
Text
|
|
5882
|
-
Binary
|
|
5920
|
+
Text(String),
|
|
5921
|
+
Binary(Vec<u8>),
|
|
5883
5922
|
Close { code: u16, reason: Option<String> },
|
|
5884
|
-
Ping
|
|
5885
|
-
Pong
|
|
5923
|
+
Ping(Vec<u8>),
|
|
5924
|
+
Pong(Vec<u8>),
|
|
5886
5925
|
}
|
|
5887
5926
|
|
|
5888
5927
|
impl Default for WebSocketMessage {
|
|
5889
5928
|
fn default() -> Self {
|
|
5890
|
-
Self::Text
|
|
5929
|
+
Self::Text(Default::default())
|
|
5891
5930
|
}
|
|
5892
5931
|
}
|
|
5893
5932
|
|
|
@@ -6225,7 +6264,7 @@ impl From<spikard::FullSchemaConfig> for FullSchemaConfig {
|
|
|
6225
6264
|
#[cfg(not(target_arch = "wasm32"))]
|
|
6226
6265
|
#[allow(clippy::needless_update)]
|
|
6227
6266
|
#[allow(clippy::redundant_closure)]
|
|
6228
|
-
impl From<GraphQLSubscriptionSnapshot> for spikard_http::testing::
|
|
6267
|
+
impl From<GraphQLSubscriptionSnapshot> for spikard_http::testing::GraphQLSubscriptionSnapshot {
|
|
6229
6268
|
fn from(val: GraphQLSubscriptionSnapshot) -> Self {
|
|
6230
6269
|
Self {
|
|
6231
6270
|
operation_id: val.operation_id,
|
|
@@ -6243,8 +6282,8 @@ impl From<GraphQLSubscriptionSnapshot> for spikard_http::testing::test_client::G
|
|
|
6243
6282
|
}
|
|
6244
6283
|
|
|
6245
6284
|
#[cfg(not(target_arch = "wasm32"))]
|
|
6246
|
-
impl From<spikard_http::testing::
|
|
6247
|
-
fn from(val: spikard_http::testing::
|
|
6285
|
+
impl From<spikard_http::testing::GraphQLSubscriptionSnapshot> for GraphQLSubscriptionSnapshot {
|
|
6286
|
+
fn from(val: spikard_http::testing::GraphQLSubscriptionSnapshot) -> Self {
|
|
6248
6287
|
Self {
|
|
6249
6288
|
operation_id: val.operation_id.to_string(),
|
|
6250
6289
|
acknowledged: val.acknowledged,
|
|
@@ -6988,8 +7027,8 @@ impl From<spikard_http::SecuritySchemeInfo> for SecuritySchemeInfo {
|
|
|
6988
7027
|
impl From<spikard_http::SnapshotError> for SnapshotError {
|
|
6989
7028
|
fn from(val: spikard_http::SnapshotError) -> Self {
|
|
6990
7029
|
match val {
|
|
6991
|
-
spikard_http::SnapshotError::InvalidHeader(_0) => Self::InvalidHeader
|
|
6992
|
-
spikard_http::SnapshotError::Decompression(_0) => Self::Decompression
|
|
7030
|
+
spikard_http::SnapshotError::InvalidHeader(_0) => Self::InvalidHeader(_0),
|
|
7031
|
+
spikard_http::SnapshotError::Decompression(_0) => Self::Decompression(_0),
|
|
6993
7032
|
}
|
|
6994
7033
|
}
|
|
6995
7034
|
}
|
|
@@ -6998,14 +7037,14 @@ impl From<spikard_http::SnapshotError> for SnapshotError {
|
|
|
6998
7037
|
impl From<spikard_http::testing::WebSocketMessage> for WebSocketMessage {
|
|
6999
7038
|
fn from(val: spikard_http::testing::WebSocketMessage) -> Self {
|
|
7000
7039
|
match val {
|
|
7001
|
-
spikard_http::testing::WebSocketMessage::Text(_0) => Self::Text
|
|
7002
|
-
spikard_http::testing::WebSocketMessage::Binary(_0) => Self::Binary
|
|
7040
|
+
spikard_http::testing::WebSocketMessage::Text(_0) => Self::Text(_0),
|
|
7041
|
+
spikard_http::testing::WebSocketMessage::Binary(_0) => Self::Binary(_0.to_vec().into()),
|
|
7003
7042
|
spikard_http::testing::WebSocketMessage::Close { code, reason } => Self::Close {
|
|
7004
7043
|
code,
|
|
7005
7044
|
reason: reason.map(|v| v.to_string()),
|
|
7006
7045
|
},
|
|
7007
|
-
spikard_http::testing::WebSocketMessage::Ping(_0) => Self::Ping
|
|
7008
|
-
spikard_http::testing::WebSocketMessage::Pong(_0) => Self::Pong
|
|
7046
|
+
spikard_http::testing::WebSocketMessage::Ping(_0) => Self::Ping(_0.to_vec().into()),
|
|
7047
|
+
spikard_http::testing::WebSocketMessage::Pong(_0) => Self::Pong(_0.to_vec().into()),
|
|
7009
7048
|
}
|
|
7010
7049
|
}
|
|
7011
7050
|
}
|
|
@@ -7017,9 +7056,9 @@ fn app_error_to_magnus_err(e: spikard::AppError) -> magnus::Error {
|
|
|
7017
7056
|
magnus::Error::new(unsafe { magnus::Ruby::get_unchecked() }.exception_runtime_error(), msg)
|
|
7018
7057
|
}
|
|
7019
7058
|
|
|
7020
|
-
/// Convert a `spikard_graphql::
|
|
7059
|
+
/// Convert a `spikard_graphql::GraphQLError` error to a Magnus runtime error.
|
|
7021
7060
|
#[allow(dead_code)]
|
|
7022
|
-
fn graph_ql_error_to_magnus_err(e: spikard_graphql::
|
|
7061
|
+
fn graph_ql_error_to_magnus_err(e: spikard_graphql::GraphQLError) -> magnus::Error {
|
|
7023
7062
|
let msg = e.to_string();
|
|
7024
7063
|
magnus::Error::new(unsafe { magnus::Ruby::get_unchecked() }.exception_runtime_error(), msg)
|
|
7025
7064
|
}
|
|
@@ -7032,7 +7071,7 @@ pub struct GraphQLErrorInfo {
|
|
|
7032
7071
|
}
|
|
7033
7072
|
|
|
7034
7073
|
#[allow(dead_code)]
|
|
7035
|
-
fn graph_ql_error_info(e: &spikard_graphql::
|
|
7074
|
+
fn graph_ql_error_info(e: &spikard_graphql::GraphQLError) -> GraphQLErrorInfo {
|
|
7036
7075
|
GraphQLErrorInfo {
|
|
7037
7076
|
status_code: e.status_code(),
|
|
7038
7077
|
is_transient: e.is_transient(),
|
|
@@ -7057,9 +7096,9 @@ impl GraphQLErrorInfo {
|
|
|
7057
7096
|
}
|
|
7058
7097
|
}
|
|
7059
7098
|
|
|
7060
|
-
/// Convert a `spikard_graphql::
|
|
7099
|
+
/// Convert a `spikard_graphql::SchemaError` error to a Magnus runtime error.
|
|
7061
7100
|
#[allow(dead_code)]
|
|
7062
|
-
fn schema_error_to_magnus_err(e: spikard_graphql::
|
|
7101
|
+
fn schema_error_to_magnus_err(e: spikard_graphql::SchemaError) -> magnus::Error {
|
|
7063
7102
|
let msg = e.to_string();
|
|
7064
7103
|
magnus::Error::new(unsafe { magnus::Ruby::get_unchecked() }.exception_runtime_error(), msg)
|
|
7065
7104
|
}
|
|
@@ -7289,6 +7328,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
|
7289
7328
|
method!(GrpcConfig::max_stream_response_bytes, 0),
|
|
7290
7329
|
)?;
|
|
7291
7330
|
|
|
7331
|
+
let class = module.define_class("HookRegistry", ruby.class_object())?;
|
|
7332
|
+
|
|
7292
7333
|
let class = module.define_class("JsonRpcConfig", ruby.class_object())?;
|
|
7293
7334
|
|
|
7294
7335
|
class.define_singleton_method("new", function!(JsonRpcConfig::new, -1))?;
|