package schema

import "github.com/hashicorp/vault/sdk/helper/testhelpers/schema"

Index

Functions

func FindResponseSchema

func FindResponseSchema(t *testing.T, paths []*framework.Path, pathIdx int, operation logical.Operation) *framework.Response

FindResponseSchema is a test helper to extract response schema from the given framework path / operation.

func GetResponseSchema

func GetResponseSchema(t *testing.T, path *framework.Path, operation logical.Operation) *framework.Response

func ResponseValidatingCallback

func ResponseValidatingCallback(t *testing.T) func(logical.Backend, *logical.Request, *logical.Response)

ResponseValidatingCallback can be used in setting up a vault.TestCluster that validates every response against the openapi specifications.

func ValidateResponse

func ValidateResponse(t *testing.T, schema *framework.Response, response *logical.Response, strict bool)

ValidateResponse is a test helper that validates whether the given response object conforms to the response schema (schema.Fields). It cycles through the data map and validates conversions in the schema. In "strict" mode, this function will also ensure that the data map has all schema-required fields and does not have any fields outside of the schema.

func ValidateResponseData

func ValidateResponseData(t *testing.T, schema *framework.Response, data map[string]interface{}, strict bool)

ValidateResponseData is a test helper that validates whether the given response data map conforms to the response schema (schema.Fields). It cycles through the data map and validates conversions in the schema. In "strict" mode, this function will also ensure that the data map has all schema's requred fields and does not have any fields outside of the schema.

Source Files

response_validation.go

Version
v0.18.0 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
1 month ago

Tools for package owners.