pub enum SpecKind {
OpenApi,
AsyncApi,
GraphQl,
McpTools,
}Expand description
Spec dialects soothfast reads and writes.
Variants§
Implementations§
Source§impl SpecKind
impl SpecKind
Sourcepub const ALL: &'static [SpecKind]
pub const ALL: &'static [SpecKind]
Every dialect that can be generated, for help text and diagnostics.
Sourcepub fn parse_name(s: &str) -> Option<SpecKind>
pub fn parse_name(s: &str) -> Option<SpecKind>
Parse a dialect = "..." value.
Sourcepub fn for_path(path: &str) -> SpecKind
pub fn for_path(path: &str) -> SpecKind
Guess the dialect of a spec file from its path.
Generation needs a dialect before the file exists, so content sniffing
(which crate::sniff_kind does on the reconcile path) is not
available here. The guess is conservative and always overridable with
an explicit dialect = key: OpenAPI is the default because it is what
an unqualified spec.yaml almost always means.
Sourcepub fn document(self, info: &Info, ops: &[Operation]) -> Document
pub fn document(self, info: &Info, ops: &[Operation]) -> Document
Assemble a document from inferred route shapes.
Sourcepub fn render(self, path: &str, value: &Value) -> String
pub fn render(self, path: &str, value: &Value) -> String
Serialize a document for writing to path.
GraphQL ignores the extension because SDL is its only serialization;
the rest honour .json and default to the dialect’s usual form.
Sourcepub fn parse(self, path: &str, text: &str) -> Result<Value, String>
pub fn parse(self, path: &str, text: &str) -> Result<Value, String>
Parse a committed spec file back into its generated document.
Round-trips the result through SpecKind::render and fails on any
drift, so a stale or hand-edited file can never be silently diffed
as the base.
Sourcepub fn diff(self, old: &Value, new: &Value) -> Vec<Change>
pub fn diff(self, old: &Value, new: &Value) -> Vec<Change>
Compare two revisions of a document for consumer compatibility.