parser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package snowboard API blueprint parser and renderer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTML

func HTML(tpl string, w io.Writer, b *api.API) error

HTML renders blueprint.API struct as HTML document

func Load

func Load(name string, engine Parser) (*api.API, error)

Load reads API blueprint from file as blueprint.API struct using selected Parser

func MockHandler

func MockHandler(ms MockTransactions) http.Handler

func Parse

func Parse(r io.Reader, engine Parser) (*api.API, error)

Parse formats API blueprint as blueprint.API struct using selected Parser

func Read

func Read(name string) ([]byte, error)

Read reads API blueprint from file as bytes

func Validate

func Validate(r io.Reader, engine Parser) (*api.API, error)

Validate validates API blueprint using selected Parser

Types

type MockTransaction

type MockTransaction struct {
	Path        string
	Method      string
	StatusCode  int
	ContentType string
	Body        string
}

func Mock

func Mock(b *api.API) []*MockTransaction

type MockTransactions

type MockTransactions []*MockTransaction

func (MockTransactions) Router

func (ms MockTransactions) Router() *mockRouter

type Parser

type Parser interface {
	Parse(r io.Reader) ([]byte, error)
	Validate(r io.Reader) ([]byte, error)
	Version() string
}

Jump to

Keyboard shortcuts

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