Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFileClient ¶
NewFileClient returns a test client implementing the openapi.Client interface, which serves a subset of hard-coded GroupVersion Open API V3 specifications files. The subset of specifications is located in the "testdata" subdirectory.
Types ¶
type FakeClient ¶
type FakeClient struct { // Hard-coded paths to return from Paths() function. PathsMap map[string]openapi.GroupVersion // Hard-coded returned error. ForcedErr error }
FakeClient implements openapi.Client interface, with hard-coded return values, including the possibility to force errors.
func NewFakeClient ¶
func NewFakeClient() *FakeClient
NewFakeClient returns a fake openapi client with an empty PathsMap.
func (FakeClient) Paths ¶
func (f FakeClient) Paths() (map[string]openapi.GroupVersion, error)
Paths returns stored PathsMap field, creating an empty one if it does not already exist. If ForcedErr is set, this function returns the error instead.
type FakeGroupVersion ¶
type FakeGroupVersion struct { // Hard-coded GroupVersion specification GVSpec []byte // Hard-coded returned error. ForcedErr error }
FakeGroupVersion implements openapi.GroupVersion with hard-coded return GroupVersion specification bytes. If ForcedErr is set, then "Schema()" function returns the error instead of the GVSpec.
func (FakeGroupVersion) Schema ¶
func (f FakeGroupVersion) Schema(contentType string) ([]byte, error)
Schema returns the hard-coded byte slice, including creating an empty slice if it has not been set yet. If the ForcedErr is set, this function returns the error instead of the GVSpec field. If content type other than application/json is passed, and error is returned.