Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateContract ¶
func ValidateContract(contract *ContractTest) error
ValidateContract validates a contract
Types ¶
type ContractRequest ¶
type ContractRequest struct {
Method string `json:"method"`
Path string `json:"path"`
Headers map[string]string `json:"headers"`
Query map[string]string `json:"query"`
Body interface{} `json:"body"`
Timeout time.Duration `json:"timeout"`
}
ContractRequest defines the expected request
type ContractResponse ¶
type ContractResponse struct {
StatusCode int `json:"status_code"`
Headers map[string]string `json:"headers"`
Body interface{} `json:"body"`
Schema map[string]interface{} `json:"schema"`
}
ContractResponse defines the expected response
type ContractTest ¶
type ContractTest struct {
Name string `json:"name"`
Description string `json:"description"`
Provider string `json:"provider"`
Consumer string `json:"consumer"`
Request *ContractRequest `json:"request"`
Response *ContractResponse `json:"response"`
Metadata map[string]interface{} `json:"metadata"`
}
ContractTest defines a contract test
type ContractVerifier ¶
type ContractVerifier struct {
// contains filtered or unexported fields
}
ContractVerifier verifies API contracts
func NewContractVerifier ¶
func NewContractVerifier(baseURL string, logger *slog.Logger) *ContractVerifier
NewContractVerifier creates a new contract verifier
func (*ContractVerifier) VerifyContract ¶
func (cv *ContractVerifier) VerifyContract(ctx context.Context, contract *ContractTest) error
VerifyContract verifies a single contract
Click to show internal directories.
Click to hide internal directories.