All Projects → grokify → Swaggman

grokify / Swaggman

Licence: mit
OpenAPI Spec SDK and Converter for OpenAPI 3.0 and 2.0 Specs to Postman 2.0 Collections. Example RingCentral spec included.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Swaggman

pmpact
A command line tool to convert Pact files to Postman collections.
Stars: ✭ 15 (-84.04%)
Mutual labels:  postman, postman-collection
axon
Autogenerate Integration Tests
Stars: ✭ 49 (-47.87%)
Mutual labels:  postman, postman-collection
trello-postman-collection
A Postman collection for Trello REST API
Stars: ✭ 20 (-78.72%)
Mutual labels:  postman, postman-collection
Api Flow
Universal data structure and converter for API formats (Swagger, RAML, Paw, Postman…)
Stars: ✭ 185 (+96.81%)
Mutual labels:  swagger, postman
Gin Boilerplate
The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQL database and JWT authentication middleware stored in Redis
Stars: ✭ 559 (+494.68%)
Mutual labels:  postman, postman-collection
openman
Postman to OpenAPI Spec converter with mocking and documentation
Stars: ✭ 17 (-81.91%)
Mutual labels:  postman, postman-collection
postman-webex
Postman collections for Webex REST APIs
Stars: ✭ 97 (+3.19%)
Mutual labels:  postman, postman-collection
Postman To K6
Converts Postman collections to k6 script code
Stars: ✭ 180 (+91.49%)
Mutual labels:  postman, postman-collection
Postman Code Generators
Common repository for all code generators shipped with Postman
Stars: ✭ 526 (+459.57%)
Mutual labels:  postman, postman-collection
Metersphere
MeterSphere 是一站式开源持续测试平台,覆盖测试管理、接口测试、性能测试等。搞测试,就选 MeterSphere!
Stars: ✭ 6,331 (+6635.11%)
Mutual labels:  postman, swagger
Prism
Turn any OpenAPI2/3 and Postman Collection file into an API server with mocking, transformations and validations.
Stars: ✭ 2,484 (+2542.55%)
Mutual labels:  swagger, postman-collection
Pmtoapib
Tool to convert Postman collection exports to Api Blueprint documentation
Stars: ✭ 34 (-63.83%)
Mutual labels:  postman, postman-collection
Apiary2postman
Tool for generating a Postman collection from Blueprint API markup or the Apiary API
Stars: ✭ 194 (+106.38%)
Mutual labels:  postman, postman-collection
graphql-to-postman
Plugin for converting GraphQL to the Postman Collection (v2) format
Stars: ✭ 27 (-71.28%)
Mutual labels:  postman, postman-collection
Azuredevops Postman Collections
The collections allow you to test common Azure DevOps Rest APIs from within Postman.
Stars: ✭ 182 (+93.62%)
Mutual labels:  postman, postman-collection
postman-to-k6
Converts Postman collections to k6 script code
Stars: ✭ 269 (+186.17%)
Mutual labels:  postman, postman-collection
Covid 19 Apis
Postman COVID-19 API Resource Center—API collections to help in the COVID-19 fight.
Stars: ✭ 111 (+18.09%)
Mutual labels:  postman, postman-collection
Messenger Platform Postman Collection
A delicious Postman collection for all your Messenger Platform needs.
Stars: ✭ 150 (+59.57%)
Mutual labels:  postman, postman-collection
super-powered-api-testing
Comparisons of powerful API testing tools
Stars: ✭ 25 (-73.4%)
Mutual labels:  swagger, postman
Newman
Newman is a command-line collection runner for Postman
Stars: ✭ 5,607 (+5864.89%)
Mutual labels:  postman, postman-collection

Swaggman - OpenAPI Spec SDK and Postman Converter

Build Status Go Report Card Docs License

Swaggman is a multi-purpose OpenAPI Spec SDK that includes enhanced Postman conversion.

Major Features

  • CLI and library to Convert OpenAPI Specs to Postman Collection
    • Add Postman environment variables to URLs, e.g. Server URLs like https://{{HOSTNAME}}/restapi
    • Add headers, such as environment variable based Authorization headers, such as Authorization: Bearer {{myAccessToken}}
    • Utilize baseline Postman collection to add Postman-specific functionality including Postman prerequest scripts.
    • Add example request bodies, e.g. JSON bodies with example parameter values.
  • OpenAPI 3 Spec SDK
  • OpenAPI 2 Spec SDK
    • Convert OpenAPI v2 to Postman Collection v2
    • Merge Multiple OAS2 Specs

Features

These are all used in the included example discussed below.

Additional discussion is available on Medium.

Notes

  • Postman 4.10.7 does not natively support JSON requests so request bodies need to be entered using the raw body editor. A future task is to add Swagger request examples as default Postman request bodies.
  • Postman 2.0 spec supports polymorphism and doesn't have a canonical schema. For example, the request.url property can be populated by a URL string or a URL object. Swaggman uses the URL object since it is more flexible. The function simple.NewCanonicalCollectionFromBytes(bytes) can be used to read either a simple or object based spec into a canonical object spec.
  • This has only been used on the RingCentral Swagger spec to date but will be used for more in the future. Please feel free to use and contribute. Examples are located in the examples folder.

Installation

The following command will install the executable binary swaggman into the ~/go/bin directory.

$ go get github.com/grokify/swaggman

Usage

Simple Usage

// Instantiate a converter with default configuration
conv := swaggman.NewConverter(swaggman.Configuration{})

// Convert a Swagger spec
err := conv.Convert("path/to/swagger.json", "path/to/pman.out.json")

Usage with Features

The following can be added which are especially useful to use with environment variables.

  • Custom Hostname
  • Custom Headers
// Instantiate a converter with overrides (using Postman environment variables)
cfg := swaggman.Configuration{
	PostmanURLBase: "{{RINGCENTRAL_SERVER_URL}}",
	PostmanHeaders: []postman2.Header{
		{
			Key:   "Authorization",
			Value: "Bearer {{my_access_token}}",
		},
	},
}
conv = swaggman.NewConverter(cfg)

// Convert a Swagger spec with a default Postman spec
err := conv.MergeConvert("path/to/swagger.json", "path/to/pman.base.json", "path/to/pman.out.json")

Example

An example conversion is included, examples/ringcentral/convert.go which creates a Postman 2.0 spec for the RingCentral REST API using a base Postman 2.0 spec and the RingCentral basic Swagger 2.0 spec.

A video of importing the resulting Postman collection is available on YouTube.

Example files include:

The RingCentral spec uses the following environment variables. The following is the Postman bulk edit format:

RC_SERVER_HOSTNAME:platform.devtest.ringcentral.com
RC_APP_KEY:myAppKey
RC_APP_SECRET:myAppSecret
RC_USERNAME:myMainCompanyPhoneNumber
RC_EXTENSION:myExtension
RC_PASSWORD:myPassword

For multiple apps or users, simply create a different Postman environment for each.

To set your environment variables, use the Settings Gear icon and then click "Manage Environments"

Articles and Links

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].