spikard 0.16.0 → 0.17.0.pre.rc.1
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/README.md +67 -54
- data/ext/spikard_rb/native/Cargo.lock +11 -9
- data/ext/spikard_rb/native/Cargo.toml +5 -5
- data/ext/spikard_rb/src/lib.rs +278 -4
- data/lib/spikard/app.rb +338 -0
- data/lib/spikard/introspection.rb +165 -0
- data/lib/spikard/native.rb +16 -8
- data/lib/spikard/params.rb +139 -0
- data/lib/spikard/service.rb +15 -0
- data/lib/spikard/service_http_additions.rb +41 -35
- data/lib/spikard/version.rb +2 -2
- data/lib/spikard.rb +5 -1
- data/lib/spikard_rb.so +0 -0
- data/sig/types.rbs +269 -249
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2c70b591ea6a27df4ec1f4b3b8dfd349b9d63f7ec7bcd374b8161f4991030ac9
|
|
4
|
+
data.tar.gz: f38aa7abff1e4b77dee6567d44b71a7d34c1478ec19138ecd487973716e0a920
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e1143967742d18de4f9c9de94d6b32f0ed0f6d3eb644f52fb76968f78ae310edceccd8ca9711a63b1d7340822a340aad12ecb363047bb9fb4733e3a47b990999
|
|
7
|
+
data.tar.gz: 367367ee84b8e18f96c97eb65631728491de01521a294bd5d2e6db8fa47c023aa34cb9cdec2b1caa19a8c55b04002718d11ce37fc63cd3171a39445de7f765ac
|
data/README.md
CHANGED
|
@@ -1,85 +1,89 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- markdownlint-disable MD033 MD041 -->
|
|
2
|
+
<div align="center">
|
|
3
|
+
|
|
4
|
+
<img src="https://raw.githubusercontent.com/Goldziher/spikard/main/docs/assets/spikard-banner.svg" alt="spikard - polyglot web toolkit" width="820">
|
|
5
|
+
|
|
6
|
+
**Spikard** — Part of the spikard polyglot web toolkit.
|
|
7
|
+
|
|
8
|
+
Rust-centric polyglot HTTP framework with OpenAPI/AsyncAPI/GraphQL/JSON-RPC codegen, tower-http middleware, and fixture-driven cross-language testing. Ruby bindings via Magnus with idiomatic Ruby API.
|
|
2
9
|
|
|
3
10
|
<div align="center" style="display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0;">
|
|
4
|
-
<!-- Built with -->
|
|
5
|
-
<a href="https://github.com/
|
|
6
|
-
<img src="https://img.shields.io/badge/
|
|
11
|
+
<!-- Built with alef -->
|
|
12
|
+
<a href="https://github.com/xberg-io/alef">
|
|
13
|
+
<img src="https://img.shields.io/badge/built%20with-alef%20%D7%90-007ec6?style=flat-square" alt="Built with alef">
|
|
7
14
|
</a>
|
|
8
15
|
|
|
9
|
-
<!-- Language
|
|
16
|
+
<!-- Language bindings -->
|
|
10
17
|
<a href="https://crates.io/crates/spikard">
|
|
11
|
-
<img src="https://img.shields.io/crates/v/spikard?
|
|
18
|
+
<img src="https://img.shields.io/crates/v/spikard?color=007ec6&style=flat-square" alt="Rust">
|
|
12
19
|
</a>
|
|
13
20
|
<a href="https://pypi.org/project/spikard/">
|
|
14
|
-
<img src="https://img.shields.io/pypi/v/spikard?
|
|
21
|
+
<img src="https://img.shields.io/pypi/v/spikard?color=007ec6&style=flat-square" alt="Python">
|
|
15
22
|
</a>
|
|
16
23
|
<a href="https://www.npmjs.com/package/@spikard/node">
|
|
17
|
-
<img src="https://img.shields.io/npm/v/@spikard/node?
|
|
24
|
+
<img src="https://img.shields.io/npm/v/@spikard/node?color=007ec6&style=flat-square" alt="Node.js">
|
|
18
25
|
</a>
|
|
19
26
|
<a href="https://www.npmjs.com/package/@spikard/node-wasm">
|
|
20
|
-
<img src="https://img.shields.io/npm/v/@spikard/node-wasm?
|
|
27
|
+
<img src="https://img.shields.io/npm/v/@spikard/node-wasm?color=007ec6&style=flat-square" alt="WASM">
|
|
21
28
|
</a>
|
|
22
29
|
<a href="https://rubygems.org/gems/spikard">
|
|
23
|
-
<img src="https://img.shields.io/gem/v/spikard?
|
|
30
|
+
<img src="https://img.shields.io/gem/v/spikard?color=007ec6&style=flat-square" alt="Ruby">
|
|
24
31
|
</a>
|
|
25
32
|
<a href="https://packagist.org/packages/goldziher/spikard">
|
|
26
|
-
<img src="https://img.shields.io/packagist/v/goldziher/spikard?
|
|
33
|
+
<img src="https://img.shields.io/packagist/v/goldziher/spikard?color=007ec6&style=flat-square" alt="PHP">
|
|
27
34
|
</a>
|
|
28
35
|
<a href="https://hex.pm/packages/spikard">
|
|
29
|
-
<img src="https://img.shields.io/hexpm/v/spikard?
|
|
36
|
+
<img src="https://img.shields.io/hexpm/v/spikard?color=007ec6&style=flat-square" alt="Elixir">
|
|
30
37
|
</a>
|
|
31
38
|
<a href="https://central.sonatype.com/artifact/dev.spikard/spikard">
|
|
32
|
-
<img src="https://img.shields.io/maven-central/v/dev.spikard/spikard?
|
|
39
|
+
<img src="https://img.shields.io/maven-central/v/dev.spikard/spikard?color=007ec6&style=flat-square" alt="Java">
|
|
33
40
|
</a>
|
|
34
41
|
<a href="https://github.com/Goldziher/spikard/releases">
|
|
35
|
-
<img src="https://img.shields.io/github/v/tag/Goldziher/spikard?label=Go&color=007ec6" alt="Go">
|
|
42
|
+
<img src="https://img.shields.io/github/v/tag/Goldziher/spikard?label=Go&color=007ec6&style=flat-square" alt="Go">
|
|
36
43
|
</a>
|
|
37
44
|
<a href="https://www.nuget.org/packages/Spikard/">
|
|
38
|
-
<img src="https://img.shields.io/nuget/v/Spikard?
|
|
45
|
+
<img src="https://img.shields.io/nuget/v/Spikard?color=007ec6&style=flat-square" alt="C#">
|
|
39
46
|
</a>
|
|
40
47
|
<a href="https://central.sonatype.com/artifact/dev.spikard/spikard">
|
|
41
|
-
<img src="https://img.shields.io/maven-central/v/dev.spikard/spikard?label=Kotlin&color=007ec6" alt="Kotlin">
|
|
48
|
+
<img src="https://img.shields.io/maven-central/v/dev.spikard/spikard?label=Kotlin&color=007ec6&style=flat-square" alt="Kotlin">
|
|
42
49
|
</a>
|
|
43
50
|
<a href="https://pub.dev/packages/spikard">
|
|
44
|
-
<img src="https://img.shields.io/pub/v/spikard?
|
|
51
|
+
<img src="https://img.shields.io/pub/v/spikard?color=007ec6&style=flat-square" alt="Dart">
|
|
45
52
|
</a>
|
|
46
53
|
<a href="https://github.com/Goldziher/spikard/tree/main/packages/swift">
|
|
47
|
-
<img src="https://img.shields.io/badge/Swift-Spikard-007ec6" alt="Swift">
|
|
54
|
+
<img src="https://img.shields.io/badge/Swift-Spikard-007ec6?style=flat-square" alt="Swift">
|
|
48
55
|
</a>
|
|
49
56
|
<a href="https://github.com/Goldziher/spikard/tree/main/packages/zig">
|
|
50
|
-
<img src="https://img.shields.io/badge/Zig-spikard-007ec6" alt="Zig">
|
|
57
|
+
<img src="https://img.shields.io/badge/Zig-spikard-007ec6?style=flat-square" alt="Zig">
|
|
51
58
|
</a>
|
|
52
59
|
<a href="https://github.com/Goldziher/spikard/tree/main/crates/spikard-ffi">
|
|
53
|
-
<img src="https://img.shields.io/badge/C-
|
|
60
|
+
<img src="https://img.shields.io/badge/C%20FFI-007ec6?style=flat-square" alt="C FFI">
|
|
54
61
|
</a>
|
|
55
62
|
<a href="https://github.com/Goldziher/homebrew-tap">
|
|
56
|
-
<img src="https://img.shields.io/badge/Homebrew-007ec6?logo=homebrew&logoColor=white" alt="Homebrew">
|
|
63
|
+
<img src="https://img.shields.io/badge/Homebrew-007ec6?style=flat-square&logo=homebrew&logoColor=white" alt="Homebrew">
|
|
57
64
|
</a>
|
|
58
65
|
|
|
59
|
-
<!-- Project
|
|
66
|
+
<!-- Project info -->
|
|
60
67
|
<a href="https://github.com/Goldziher/spikard/blob/main/LICENSE">
|
|
61
|
-
<img src="https://img.shields.io/badge/License-MIT-007ec6" alt="License">
|
|
62
|
-
</a>
|
|
63
|
-
<a href="https://github.com/Goldziher/spikard/tree/main/docs">
|
|
64
|
-
<img src="https://img.shields.io/badge/Docs-spikard-007ec6" alt="Documentation">
|
|
68
|
+
<img src="https://img.shields.io/badge/License-MIT-007ec6?style=flat-square" alt="License">
|
|
65
69
|
</a>
|
|
66
70
|
</div>
|
|
67
71
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
<img height="22" src="https://img.shields.io/badge/Discord-Chat-007ec6?logo=discord&logoColor=white" alt="Join Discord">
|
|
71
|
-
</a>
|
|
72
|
+
[Install](#installation) · [Quick example](#quick-example) · [Features](#features) · [Docs](https://github.com/Goldziher/spikard)
|
|
73
|
+
|
|
72
74
|
</div>
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
---
|
|
75
77
|
|
|
76
|
-
## What
|
|
78
|
+
## What this package provides
|
|
77
79
|
|
|
78
|
-
- **
|
|
79
|
-
|
|
80
|
-
- **
|
|
81
|
-
- **
|
|
82
|
-
- **
|
|
80
|
+
- **Magnus-backed native extension** — Ruby 3.2+ with native performance for routing and validation
|
|
81
|
+
|
|
82
|
+
- **Type-safe routing** — HTTP definitions with path, query, body, and header validation across all bindings
|
|
83
|
+
- **Spec-driven codegen** — OpenAPI 3.0, AsyncAPI 3.0, GraphQL SDL, and JSON-RPC 2.0 support
|
|
84
|
+
- **Cross-language parity** — same DTOs, fixtures, and error model prevent runtime drift
|
|
85
|
+
- **Tower middleware** — compression, rate limiting, timeouts, auth (JWT/API key), static files
|
|
86
|
+
- **Lifecycle hooks** — `onRequest`, `preValidation`, `preHandler`, `onResponse`, `onError`
|
|
83
87
|
|
|
84
88
|
## Installation
|
|
85
89
|
|
|
@@ -99,7 +103,7 @@ gem 'spikard'
|
|
|
99
103
|
|
|
100
104
|
- **Ruby 3.2+** required
|
|
101
105
|
|
|
102
|
-
## Quick
|
|
106
|
+
## Quick example
|
|
103
107
|
|
|
104
108
|
```ruby
|
|
105
109
|
require "spikard"
|
|
@@ -120,14 +124,19 @@ app.run(config: { port: 8000 })
|
|
|
120
124
|
|
|
121
125
|
## Features
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
| Feature | Support |
|
|
128
|
+
|---|---|
|
|
129
|
+
| **Type-safe routing** | Path, query, body, and header parameter validation |
|
|
130
|
+
| **Request extraction** | Typed structs for JSON, form data, multipart, and raw bodies |
|
|
131
|
+
| **Spec support** | OpenAPI 3.0 · AsyncAPI 3.0 · GraphQL SDL · JSON-RPC 2.0 |
|
|
132
|
+
| **Middleware** | Compression, rate limiting, timeouts, authentication, static files |
|
|
133
|
+
| **Lifecycle hooks** | Request, pre-validation, pre-handler, response, and error hooks |
|
|
134
|
+
| **WebSocket & SSE** | Bidirectional streams and server-sent events |
|
|
135
|
+
| **Error handling** | Consistent error responses across all bindings via ProblemDetails |
|
|
136
|
+
| **Fixture testing** | Shared JSON fixtures for behavioral consistency across languages |
|
|
129
137
|
|
|
130
|
-
|
|
138
|
+
<details>
|
|
139
|
+
<summary><strong>Routing</strong></summary>
|
|
131
140
|
|
|
132
141
|
```ruby
|
|
133
142
|
require "spikard"
|
|
@@ -138,7 +147,10 @@ app.get("/health") { |_params, _query, _body| { status: "ok" } }
|
|
|
138
147
|
app.post("/users") { |_params, _query, body| body }
|
|
139
148
|
```
|
|
140
149
|
|
|
141
|
-
|
|
150
|
+
</details>
|
|
151
|
+
|
|
152
|
+
<details>
|
|
153
|
+
<summary><strong>Validation</strong></summary>
|
|
142
154
|
|
|
143
155
|
```ruby
|
|
144
156
|
require "spikard"
|
|
@@ -155,7 +167,10 @@ app.post("/payments") do |_params, _query, body|
|
|
|
155
167
|
end
|
|
156
168
|
```
|
|
157
169
|
|
|
158
|
-
|
|
170
|
+
</details>
|
|
171
|
+
|
|
172
|
+
<details>
|
|
173
|
+
<summary><strong>Middleware & configuration</strong></summary>
|
|
159
174
|
|
|
160
175
|
```ruby
|
|
161
176
|
require "spikard"
|
|
@@ -168,15 +183,13 @@ app.on_request do |request|
|
|
|
168
183
|
end
|
|
169
184
|
```
|
|
170
185
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
- **[Repository](https://github.com/Goldziher/spikard)** — source code, examples, and contributing guide
|
|
174
|
-
- **[Examples](https://github.com/Goldziher/spikard/tree/main/crates/spikard-http/examples)** — working server examples
|
|
175
|
-
- **[Issues](https://github.com/Goldziher/spikard/issues)** — bug reports and feature requests
|
|
186
|
+
</details>
|
|
176
187
|
|
|
177
|
-
##
|
|
188
|
+
## Resources
|
|
178
189
|
|
|
179
|
-
|
|
190
|
+
- **[Repository](https://github.com/Goldziher/spikard)** — source code, examples, and issues
|
|
191
|
+
- **[Examples](https://github.com/Goldziher/spikard/tree/main/crates/spikard-http/examples)** — working implementations in all supported languages
|
|
192
|
+
- **[Contributing](https://github.com/Goldziher/spikard/blob/main/CONTRIBUTING.md)** — how to contribute
|
|
180
193
|
|
|
181
194
|
## License
|
|
182
195
|
|
|
@@ -3084,11 +3084,12 @@ dependencies = [
|
|
|
3084
3084
|
|
|
3085
3085
|
[[package]]
|
|
3086
3086
|
name = "spikard"
|
|
3087
|
-
version = "0.
|
|
3087
|
+
version = "0.17.0-rc.1"
|
|
3088
3088
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3089
|
-
checksum = "
|
|
3089
|
+
checksum = "ed92ef402b2f345fd29d2a8a2985a8118494284358a7ccfffc40370e24a31afb"
|
|
3090
3090
|
dependencies = [
|
|
3091
3091
|
"anyhow",
|
|
3092
|
+
"async-graphql",
|
|
3092
3093
|
"axum",
|
|
3093
3094
|
"axum-test",
|
|
3094
3095
|
"base64",
|
|
@@ -3104,9 +3105,9 @@ dependencies = [
|
|
|
3104
3105
|
|
|
3105
3106
|
[[package]]
|
|
3106
3107
|
name = "spikard-core"
|
|
3107
|
-
version = "0.
|
|
3108
|
+
version = "0.17.0-rc.1"
|
|
3108
3109
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3109
|
-
checksum = "
|
|
3110
|
+
checksum = "f8bf6a0d9e169d9364533851d319d0423935f097f199bf79bbf0a72bd97f9626"
|
|
3110
3111
|
dependencies = [
|
|
3111
3112
|
"anyhow",
|
|
3112
3113
|
"base64",
|
|
@@ -3130,11 +3131,12 @@ dependencies = [
|
|
|
3130
3131
|
|
|
3131
3132
|
[[package]]
|
|
3132
3133
|
name = "spikard-graphql"
|
|
3133
|
-
version = "0.
|
|
3134
|
+
version = "0.17.0-rc.1"
|
|
3134
3135
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3135
|
-
checksum = "
|
|
3136
|
+
checksum = "8794a34de3eb8879f3614eed484006904cff9341d3b608fc6207bfda53170aff"
|
|
3136
3137
|
dependencies = [
|
|
3137
3138
|
"async-graphql",
|
|
3139
|
+
"async-graphql-parser",
|
|
3138
3140
|
"axum",
|
|
3139
3141
|
"bytes",
|
|
3140
3142
|
"futures",
|
|
@@ -3151,9 +3153,9 @@ dependencies = [
|
|
|
3151
3153
|
|
|
3152
3154
|
[[package]]
|
|
3153
3155
|
name = "spikard-http"
|
|
3154
|
-
version = "0.
|
|
3156
|
+
version = "0.17.0-rc.1"
|
|
3155
3157
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3156
|
-
checksum = "
|
|
3158
|
+
checksum = "7f66529f82b9680ceb142e52ad5da732258cafe92f2999d9f49e9d8678847c0e"
|
|
3157
3159
|
dependencies = [
|
|
3158
3160
|
"ahash",
|
|
3159
3161
|
"anyhow",
|
|
@@ -3206,7 +3208,7 @@ dependencies = [
|
|
|
3206
3208
|
|
|
3207
3209
|
[[package]]
|
|
3208
3210
|
name = "spikard-rb"
|
|
3209
|
-
version = "0.
|
|
3211
|
+
version = "0.17.0-rc.1"
|
|
3210
3212
|
dependencies = [
|
|
3211
3213
|
"magnus",
|
|
3212
3214
|
"rb-sys",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "spikard-rb"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.17.0-rc.1"
|
|
4
4
|
edition = "2024"
|
|
5
5
|
license = "MIT"
|
|
6
6
|
description = "Rust-centric multi-language HTTP framework with polyglot bindings"
|
|
@@ -25,8 +25,8 @@ magnus = "0.8"
|
|
|
25
25
|
rb-sys = ">=0.9, <0.9.128"
|
|
26
26
|
serde = { version = "1", features = ["derive"] }
|
|
27
27
|
serde_json = "1"
|
|
28
|
-
spikard = { version = "0.
|
|
29
|
-
spikard-core = { version = "0.
|
|
30
|
-
spikard-graphql = { version = "0.
|
|
31
|
-
spikard-http = { version = "0.
|
|
28
|
+
spikard = { version = "0.17.0-rc.1", features = ["di"] }
|
|
29
|
+
spikard-core = { version = "0.17.0-rc.1" }
|
|
30
|
+
spikard-graphql = { version = "0.17.0-rc.1" }
|
|
31
|
+
spikard-http = { version = "0.17.0-rc.1" }
|
|
32
32
|
tokio = { version = "1", features = ["rt-multi-thread"] }
|