{"id":14986682,"url":"https://github.com/codeasashu/openman","last_synced_at":"2025-06-28T17:05:48.060Z","repository":{"id":36384798,"uuid":"224037263","full_name":"codeasashu/openman","owner":"codeasashu","description":"Postman to OpenAPI Spec converter with mocking and documentation","archived":false,"fork":false,"pushed_at":"2023-05-03T16:58:13.000Z","size":89,"stargazers_count":21,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T20:58:47.168Z","etag":null,"topics":["mock","openapi","openapi-spec","postman","postman-collection","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeasashu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-11-25T20:40:33.000Z","updated_at":"2025-05-05T22:53:29.000Z","dependencies_parsed_at":"2025-04-11T22:33:32.311Z","dependency_job_id":"866c975b-4bee-4434-9565-ee26168ebc40","html_url":"https://github.com/codeasashu/openman","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/codeasashu/openman","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeasashu%2Fopenman","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeasashu%2Fopenman/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeasashu%2Fopenman/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeasashu%2Fopenman/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeasashu","download_url":"https://codeload.github.com/codeasashu/openman/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeasashu%2Fopenman/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260245521,"owners_count":22980226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mock","openapi","openapi-spec","postman","postman-collection","python"],"created_at":"2024-09-24T14:13:20.085Z","updated_at":"2025-06-28T17:05:48.018Z","avatar_url":"https://github.com/codeasashu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Openman\n\nA postman to openapi spec conversion tool, which automatically\n\n- Converts your postman collection (2.1) to OpeanAPI Spec (3.0.0)\n- Mocks your openapi collection to generate responses from postman examples\n\nOther than these, this tool can easily handle ignored fields in responses (explained below)\n\n**NOTE** Please use postman collection ver 2.1 export (and not 2.0 or earlier). This library only support postman collection 2.1\n\n## Installation\n\n**NOTE** This repo needs you to have python 3.5+ installed\n\n### PIP\n\n```sh\npip install openman\n```\n\n### Manual\nTo install, simple clone this repo\n\n```sh\ngit clone https://github.com/codeasashu/openman.git\n```\n\nand install\n\n```sh\npython setup.py install\n```\n\n## Quick Start\n\nThis tool can be used as a python package or as a standalone cli.\n\nTo start, simply type `openman --help` and it will display help\n\n```sh\nUsage: openman [OPTIONS] COMMAND [ARGS]...\n\n  Convert or mock your postman collection to openapi schema\n\nOptions:\n  --help  Show this message and exit.\n\nCommands:\n  convert\n  mock\n```\n\n### Convert postman to openapi spec\n\nEasy!! Just use `convert` command (default output is yaml)\n\n```sh\nopenman convert postman-collection.json spec.yaml\n```\n\nOr, you can output to json by\n\n```sh\nopenman convert -f json postman-collection.json spec.yaml\n```\n\n### Mocking spec\n\nI am using the some cherry on top of the awesome project [Connexion](https://github.com/zalando/connexion)\n\nBasically, I am using postman example as mock responses, given the request has matching parameters (query, headers etc.). Even if they do not match, this tool gives out the mock responses for provided schema.\n\n```sh\nopenman mock spec.yaml\n```\n\n### Ignore schema\n\nSometimes, your api responses have some data which varies. For instance, consider this response for the api `POST /user`:\n\n```json\n{\n    \"result\": {\n        \"timestamp\": 1572696732,\n        \"username\": \"abc\",\n        \"tags\": {\n            \"tag1\" : \"something\",\n            \"tag3\": \"somethig else\"\n        },\n        \"some-changing-key\": \"whatever\"\n    }\n}\n```\n\nYou do want to record the `username`, `timestamp` fields, but what about `some-changing-key` field? What about fields inside `tags`? You want to keep the `tags` key as it will always be included in response, but do not want to keep `some-changing-key` as it may or maynot appear in responses.\n\n**Sometimes you may want to ignore only the values of a key, while sometimes you want the key value pair to be ignored alltogether**\n\nFor such cases, you may not want to document them. For such purpose, **Ignore file** is used.\n\nIn ignore file, you can document the fields you want the openman to ignore. It uses the [jsonpath-rw](https://pypi.org/project/jsonpath-rw/) library and uses its syntax (which is quite easy to learn).\n\n**To ignore only values but keep the keys**, simple use the `jsonpath-rw` syntax that points to the key. For ex- `$.result.tags.[*]` will find everything inside `tags` field in `result` object.\n\n**To ignore both key and values**, simply use the above method, i.e. write your `jsonpath-rw` regex that matches the path, and *append* `:a` to it. For example, if you want to delete everything inside tag *including* tag field itself, you can do so by: `$.result.tags.[*]:a`\n\n\nTaking above example, you want to ignore following fields:\n\n- everything inside `tags` (ignore value but NOT the key `tags`)\n- `some-changing-key` field (ignore both key and value)\n\nYou can define them in a file `ignore.yaml` as such:\n\n```yaml\nschema:\n   /user:\n     post:\n       200:\n         - '$.result.tags.[*]' //Ignore everything inside tags field\n         - '$.result.some-changing-key:a' //Ignore 'some-changing-key'. Note the leading :a \n```\n\nand then you can convert your postman collection to openapi spec without these fields:\n\n```sh\nopenman -i ignore.yaml postman-collection.json spec.yaml\n```\n\nPS: Leading `:a` in jsonpath-rw syntax with ignore both the key and values, otherwise only values are ignored.\n\n## Change spec format\n\nThe default output conversion format is `yaml`. However, you can easily change the format to json by:\n\n```sh\nopenman -f json postman-collection.json spec.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeasashu%2Fopenman","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeasashu%2Fopenman","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeasashu%2Fopenman/lists"}