improve docs and uuid version handling (#65)
This commit is contained in:
parent
d3441861bc
commit
3cd1eae3f5
16
README.md
16
README.md
|
@ -44,7 +44,19 @@ Similarly if there is a `format` field set to `uuid`:
|
|||
|
||||
```diff
|
||||
[dependencies]
|
||||
+uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||
+uuid = { version = "1.0.0", features = ["serde", "v4"] }
|
||||
```
|
||||
|
||||
The macro has some additional fancy options to control the generated code:
|
||||
|
||||
```rust
|
||||
generate_api!(
|
||||
spec = "path/to/openapi_document.json", // The OpenAPI document
|
||||
inner_type = my_client::InnerType, // Client inner type available to pre and post hooks
|
||||
pre_hook = closure::or::path::to::function, // Hook invoked before issuing the HTTP request
|
||||
post_hook = closure::or::path::to::function, // Hook invoked prior to receiving the HTTP response
|
||||
derives = [ schemars::JsonSchema ], // Additional derive macros applied to generated types
|
||||
);
|
||||
```
|
||||
|
||||
Note that the macro will be re-evaluated when the OpenAPI json document
|
||||
|
@ -135,7 +147,7 @@ percent-encoding = "2.1"
|
|||
reqwest = { version = "0.11", features = ["json", "stream"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||
uuid = { version = ">=0.8.0, <2.0.0", features = ["serde", "v4"] }
|
||||
```
|
||||
|
||||
Note that there is a dependency on `percent-encoding` which macro- and
|
||||
|
|
|
@ -210,7 +210,7 @@ impl Generator {
|
|||
];
|
||||
if self.type_space.uses_uuid() {
|
||||
deps.push(
|
||||
"uuid = { version = \"0.8\", features = [\"serde\", \"v4\"] }",
|
||||
"uuid = { version = \">=0.8.0, <2.0.0\", features = [\"serde\", \"v4\"] }",
|
||||
)
|
||||
}
|
||||
if self.type_space.uses_chrono() {
|
||||
|
|
|
@ -21,7 +21,7 @@ use syn::LitStr;
|
|||
/// The more complex form accepts the following key-value pairs in any order:
|
||||
/// ```ignore
|
||||
/// generate_api!(
|
||||
/// spec = "path/to/spec.json"
|
||||
/// spec = "path/to/spec.json",
|
||||
/// [ inner_type = path::to:Type, ]
|
||||
/// [ pre_hook = closure::or::path::to::function, ]
|
||||
/// [ post_hook = closure::or::path::to::function, ]
|
||||
|
|
Loading…
Reference in New Issue