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 can deserialize collections from JSON or YAML, identify the supported collection version,
and serialize the typed model back to JSON or YAML.
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 - serialization helpers:
to_jsonandto_yaml - 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
Add the following to your Cargo.toml file:
[]
= "0.2"
Usage
If you need version-specific fields, match on PostmanCollection directly:
use ;
See examples/printer.rs for a complete runnable example.
Current State
The crate currently focuses on:
- accurate deserialization into version-specific Rust types
- stable serialization back to JSON and YAML
- 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.