Documentation
¶
Overview ¶
Package openapi provides OpenAPI specification parsing functionality. It extracts endpoint definitions from OpenAPI 3.0 specs for use in load testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsJSONContentType ¶
IsJSONContentType reports whether a media type is JSON-compatible.
func ResolvePath ¶
ResolvePath replaces path parameters with provided values. Parameters not found in the values map are replaced with placeholder values based on their type (e.g., "1" for integers, "test" for strings).
EXAMPLE:
path: "/users/{id}/posts/{postId}"
values: map[string]string{"id": "123"}
result: "/users/123/posts/1" (postId gets default integer placeholder)
Types ¶
type Endpoint ¶
type Endpoint struct {
Method string // HTTP method (GET, POST, PUT, DELETE, etc.)
Path string // URL path pattern (e.g., "/users/{id}")
OperationID string // Unique operation identifier from the spec
Parameters []Parameter // Path, query, and header parameters
ContentType string // JSON request content type when payload generation succeeds
Body []byte // Generated JSON request payload when requestBody synthesis succeeds
HasBody bool // Whether the endpoint expects a request body
Tags []string // Grouping tags from the spec
}
Endpoint represents a single API endpoint extracted from the OpenAPI spec. It contains all necessary information to construct HTTP requests during load testing.
type Parameter ¶
type Parameter struct {
Name string // Parameter name
In string // Location: "path", "query", "header", "cookie"
Required bool // Whether the parameter is required
Type string // Data type (string, integer, etc.)
Example any // Example value from the spec, if available
}
Parameter represents a single parameter definition from the OpenAPI spec.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser handles OpenAPI specification parsing.