pub trait VersionChange:
Send
+ Sync
+ 'static {
// Required method
fn description(&self) -> &str;
// Provided methods
fn resources(&self) -> &[&'static str] { ... }
fn added_routes(&self) -> &[&'static str] { ... }
fn removed_routes(&self) -> &[&'static str] { ... }
fn unavailable_to_older_versions(&self) -> &[&'static str] { ... }
fn legacy_handlers(&self) -> Vec<(&'static str, LegacyHandler)> { ... }
fn transform_request(&self, payload: &mut Map<String, Value>) { ... }
fn transform_response(&self, document: &mut Value) { ... }
}Expand description
One backwards-incompatible change, registered under the version that introduced it.
Routes are named by method and URI pattern, as GET /v1/orders/{order}/summary; * matches
anything. Resources are JSON:API types, such as customers, or route patterns.
Required Methods§
Sourcefn description(&self) -> &str
fn description(&self) -> &str
What changed, for the changelog.
Provided Methods§
Sourcefn resources(&self) -> &[&'static str]
fn resources(&self) -> &[&'static str]
The resource types or routes the transforms apply to. Empty means every response.
Sourcefn added_routes(&self) -> &[&'static str]
fn added_routes(&self) -> &[&'static str]
Routes this version added: older versions get a 404.
Sourcefn removed_routes(&self) -> &[&'static str]
fn removed_routes(&self) -> &[&'static str]
Routes this version removed: it and newer versions get a 404.
Routes older versions may no longer use: they get a 410 endpoint_unavailable_for_version.
Sourcefn legacy_handlers(&self) -> Vec<(&'static str, LegacyHandler)>
fn legacy_handlers(&self) -> Vec<(&'static str, LegacyHandler)>
Routes older versions keep being served by a frozen handler.
Sourcefn transform_request(&self, payload: &mut Map<String, Value>)
fn transform_request(&self, payload: &mut Map<String, Value>)
Upgrades a request body from the older shape to this version’s shape.
Sourcefn transform_response(&self, document: &mut Value)
fn transform_response(&self, document: &mut Value)
Downgrades a response document from this version’s shape to the older shape.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".