You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
make api_versions generate a latest_version function (#11)
Make the `api_versions!` macro generate a `latest_version` function that
produces the latest version. This makes it possible to add new versions
without having to updating `ServerBuilder` callsites.
Copy file name to clipboardExpand all lines: crates/dropshot-api-manager/README.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,7 +143,12 @@ api_versions!([
143
143
**For both lockstep and versioned APIs:** once the API crate is defined, update the OpenAPI manager to manage the new OpenAPI document(s). Within this directory:
144
144
145
145
1. In your repository's integration point's `Cargo.toml`, add a dependency on the API crate.
146
-
2. Add the crate to the list of APIs managed by the OpenAPI manager. For versioned APIs, the `api_versions` macro defines a `supported_versions()` function, which you'll need to use
146
+
2. Add the crate to the list of APIs managed by the OpenAPI manager. For versioned APIs, the `api_versions` macro defines a `supported_versions()` function, which you'll need to use.
147
+
148
+
> [!NOTE]
149
+
> The `api_versions!` macro also generates a `latest_version` function which returns the latest version (the first version on the list).
150
+
>
151
+
> When creating the server, you must configure a [`version_policy`](https://docs.rs/dropshot/latest/dropshot/struct.ServerBuilder.html#method.version_policy) to indicate that the API is versioned. If you use the [`ClientSpecifiesVersionInHeader`](https://docs.rs/dropshot/latest/dropshot/struct.ClientSpecifiesVersionInHeader.html) policy, set the `max_version` to the output of `latest_version()`.
147
152
148
153
To ensure everything works well, run `cargo openapi generate`. Your OpenAPI document should be generated on disk and listed in the output.
0 commit comments