mockData

package
v0.0.0-...-add256a Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	No          UseExamplesEnum = 0
	IfPresent                   = 1
	Exclusively                 = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data interface{}

type ErrGenerationFailed

type ErrGenerationFailed struct {
	GeneratorID string
	Message     string
	Path        string
	Previous    error
}

func (*ErrGenerationFailed) Error

func (err *ErrGenerationFailed) Error() string

func (*ErrGenerationFailed) Unwrap

func (err *ErrGenerationFailed) Unwrap() error

type MediaGenerator

type MediaGenerator interface {
	GenerateData(ctx context.Context, mediaType *openapi3.MediaType) (Data, error)
}

func New

func New(options Options) MediaGenerator

type MockjsGenerator

type MockjsGenerator struct {
	Random     randomGenerator
	Expression string
}

func (*MockjsGenerator) GenerateDataBySchema

func (g *MockjsGenerator) GenerateDataBySchema(ctx context.Context, schema *openapi3.Schema) (value Data, err error)

type Options

type Options struct {
	UseExamples     UseExamplesEnum
	NullProbability float64
	DefaultMinInt   int64
	DefaultMaxInt   int64
	DefaultMinFloat float64
	DefaultMaxFloat float64
	SuppressErrors  bool
}

type UseExamplesEnum

type UseExamplesEnum int

func (UseExamplesEnum) String

func (enum UseExamplesEnum) String() string

Jump to

Keyboard shortcuts

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