Skip to main content

PatchConfig

Struct PatchConfig 

Source
pub struct PatchConfig<'a> { /* private fields */ }
Expand description

Configuration for the OpenAPI patch pipeline.

Controls which transforms run and their parameters. Construct with PatchConfig::new and configure via with_project_config (file-based) or individual builder methods (programmatic).

§Example

let config = PatchConfig::new(&metadata)
    .unimplemented_methods(&["SetupMfa", "DisableMfa"])
    .public_methods(&["Login", "SignUp"])
    .error_schema_ref("#/components/schemas/ErrorResponse");

Implementations§

Source§

impl<'a> PatchConfig<'a>

Source

pub fn new(metadata: &'a ProtoMetadata) -> Self

Create a new config with all transforms enabled and default settings.

Source

pub fn with_project_config(self, project: &ProjectConfig) -> Self

Apply settings from a ProjectConfig.

Copies method lists, error schema ref, transform toggles, and endpoint settings from the config into this builder. Builder methods called after this will override config values.

§Example
let project = ProjectConfig::load(Path::new("config.yaml"))?;
let config = PatchConfig::new(&metadata).with_project_config(&project);
Source

pub fn unimplemented_methods(self, methods: &[&str]) -> Self

Set proto method names of endpoints that return UNIMPLEMENTED.

Method names are resolved to gnostic operation IDs at patch() time. Invalid names will produce an error when patch() is called.

Source

pub fn public_methods(self, methods: &[&str]) -> Self

Set proto method names of endpoints that do not require authentication.

Method names are resolved to gnostic operation IDs at patch() time. Invalid names will produce an error when patch() is called.

Source

pub fn error_schema_ref(self, ref_path: &str) -> Self

Set the $ref path for the REST error response schema.

Source

pub fn upgrade_to_3_1(self, enabled: bool) -> Self

Enable or disable the 3.0 → 3.1 upgrade transform.

Source

pub fn annotate_sse(self, enabled: bool) -> Self

Enable or disable SSE streaming annotation.

Source

pub fn inject_validation(self, enabled: bool) -> Self

Enable or disable validation constraint injection.

Source

pub fn add_security(self, enabled: bool) -> Self

Enable or disable security scheme addition.

Source

pub fn inline_request_bodies(self, enabled: bool) -> Self

Enable or disable request body inlining.

Source

pub fn flatten_uuid_refs(self, enabled: bool) -> Self

Enable or disable UUID wrapper flattening.

Source

pub fn normalize_line_endings(self, enabled: bool) -> Self

Enable or disable CRLF → LF normalization.

Source

pub fn skip_upgrade(self) -> Self

Skip the 3.0 → 3.1 upgrade transform.

Source

pub fn skip_sse(self) -> Self

Skip SSE streaming annotation.

Source

pub fn skip_validation(self) -> Self

Skip validation constraint injection.

Source

pub fn skip_security(self) -> Self

Skip security scheme addition.

Source

pub fn skip_inline_request_bodies(self) -> Self

Skip request body inlining.

Source

pub fn skip_uuid_flattening(self) -> Self

Skip UUID wrapper flattening.

Source

pub fn skip_line_ending_normalization(self) -> Self

Skip CRLF → LF normalization.

Source

pub fn bearer_description(self, description: &str) -> Self

Set a custom description for the Bearer auth scheme.

When None, defaults to "Bearer authentication token".

Source

pub fn plain_text_endpoints(self, endpoints: &[PlainTextEndpoint]) -> Self

Set endpoints that should use text/plain content type.

Source

pub fn metrics_path(self, path: &str) -> Self

Set the metrics endpoint path for response header enrichment.

Source

pub fn readiness_path(self, path: &str) -> Self

Set the readiness probe path for 503 response addition.

Trait Implementations§

Source§

impl<'a> Debug for PatchConfig<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PatchConfig<'a>

§

impl<'a> RefUnwindSafe for PatchConfig<'a>

§

impl<'a> Send for PatchConfig<'a>

§

impl<'a> Sync for PatchConfig<'a>

§

impl<'a> Unpin for PatchConfig<'a>

§

impl<'a> UnwindSafe for PatchConfig<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.