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>
impl<'a> PatchConfig<'a>
Sourcepub fn new(metadata: &'a ProtoMetadata) -> Self
pub fn new(metadata: &'a ProtoMetadata) -> Self
Create a new config with all transforms enabled and default settings.
Sourcepub fn with_project_config(self, project: &ProjectConfig) -> Self
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);Sourcepub fn unimplemented_methods(self, methods: &[&str]) -> Self
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.
Sourcepub fn public_methods(self, methods: &[&str]) -> Self
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.
Sourcepub fn error_schema_ref(self, ref_path: &str) -> Self
pub fn error_schema_ref(self, ref_path: &str) -> Self
Set the $ref path for the REST error response schema.
Sourcepub fn upgrade_to_3_1(self, enabled: bool) -> Self
pub fn upgrade_to_3_1(self, enabled: bool) -> Self
Enable or disable the 3.0 → 3.1 upgrade transform.
Sourcepub fn annotate_sse(self, enabled: bool) -> Self
pub fn annotate_sse(self, enabled: bool) -> Self
Enable or disable SSE streaming annotation.
Sourcepub fn inject_validation(self, enabled: bool) -> Self
pub fn inject_validation(self, enabled: bool) -> Self
Enable or disable validation constraint injection.
Sourcepub fn add_security(self, enabled: bool) -> Self
pub fn add_security(self, enabled: bool) -> Self
Enable or disable security scheme addition.
Sourcepub fn inline_request_bodies(self, enabled: bool) -> Self
pub fn inline_request_bodies(self, enabled: bool) -> Self
Enable or disable request body inlining.
Sourcepub fn flatten_uuid_refs(self, enabled: bool) -> Self
pub fn flatten_uuid_refs(self, enabled: bool) -> Self
Enable or disable UUID wrapper flattening.
Sourcepub fn normalize_line_endings(self, enabled: bool) -> Self
pub fn normalize_line_endings(self, enabled: bool) -> Self
Enable or disable CRLF → LF normalization.
Sourcepub fn skip_upgrade(self) -> Self
pub fn skip_upgrade(self) -> Self
Skip the 3.0 → 3.1 upgrade transform.
Sourcepub fn skip_validation(self) -> Self
pub fn skip_validation(self) -> Self
Skip validation constraint injection.
Sourcepub fn skip_security(self) -> Self
pub fn skip_security(self) -> Self
Skip security scheme addition.
Sourcepub fn skip_inline_request_bodies(self) -> Self
pub fn skip_inline_request_bodies(self) -> Self
Skip request body inlining.
Sourcepub fn skip_uuid_flattening(self) -> Self
pub fn skip_uuid_flattening(self) -> Self
Skip UUID wrapper flattening.
Sourcepub fn skip_line_ending_normalization(self) -> Self
pub fn skip_line_ending_normalization(self) -> Self
Skip CRLF → LF normalization.
Sourcepub fn bearer_description(self, description: &str) -> Self
pub fn bearer_description(self, description: &str) -> Self
Set a custom description for the Bearer auth scheme.
When None, defaults to "Bearer authentication token".
Sourcepub fn plain_text_endpoints(self, endpoints: &[PlainTextEndpoint]) -> Self
pub fn plain_text_endpoints(self, endpoints: &[PlainTextEndpoint]) -> Self
Set endpoints that should use text/plain content type.
Sourcepub fn metrics_path(self, path: &str) -> Self
pub fn metrics_path(self, path: &str) -> Self
Set the metrics endpoint path for response header enrichment.
Sourcepub fn readiness_path(self, path: &str) -> Self
pub fn readiness_path(self, path: &str) -> Self
Set the readiness probe path for 503 response addition.