testutil

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package testutil provides test utilities and fixtures for unit tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDetailedOAS2Document

func NewDetailedOAS2Document() *parser.OAS2Document

NewDetailedOAS2Document creates a complete OAS 2.0 document with common features for testing. Includes paths, operations, schemas, and definitions.

func NewDetailedOAS3Document

func NewDetailedOAS3Document() *parser.OAS3Document

NewDetailedOAS3Document creates a complete OAS 3.x document with common features for testing. Includes paths, operations, schemas, and components.

func NewSimpleOAS2Document

func NewSimpleOAS2Document() *parser.OAS2Document

NewSimpleOAS2Document creates a minimal OAS 2.0 document for testing. Contains only required fields: swagger, info, host, basePath, schemes, paths.

func NewSimpleOAS3Document

func NewSimpleOAS3Document() *parser.OAS3Document

NewSimpleOAS3Document creates a minimal OAS 3.x document for testing. Contains only required fields: openapi, info, paths, servers.

func WriteTempJSON

func WriteTempJSON(t *testing.T, doc any) string

WriteTempJSON marshals a document to JSON and writes it to a temporary file. Returns the path to the temporary file. The file is automatically cleaned up when the test completes (via t.TempDir).

func WriteTempYAML

func WriteTempYAML(t *testing.T, doc any) string

WriteTempYAML marshals a document to YAML and writes it to a temporary file. Returns the path to the temporary file. The file is automatically cleaned up when the test completes (via t.TempDir).

Types

This section is empty.

Jump to

Keyboard shortcuts

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