Package: openman-pro
DisclaimerThis project is not ownened by me using the code base to fix bugs for my own use if using it use with cautionOpenmanA postman to openapi spec conversion tool, which automaticallyConverts your postman collection (2.1) to OpeanAPI Spec (3.0.0)Mocks your openapi collection to generate responses from postman examplesOther than these, this tool can easily handle ignored fields in responses (explained below)NOTEPlease use postman collection ver 2.1 export (and not 2.0 or earlier). This library only support postman collection 2.1InstallationNOTEThis repo needs you to have python 3.5+ installedPIPpipinstallopenman-proManualTo install, simple clone this repogitclonehttps://github.com/samcaspus/openman.gitand installpythonsetup.pyinstallQuick StartThis tool can be used as a python package or as a standalone cli.To start, simply typeopenman --helpand it will display helpUsage:openman[OPTIONS]COMMAND[ARGS]...Convertormockyourpostmancollectiontoopenapischema

Options:--helpShowthismessageandexit.

Commands:convertmockConvert postman to openapi specEasy!! Just useconvertcommand (default output is yaml)openmanconvertpostman-collection.jsonspec.yamlOr, you can output to json byopenmanconvert-fjsonpostman-collection.jsonspec.yamlMocking specI am using the some cherry on top of the awesome projectConnexionBasically, 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.openmanmockspec.yamlIgnore schemaSometimes, your api responses have some data which varies. For instance, consider this response for the apiPOST /user:{"result":{"timestamp":1572696732,"username":"abc","tags":{"tag1":"something","tag3":"somethig else"},"some-changing-key":"whatever"}}You do want to record theusername,timestampfields, but what aboutsome-changing-keyfield? What about fields insidetags? You want to keep thetagskey as it will always be included in response, but do not want to keepsome-changing-keyas it may or maynot appear in responses.Sometimes you may want to ignore only the values of a key, while sometimes you want the key value pair to be ignored alltogetherFor such cases, you may not want to document them. For such purpose,Ignore fileis used.In ignore file, you can document the fields you want the openman to ignore. It uses thejsonpath-rwlibrary and uses its syntax (which is quite easy to learn).To ignore only values but keep the keys, simple use thejsonpath-rwsyntax that points to the key. For ex-$.result.tags.[*]will find everything insidetagsfield inresultobject.To ignore both key and values, simply use the above method, i.e. write yourjsonpath-rwregex that matches the path, andappend:ato it. For example, if you want to delete everything inside tagincludingtag field itself, you can do so by:$.result.tags.[*]:aTaking above example, you want to ignore following fields:everything insidetags(ignore value but NOT the keytags)some-changing-keyfield (ignore both key and value)You can define them in a fileignore.yamlas such:schema:/user:post:200:-'$.result.tags.[*]'//Ignore everything inside tags field-'$.result.some-changing-key:a'//Ignore 'some-changing-key'. Note the leading :aand then you can convert your postman collection to openapi spec without these fields:openman-iignore.yamlpostman-collection.jsonspec.yamlPS: Leading:ain jsonpath-rw syntax with ignore both the key and values, otherwise only values are ignored.Change spec formatThe default output conversion format isyaml. However, you can easily change the format to json by:openman-fjsonpostman-collection.jsonspec.json