openapi

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadOpenAPISpec

func LoadOpenAPISpec(ctx context.Context, location string) (*openapi3.T, routers.Router, error)

LoadOpenAPISpec loads an openAPI file, parses it and validates data.

Types

type Template

type Template struct {
	Method string
	Path   string
	URL    string

	PathParameters        map[string]*parameterSpec
	QueryParameters       map[string]*parameterSpec
	Headers               map[string]*parameterSpec
	RequestBodyParameters map[string]*parameterSpec

	RequestBody map[string]string

	Doc *openapi3.T

	Placeholders map[string]interface{}
}

Template contains all information about template.

func (*Template) CreateRequest

func (t *Template) CreateRequest(ctx context.Context, placeholder string, payload string) (*http.Request, error)

CreateRequest generates a new request with the payload substituted as the placeholder value.

type Templates

type Templates map[string][]*Template

Templates contains all templates generated from OpenAPI file. Templates are sorted by placeholders that can be used to substitute a malicious vector.

func NewTemplates

func NewTemplates(openapiDoc *openapi3.T, basePath string) (Templates, error)

NewTemplates parses OpenAPI document and returns all possible templates.

Jump to

Keyboard shortcuts

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