Skip to content

Commit 3cd1eae

Browse files
authored
improve docs and uuid version handling (#65)
1 parent d344186 commit 3cd1eae

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,19 @@ Similarly if there is a `format` field set to `uuid`:
4444

4545
```diff
4646
[dependencies]
47-
+uuid = { version = "0.8", features = ["serde", "v4"] }
47+
+uuid = { version = "1.0.0", features = ["serde", "v4"] }
48+
```
49+
50+
The macro has some additional fancy options to control the generated code:
51+
52+
```rust
53+
generate_api!(
54+
spec = "path/to/openapi_document.json", // The OpenAPI document
55+
inner_type = my_client::InnerType, // Client inner type available to pre and post hooks
56+
pre_hook = closure::or::path::to::function, // Hook invoked before issuing the HTTP request
57+
post_hook = closure::or::path::to::function, // Hook invoked prior to receiving the HTTP response
58+
derives = [ schemars::JsonSchema ], // Additional derive macros applied to generated types
59+
);
4860
```
4961

5062
Note that the macro will be re-evaluated when the OpenAPI json document
@@ -135,7 +147,7 @@ percent-encoding = "2.1"
135147
reqwest = { version = "0.11", features = ["json", "stream"] }
136148
serde = { version = "1.0", features = ["derive"] }
137149
serde_json = "1.0"
138-
uuid = { version = "0.8", features = ["serde", "v4"] }
150+
uuid = { version = ">=0.8.0, <2.0.0", features = ["serde", "v4"] }
139151
```
140152

141153
Note that there is a dependency on `percent-encoding` which macro- and

progenitor-impl/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl Generator {
210210
];
211211
if self.type_space.uses_uuid() {
212212
deps.push(
213-
"uuid = { version = \"0.8\", features = [\"serde\", \"v4\"] }",
213+
"uuid = { version = \">=0.8.0, <2.0.0\", features = [\"serde\", \"v4\"] }",
214214
)
215215
}
216216
if self.type_space.uses_chrono() {

progenitor-macro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use syn::LitStr;
2121
/// The more complex form accepts the following key-value pairs in any order:
2222
/// ```ignore
2323
/// generate_api!(
24-
/// spec = "path/to/spec.json"
24+
/// spec = "path/to/spec.json",
2525
/// [ inner_type = path::to:Type, ]
2626
/// [ pre_hook = closure::or::path::to::function, ]
2727
/// [ post_hook = closure::or::path::to::function, ]

0 commit comments

Comments
 (0)