requests

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 19 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

Overview

Package requests contains all the logic, models and interfaces for validating OpenAPI 3+ Requests. The package depends on *http.Request

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateRequestSchema

func ValidateRequestSchema(
	request *http.Request,
	schema *base.Schema,
	renderedSchema,
	jsonSchema []byte) (bool, []*errors.ValidationError)

ValidateRequestSchema will validate a http.Request pointer against a schema. If validation fails, it will return a list of validation errors as the second return value.

Types

type RequestBodyValidator

type RequestBodyValidator interface {

	// ValidateRequestBody will validate the request body for an operation. The first return value will be true if the
	// request body is valid, false if it is not. The second return value will be a slice of ValidationError pointers if
	// the body is not valid.
	ValidateRequestBody(request *http.Request) (bool, []*errors.ValidationError)

	// SetPathItem will set the pathItem for the RequestBodyValidator, all validations will be performed
	// against this pathItem otherwise if not set, each validation will perform a lookup for the pathItem
	// based on the *http.Request
	SetPathItem(path *v3.PathItem, pathValue string)
}

RequestBodyValidator is an interface that defines the methods for validating request bodies for Operations.

ValidateRequestBody method accepts an *http.Request and returns true if validation passed,
                    false if validation failed and a slice of ValidationError pointers.

func NewRequestBodyValidator

func NewRequestBodyValidator(document *v3.Document) RequestBodyValidator

NewRequestBodyValidator will create a new RequestBodyValidator from an OpenAPI 3+ document

Jump to

Keyboard shortcuts

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