models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

type Mock struct {
	Name     string   `yaml:"name" json:"name" validate:"required"`
	Path     string   `yaml:"path" json:"path" validate:"required,validHTTPPath"`
	Method   string   `yaml:"method" json:"method" validate:"required,oneof=GET POST PUT PATCH DELETE OPTIONS HEAD"`
	Request  Request  `yaml:"request" json:"request" validate:"dive"`
	Response Response `yaml:"response" json:"response" validate:"required,dive"`
}

Mock is a struct for building endpoints for mocking

func (*Mock) Validate

func (m *Mock) Validate() error

Validate validates the Mock struct

type Mocks

type Mocks struct {
	Mocks []Mock `yaml:"mocks" validate:"dive"`
}

Mocks is a slice of Mock

func (*Mocks) Validate

func (m *Mocks) Validate() error

Validate validates the Mocks struct

type Request

type Request struct {
	Headers     map[string]string `yaml:"headers" json:"headers"`
	QueryParams map[string]string `yaml:"query_params" json:"query_params"`
	Cookies     map[string]string `yaml:"cookies" json:"cookies"`
	Body        string            `yaml:"body" json:"body"`
}

Request is the request for getting Response

type Response

type Response struct {
	Status  int               `yaml:"status" json:"status" validate:"required,min=100,max=599"`
	Headers map[string]string `yaml:"headers" json:"headers"`
	Cookies map[string]string `yaml:"cookies" json:"cookies"`
	Body    string            `yaml:"body" json:"body"`
}

Response is the response for Request

Jump to

Keyboard shortcuts

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