postman-collection-rs
Postman Collection serialization and deserialization library, written in Rust.
Overview
postman_collection provides typed Rust models for working with Postman Collection files.
It deserializes collections from JSON, identifies the supported collection version,
and serializes the typed model back to JSON. YAML parsing and serialization are
available behind the optional yaml feature.
Current highlights:
- typed support for Postman Collection
v1.0.0,v2.0.0, andv2.1.0 - version-specific models exposed as
v1_0_0,v2_0_0, andv2_1_0 - strict version detection through the top-level
PostmanCollectionenum - convenient parsing helpers:
from_path,from_reader,from_str, andfrom_slice - JSON serialization with
to_json - optional YAML parsing and serialization with the
yamlfeature - regression coverage for version dispatch, round-tripping, and representative schema branches
Supported Versions
This crate currently supports Postman Collection:
v1.0.0v2.0.0v2.1.0
Version detection follows the collection format:
v1.0.0is detected from the legacy root collection shape.v2.0.0andv2.1.0are detected frominfo.schema.
Collections that look like v2 but omit info.schema, or point at an unsupported schema
version, fail to deserialize instead of being guessed into the wrong version module.
Install
JSON-only use (default):
[]
= "0.3"
Enable YAML serialization:
[]
= { = "0.3", = ["yaml"] }
Usage
If you need version-specific fields, match on PostmanCollection directly:
use ;
See examples/printer.rs for a complete runnable example.
With the yaml feature enabled, parsing helpers also accept YAML input and you can
serialize a parsed collection as YAML:
use ;
Current State
The crate currently focuses on:
- accurate deserialization into version-specific Rust types
- stable serialization back to JSON
- optional YAML parsing and serialization for callers that opt into the
yamlfeature - explicit handling of collection version selection
- preserving representative schema branches exercised by the bundled fixtures and regression tests
Examples of supported modeled areas include:
- collection metadata and variables
- folders and nested items
- requests, headers, bodies, and URLs
- responses and response metadata
- auth helpers across the supported versions
Contribute
This project follows semver, conventional commits, and uses GitHub Actions plus release-plz for CI and releases.
Note
Inspired by softprops/openapi.