Skip to main content

ResponseRewriter

Trait ResponseRewriter 

Source
pub trait ResponseRewriter: Send + Sync {
    // Required methods
    fn expand_tokens(&self, body: &mut Value);
    fn apply_overrides(
        &self,
        operation_id: &str,
        tags: &[String],
        path: &str,
        body: &mut Value,
    );
}
Expand description

Hook for post-generation response body mutation used by the OpenAPI router. Implementations are called conditionally — expand_tokens only when template expansion is enabled for the current context, and apply_overrides only when operation overrides are enabled.

Required Methods§

Source

fn expand_tokens(&self, body: &mut Value)

Expand template tokens (e.g. {{uuid}}, {{now}}) in-place inside the response body.

Source

fn apply_overrides( &self, operation_id: &str, tags: &[String], path: &str, body: &mut Value, )

Apply user-supplied override rules to the response body in-place, keyed by the operation id, tags, and request path.

Implementors§