openapi3postman2

package
v1.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildPostmanURL

func BuildPostmanURL(cfg Configuration, spec *openapi3.Spec, specPath string, operation *oas3.Operation) postman2.URL

func ConvertSpec

func ConvertSpec(cfg Configuration, oas3spec *openapi3.Spec) (postman2.Collection, error)

ConvertSpec creates a Postman 2.0 collection from a configuration and Swagger 2.0 spec

func CreateTagsAndTagGroups

func CreateTagsAndTagGroups(pman postman2.Collection, spec *openapi3.Spec) (postman2.Collection, error)

func Merge

func Merge(cfg Configuration, pman postman2.Collection, oas3spec *openapi3.Spec) (postman2.Collection, error)

Merge creates a Postman 2.0 collection from a configuration, base Postman 2.0 collection and Swagger 2.0 spec

func Openapi3OperationToPostman2APIItem

func Openapi3OperationToPostman2APIItem(cfg Configuration, oas3spec *openapi3.Spec, oasUrl string, method string, operation *oas3.Operation) (*postman2.Item, error)

func ParamsOpenAPI3ToPostman

func ParamsOpenAPI3ToPostman(oparams []*oas3.ParameterRef) postman2.URLParameters

ParamsOpenAPI3ToPostman returns a slices of Postman parameters for a slice of OpenAPI 3 parameters.

func PostmanURLAddDefaultsOAS3 added in v1.12.0

func PostmanURLAddDefaultsOAS3(pmanURL postman2.URL, operation *oas3.Operation) postman2.URL

Types

type Configuration

type Configuration struct {
	// PostmanServerURLBasePath supports setting the base path as an environment variable
	// such as {{MY_API_BASE_URL}}
	PostmanServerURLBasePath string            `json:"postmanServerUrlApiBasePath,omitempty"`
	PostmanServerURL         string            `json:"postmanServerUrl,omitempty"`
	PostmanURLHostname       string            `json:"postmanURLHostname,omitempty"`
	PostmanHeaders           []postman2.Header `json:"postmanHeaders,omitempty"`
	UseXTagGroups            bool              `json:"useXTagGroups,omitempty"`
	RequestBodyFunc          func(urlPath string) string
}

Configuration is a Spectrum configuration that holds information on how to create the Postman 2.0 collection including overriding Swagger 2.0 spec values.

func ConfigurationReadFile

func ConfigurationReadFile(filename string) (Configuration, error)

type Converter

type Converter struct {
	Configuration Configuration
	OpenAPISpec   *openapi3.Spec
}

Converter is the struct that manages the conversion.

func NewConverter

func NewConverter(cfg Configuration) Converter

NewConverter instantiates a new converter.

func (*Converter) ConvertFile

func (conv *Converter) ConvertFile(openapiFilepath string, pmanSpecFilepath string) error

ConvertFile builds a Postman 2.0 spec using an OpenAPI 3.0 spec.

func (*Converter) MergeConvert

func (conv *Converter) MergeConvert(openapiFilepath string, pmanBaseFilepath string, pmanSpecFilepath string) error

MergeConvert builds a Postman 2.0 spec using a base Postman 2.0 collection and a OpenAPI 3.0 spec.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL