• Stars
    star
    108
  • Rank 321,259 (Top 7 %)
  • Language
    Go
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Spectrum - OpenAPI Spec SDK and Postman Converter

Build Status Go Report Card Docs LOC License

Spectrum is a multi-purpose OpenAPI Spec SDK that includes enhanced Postman conversion. Most of the OpenAPI Spec SDK is designed to support OAS3. Some functionality for OAS2 exists.

The following article provides an overview of OpenAPI spec to Postman conversion:

  1. Blog Introduction

Use Cases

  1. Converting from OpenAPI Spec to Postman where x-tagGroups are converted to Postman folders.
  2. Programmatically editing specs for reproducible results, typically when source spec is maintained.
  3. Merging multiple specs when a single spec is desired.
  4. Splitting a spec by tags when multiple specs are desired.

Packages and Major Features

  • openapi2 (godoc)
    1. Support for OpenAPI 2 files, including serialization, deserialization, and validation.
    2. Merging of multiple specs
    3. Postman 2 Collection conversion
  • openapi3 (godoc)
    1. Support for OpenAPI 3 files, including serialization, deserialization, and validation.
    2. Merging of multiple specs
    3. Splitting specs by tag
    4. Output of spec to tabular format to HTML (API Registry), CSV, XLSX. HTML API Registry has a bonus feature that makes each line clickable. Click any line here: http://ringcentral.github.io/api-registry/
    5. Programmatic API to modify OpenAPI specs using rules
    6. Programmatic ability to "fix" spec, e.g. change response Content Type to match output (needed for Engage Voice)
    7. OpenAPI 3 linter
    8. Statistics: Counts operations, schemas, properties & parameters (with and without descriptions), etc.
    9. Postman 2 Collection conversion
    10. Ability to merge in Postman request body examples into Postman 2 Collection
    11. Functionality is built on kin-openapi: https://github.com/getkin/kin-openapi
  • openapi3edit (godoc)
    1. Programmatic SDK-based editor for OAS3 specifications.
  • openapi3lint (godoc)
    1. Extensible linter for OAS3 specifications.
  • postman2 (godoc)
    1. Support for Postman 2 Collection files, including serialization and deserialization.
    2. CLI and library to Convert OpenAPI Specs to Postman Collection
    3. Add Postman environment variables to URLs, e.g. Server URLs like https://{{HOSTNAME}}/restapi
    4. Add headers, such as environment variable based Authorization headers, such as Authorization: Bearer {{myAccessToken}}
    5. Utilize baseline Postman collection to add Postman-specific functionality including Postman prerequest scripts.
    6. Add example request bodies, e.g. JSON bodies with example parameter values.
  • raml08
    1. Support for parsing RAML v0.8
    2. Limited functionality to extracting OpenAPI v3 description and summary from description and displayName respectively.

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. Spectrum 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 spectrum into the ~/go/bin directory.

$ go get github.com/grokify/spectrum

Usage

Simple Usage

// Instantiate a converter with default configuration
conv := spectrum.NewConverter(spectrum.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 := spectrum.Configuration{
	PostmanURLBase: "{{RINGCENTRAL_SERVER_URL}}",
	PostmanHeaders: []postman2.Header{
		{
			Key:   "Authorization",
			Value: "Bearer {{my_access_token}}",
		},
	},
}
conv = spectrum.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

More Repositories

1

html-strip-tags-go

export stripTags from html/template as strip.StripTags
Go
125
star
2

mogo

A collection of small DRY Go utilities to make life easier. DRY = Don't Repeat Yourself.
Go
61
star
3

chathooks

Service to convert webhook messages to your favorite chat / team messaging format. Run transparently as a formatting webhook proxy.
Go
38
star
4

gocharts

Go code to help create various charts, e.g. C3, D3, Rickshaw, go-chart, etc.
Go
36
star
5

goauth

Utility libraries for Go (aka Golang) API auth including OAuth 2, JWT, TLS Client Authentication and Basic Auth.
Go
24
star
6

go-scim-client

SCIM 2.0 API client auto-generated using RingCentral SCIM OpenAPI / Swagger 2.0 specification.
Go
12
star
7

ringcentral-sdk-ruby

RingCentral SDK in Ruby (https://developers.ringcentral.com)
Ruby
12
star
8

go-ringcentral-client

RingCentral Client SDK for Go: RingCentral Office, Engage Digital, Engage Voice
Go
11
star
9

sumologic-sdk-ruby

Sumo Logic SDK in Ruby
Ruby
10
star
10

faraday_middleware-oauth2_refresh

Faraday OAuth2 Request Middleware with Token Refresh
Ruby
9
star
11

go-metabase

Go Client SDK for Metabase - https://github.com/metabase/metabase
Go
8
star
12

beegoutil

OAuth 2.0 demo app for Beego using Google, Facebook, RingCentral and Aha!
Smarty
8
star
13

gophonenumbers

API Client and CLI app for numverify.com to verify phone number and list countries.
Go
8
star
14

ringcentral-cti-demo-js

A Call-Telephony Integration (CTI) demo for the RingCentral Connect Platform using the JavaScript SDK. For assistance, please use Stack Overflow (http://stackoverflow.com) or the RingCentral Developer Community (https://devcommunity.ringcentral.com).
HTML
7
star
15

go-awslambda

Helper code for AWS Lambda in Go
Go
6
star
16

commonchat

CommonChat is an idealized message format with conversion to chat systems such as Glip and Slack.
Go
6
star
17

go-pkce

Go library for OAuth 2.0 PKCE.
Go
5
star
18

go-wordpressxml

WordPress XML export parser in Go
Go
5
star
19

go-adaptivecards

Golang SDK for Adaptive Cards
Go
4
star
20

medium-sdk-ruby

Ruby SDK for Medium.com including OAuth 2.0 support and Swagger 2.0 spec
Ruby
4
star
21

elastirad-go

Elasticsearch client with JSON API interface in Go.
Go
4
star
22

groupbot

A Glipbot for managing team member information backed by a Google Sheet - https://glip.com
Go
4
star
23

base58-gmp-ruby

High speed Base58 encoding using GMP with BigInt and MD5 support
Ruby
4
star
24

go-salesforce

Library to download and manipulate Salesforce data on the file system
Go
4
star
25

go-glip

Inbound webhook client for Glip (https://glip.com) in Go
Go
4
star
26

go-ringcentral-engage

RingCentral Engage Digital / Dimelo SDK for Go - https://www.dimelo.com - https://engage-api-docs.rtfd.org
Go
4
star
27

ringcentral-demos-fax-cover-page

Create custom fax cover pages with the RingCentral fax API
C#
3
star
28

ringcentral-permahooks

Webhook proxy to turn RingCentral webhooks into permanent webhooks for use with services like Zapier Instant Triggers.
Go
3
star
29

glip-webhook-proxy-js

Inbound webhook proxy for Glip (https://glip.com) in JavaScript
JavaScript
3
star
30

lita-zendesk

A Zendesk handler for the Lita chatbot
Ruby
3
star
31

everbridge-sdk-go

Everbridge SDK
Go
3
star
32

fastly-compute-quickstart-swift

Quickstart for Swift on Fastly Compute@Edge
Swift
3
star
33

ringcentral-sdk-go

RingCentral SDK in Go (https://developers.ringcentral.com). Need help? Post your questions to http://stackoverflow.com/ or send email to [email protected].
Go
3
star
34

ringcentral-demos-webhooks

RingCentral demo apps for webhooks
HTML
3
star
35

webfonts

Game of Thrones web font based on font by Charlie Samways (http://charliesamways.carbonmade.com) converted by transfonter.org. Demo at https://grokify.github.io/webfonts/game-of-thrones
HTML
3
star
36

lita_dotenv

Load a Lita configuration from ENV and .env.
Ruby
2
star
37

go-visa

Visa.com API SDK
Go
2
star
38

go-airtable

Go
2
star
39

yamlutil

Utility libraries for YAML in Go. Initial functionality is to get line and column numbers for JSON pointers, as used in OpenAPI Spec.
Go
2
star
40

kibana-tutorial-go

Code for Kibana Getting Started Tutorial
Go
2
star
41

ringcentral-legacy-api-proxy

Proxy Service to convert legacy RingCentral RPC API requests to new REST API requests.
Go
2
star
42

lita-motionai

Lita Handler for Motion AI (https://motion.ai)
Ruby
2
star
43

ringcentral-sdk-csharp-simple

Simple SDK wrapper for RingCentral C# SDK (https://github.com/ringcentral/ringcentral-csharp). Need help? Post your questions to http://stackoverflow.com/ or email us at [email protected].
C#
2
star
44

go-aha

Go Client SDK for Aha! (aha.io) API.
Go
1
star
45

glip-bot-bootstrap

Easily create Glip bot webhooks for development. https://grokify.github.io/glip-bot-bootstrap/
HTML
1
star
46

go-stackoverflow

Go Client SDK for Stack Exchange / Stack Overflow
Go
1
star
47

ringcentral-ivr-data-dip-demo

IVR Data Dip Example
JavaScript
1
star
48

lita-inspirebot

Ruby
1
star
49

alexa-skill-ringcentral-go

Example RingCentral Skill Server for Amazon Alexa
Go
1
star
50

mime-builder-ruby

Builder for MIME parts
Ruby
1
star
51

ringcentral-docs-quickstart

1
star
52

awesome-go-wasm

Awesome Wasm List for Go!
Go
1
star
53

datasets

Go
1
star
54

broken-website

Test website to generate various errors for testing purposes.
HTML
1
star
55

go-twilio-examples

Collection of example apps in Go.
Go
1
star
56

go-http-redirect

Simple HTTP Redirector App written in Golang which supports Heroku
Go
1
star
57

gospeech

Diarization tools for speech recognition
Go
1
star
58

gameofthrones

Game of Thrones character and organization data. Includes example scripts to load demo data into various services like RingCentral, Salesforce and Pipedrive.
Go
1
star
59

ringcentral-appointment-reminder-demo

Go
1
star
60

fastly-guide-compute

An unofficial guide to Fastly Compute@Edge
1
star
61

chatblox

Building blocks for building chatbots
Go
1
star
62

elastirad-ruby

Elasticsearch client with JSON API interface in Ruby.
Ruby
1
star
63

ringcentral-sdk-vbs

Unofficial RingCentral for Developers SDK in VBScript
1
star
64

faraday_middleware-request-retry

Auto-retry requests based on 429, 503 and other responses.
Ruby
1
star
65

go-voicebase-v3

VoiceBase API v3 Client SDK in Go built using Swagger Codegen. This client uses the same major and minor versions as the Swagger codegen library. The maintenance version differs.
Go
1
star
66

web-widget-demo

Using the Web Widget with GitHub Pages and Salesforce Open CTI
HTML
1
star