#[non_exhaustive]pub struct ConfigWarning {
pub tool: Option<String>,
pub param: Option<String>,
pub rule: &'static str,
pub detail: String,
}Expand description
One non-fatal finding from crate::config::ServerConfig::lint
(Phase 128, D-07).
§Why this exists instead of a validate() variant
ConfigValidationError is first-error-wins Result<(), _> with no warning
channel, so D-07’s “warns” is unexpressible in that signature. A running server
must NOT refuse to boot because a free-text body parameter has no max_length
(D-05) — but the author still has to be told, and the startup log is what makes
a later regression traceable. Hence a separate additive -> Vec<ConfigWarning>
channel that leaves validate’s existing behaviour untouched.
[server.validation] strict = true is what promotes a finding into a
ConfigValidationError::UncappedStringParam.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.tool: Option<String>The [[tools]] name the finding concerns; None for a server-level
finding — an active [server.validation] opt-out belongs to the server, not
to a tool.
param: Option<String>The [[tools.parameters]] name the finding concerns; None when the
finding is not about one parameter.
A server-level finding has neither tool nor param. A TOOL-level finding,
one that concerns the [[tools]] entry as a whole rather than any one
parameter (lint_against_spec’s configured-template-not-in-spec is the
live case), has a tool and no param. A parameter-level finding has both.
None is the only “absent” value: an empty string is a name, not a scope.
rule: &'static strStable machine-readable rule identifier, e.g. "uncapped-string".
A &'static str rather than an enum so plan 07’s CLI and plan 09’s startup
log can group and filter on it without either taking a dependency on a
closed set that every new rule would widen.
detail: StringHuman-readable explanation, including the remedy.
Author-facing, like ConfigValidationError’s messages and unlike a
client-facing refusal: it may name config keys and declared limits. It never
contains caller data — lint runs at load time with no request in scope.
Trait Implementations§
Source§impl Clone for ConfigWarning
impl Clone for ConfigWarning
Source§impl Debug for ConfigWarning
impl Debug for ConfigWarning
Source§impl Display for ConfigWarning
impl Display for ConfigWarning
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Renders the three scopes the two optional fields encode: server-level,
tool-level (no parameter) and parameter-level. Branching on tool alone
would render a tool-level finding as ... 'get_cui' parameter '': ...,
which lint_against_spec can produce and pmcp-openapi-server prints
verbatim to the deploy log.
impl Eq for ConfigWarning
Source§impl PartialEq for ConfigWarning
impl PartialEq for ConfigWarning
impl StructuralPartialEq for ConfigWarning
Auto Trait Implementations§
impl Freeze for ConfigWarning
impl RefUnwindSafe for ConfigWarning
impl Send for ConfigWarning
impl Sync for ConfigWarning
impl Unpin for ConfigWarning
impl UnsafeUnpin for ConfigWarning
impl UnwindSafe for ConfigWarning
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more