pub struct Spec { /* private fields */ }Expand description
High-level representation of a parsed and queryable OpenAPI spec.
Implementations§
Source§impl Spec
impl Spec
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self, ForgeError>
pub fn load(path: impl AsRef<Path>) -> Result<Self, ForgeError>
Load an OpenAPI spec from a YAML or JSON file.
§Errors
Returns an error if the file cannot be read, parsed, or is not OpenAPI 3.0.x.
Sourcepub fn parse(content: &str) -> Result<Self, ForgeError>
pub fn parse(content: &str) -> Result<Self, ForgeError>
Sourcepub fn schema(&self, name: &str) -> Result<&SchemaObject, ForgeError>
pub fn schema(&self, name: &str) -> Result<&SchemaObject, ForgeError>
Look up a component schema by name.
§Errors
Returns SchemaNotFound if the schema name does not exist.
Sourcepub fn schema_names(&self) -> Vec<&str>
pub fn schema_names(&self) -> Vec<&str>
Get all component schema names.
Sourcepub fn fields(&self, schema_name: &str) -> Result<Vec<Field>, ForgeError>
pub fn fields(&self, schema_name: &str) -> Result<Vec<Field>, ForgeError>
Resolve fields from a named schema, including type info and required status.
§Errors
Returns an error if the schema is not found.
Sourcepub fn resolve_type(&self, schema: &SchemaObject) -> TypeInfo
pub fn resolve_type(&self, schema: &SchemaObject) -> TypeInfo
Resolve the type info for a sekkei Schema.
Delegates to takumi::schema_to_field_type for consistent type resolution.
Sourcepub fn resolve_schema_or_ref_type(
&self,
schema_or_ref: &SchemaOrRef,
) -> TypeInfo
pub fn resolve_schema_or_ref_type( &self, schema_or_ref: &SchemaOrRef, ) -> TypeInfo
Resolve the type info for a SchemaOrRef adapter.
Sourcepub fn diff_schemas(
&self,
name_a: &str,
name_b: &str,
) -> Result<SchemaDiff, ForgeError>
pub fn diff_schemas( &self, name_a: &str, name_b: &str, ) -> Result<SchemaDiff, ForgeError>
Diff two schemas by name, showing added/removed/changed fields.
§Errors
Returns an error if either schema is not found.
Sourcepub fn group_by_crud_pattern(&self) -> Vec<CrudGroup>
pub fn group_by_crud_pattern(&self) -> Vec<CrudGroup>
Heuristic CRUD grouping of endpoints by operation pattern.
Groups endpoints like /create-secret, /get-secret-value,
/update-secret-val, /delete-item into clusters by matching
create/get/update/delete prefixes.
Sourcepub fn endpoint_by_path(&self, path: &str) -> Option<Endpoint>
pub fn endpoint_by_path(&self, path: &str) -> Option<Endpoint>
Find an endpoint by its path.