Skip to content

Commit 7469f9d

Browse files
authored
Merge pull request #45 from ProbablyClem/feature/utoipa-v5
V0.2.0 preparation / Utoipa v5 support
2 parents b7d8525 + b7e3d4e commit 7469f9d

File tree

38 files changed

+821
-911
lines changed

38 files changed

+821
-911
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ max_line_length = 120
1919
trim_trailing_whitespace = false
2020

2121
[{*.yml,*.yaml}]
22-
indent_size = 2
22+
indent_size = 2

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
rust: [ "1.74.0", "stable", "nightly" ]
18+
rust: [ "1.75.0", "stable", "nightly" ]
1919
steps:
2020
- uses: actions/checkout@v4
2121
- name: install toolchain

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolver = "2"
44

55
[workspace.package]
66
authors = ["ProbablyClem", "RxDiscovery", "DenuxPlays"]
7-
version = "0.1.14"
7+
version = "0.2.0"
88
edition = "2021"
99
keywords = ["utoipa", "openapi", "swagger", "path", "auto"]
1010
description = "Rust Macros to automate the addition of Paths/Schemas to Utoipa crate, simulating Reflection during the compilation phase"
@@ -17,15 +17,15 @@ license = "MIT OR Apache-2.0"
1717
readme = "README.md"
1818
repository = "https://github.com/ProbablyClem/utoipauto"
1919
homepage = "https://github.com/ProbablyClem/utoipauto"
20-
rust-version = "1.74.0"
20+
rust-version = "1.75.0"
2121

2222
[workspace.dependencies]
2323
# Core dependencies
24-
utoipauto-core = { path = "utoipauto-core", version = "0.1" }
25-
utoipauto-macro = { path = "utoipauto-macro", version = "0.1" }
24+
utoipauto-core = { path = "utoipauto-core", version = "0.2" }
25+
utoipauto-macro = { path = "utoipauto-macro", version = "0.2" }
2626

2727
# Utoipa
28-
utoipa = { version = "4.2.3", features = ["preserve_path_order"] }
28+
utoipa = { version = "5.0.0", features = ["preserve_path_order"] }
2929

3030
# Macro dependencies
3131
quote = "1.0.36"

README.md

Lines changed: 20 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -95,33 +95,6 @@ The paths receives a String which must respect this structure :
9595

9696
You can add several paths by separating them with a coma `","`.
9797

98-
## Support for generic schemas
99-
100-
We support generic schemas, but with a few drawbacks.
101-
<br>
102-
If you want to use generics, you have three ways to do it.
103-
104-
1. use the full path
105-
106-
```rust
107-
#[aliases(GenericSchema = path::to::Generic<path::to::Schema>)]
108-
```
109-
110-
2. Import where utoipauto lives
111-
112-
```rust
113-
use path::to::schema;
114-
```
115-
116-
3. use `generic_full_path` feature
117-
118-
Please keep in mind that this feature causes more build-time overhead.
119-
Higher RAM usage, longer compile times and excessive disk usage (especially on larger projects) are the consequences.
120-
121-
```toml
122-
utoipauto = { version = "*", feature = ["generic_full_path"] }
123-
```
124-
12598
## Usage with workspaces
12699

127100
If you are using a workspace, you must specify the name of the crate in the path.
@@ -174,8 +147,8 @@ Here's an example of how to add all the methods and structs contained in the res
174147
use utoipauto::utoipauto;
175148

176149
#[utoipauto(
177-
paths = "./src/rest"
178-
)]
150+
paths = "./src/rest"
151+
)]
179152
#[derive(OpenApi)]
180153
#[openapi(
181154
tags(
@@ -195,8 +168,8 @@ Here's an example of how to add all methods and structs contained in the rest mo
195168
use utoipauto::utoipauto;
196169

197170
#[utoipauto(
198-
paths = "(./src/lib/rest from crate::rest)"
199-
)]
171+
paths = "(./src/lib/rest from crate::rest)"
172+
)]
200173
#[derive(OpenApi)]
201174
#[openapi(
202175
tags(
@@ -220,8 +193,8 @@ other_controller::get_users", and a schema "TestDTO".
220193
use utoipauto::utoipauto;
221194

222195
#[utoipauto(
223-
paths = "./src/rest/test_controller.rs,./src/rest/test2_controller.rs "
224-
)]
196+
paths = "./src/rest/test_controller.rs,./src/rest/test2_controller.rs "
197+
)]
225198
#[derive(OpenApi)]
226199
#[openapi(
227200
paths(
@@ -251,17 +224,17 @@ ex:
251224

252225
```rust
253226
/// Get all pets from database
254-
///
255-
#[utoipa_ignore] //<============== this Macro
256-
#[utoipa::path(
257-
responses(
227+
///
228+
#[utoipa_ignore] //<============== this Macro
229+
#[utoipa::path(
230+
responses(
258231
(status = 200, description = "List all Pets", body = [ListPetsDTO])
259-
)
260-
)]
261-
#[get("/pets")]
262-
async fn get_all_pets(req: HttpRequest, store: web::Data<AppState>) -> impl Responder {
263-
// your CODE
264-
}
232+
)
233+
)]
234+
#[get("/pets")]
235+
async fn get_all_pets(req: HttpRequest, store: web::Data<AppState>) -> impl Responder {
236+
// your CODE
237+
}
265238

266239
```
267240

@@ -273,10 +246,10 @@ ex:
273246

274247
```rust
275248
#[utoipa_ignore] //<============== this Macro
276-
#[derive(ToSchema)]
277-
struct ModelToIgnore {
278-
// your CODE
279-
}
249+
#[derive(ToSchema)]
250+
struct ModelToIgnore {
251+
// your CODE
252+
}
280253

281254
```
282255

@@ -324,11 +297,3 @@ Contributions are welcomed, feel free to submit a PR or an issue.
324297
## Inspiration
325298

326299
Inspired by [utoipa_auto_discovery](https://github.com/rxdiscovery/utoipa_auto_discovery)
327-
328-
```
329-
330-
```
331-
332-
```
333-
334-
```

acceptance/Cargo.lock

Lines changed: 54 additions & 69 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)