Skip to main content

Crate forge_parser

Crate forge_parser 

Source
Expand description

OpenAPI 3.0 JSON → forge_ir::Ir.

Stage 3 supports a deliberately narrow subset of OpenAPI 3.0.x. See docs/parser-coverage.md for the precise list. Anything outside the subset produces an error-severity diagnostic with a JSON-pointer location — never silent best-effort output.

§Public surface

let json = std::fs::read_to_string("openapi.json").unwrap();
match forge_parser::parse_str(&json) {
    Ok(out) => {
        for d in &out.diagnostics { eprintln!("{}: {}", d.code, d.message); }
        if let Some(ir) = out.spec { println!("{} operations", ir.operations.len()); }
    }
    Err(e) => eprintln!("fatal: {e}"),
}

Re-exports§

pub use external::FileResolver;
pub use external::NoExternalResolver;
pub use external::Resolver;
pub use external::ResolverError;

Modules§

external
External $ref resolution.

Structs§

ParseOutput

Enums§

ParseError

Functions§

parse_path
Parse a spec from a filesystem path. External $refs are resolved relative to the spec file’s parent directory; paths that escape that root are rejected with parser/E-EXTERNAL-REF.
parse_str
Parse an OpenAPI 3.0 JSON document.
parse_str_with_file
Parse with a file label that gets attached to every SpecLocation.