Skip to main content

Crate mitm2openapi

Crate mitm2openapi 

Source
Expand description

§mitm2openapi

Convert mitmproxy flow dumps and HAR files to OpenAPI 3.0 specifications.

This crate provides both a CLI binary (mitm2openapi) and a library for programmatic use. It supports mitmproxy flow dumps (v19–v21) and HAR 1.2 files.

§Workflow

  1. discover scans captured traffic and emits a curatable templates file.
  2. The user curates the templates (or uses --include-patterns / --exclude-patterns).
  3. generate produces the final OpenAPI 3.0 YAML spec.

See the CLI documentation and the project README for examples.

Modules§

builder
cli
error
har_reader
mitmproxy_reader
output
params
path_matching
Path template matching: convert path templates to regexes, match URLs against templates, detect parameter segments, and suggest parameterized templates from observed paths.
schema
Schema inference: convert JSON values to OpenAPI schemas.
tnetstring
TNetString (Tagged Netstring) parser for mitmproxy flow files.
types

Constants§

MAX_BODY_SIZE
Maximum body size for response/request bodies (64 MiB).
MAX_DEPTH
Maximum recursion depth for TNetString parsing.
MAX_INPUT_SIZE
Maximum size of a single input file (2 GiB).
MAX_PAYLOAD_SIZE
Maximum size of a single TNetString payload (256 MiB).
MAX_SCHEMA_DEPTH
Maximum recursion depth for JSON-to-schema conversion.

Functions§

validate_input_path
Validate that an input path is a regular file (not a symlink, FIFO, etc.) and within the configured size limit.