issues

package
v1.51.5 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package issues provides a unified issue type for validation and conversion problems.

Package issues provides a unified issue type for validation and conversion problems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	// Path is the JSON path to the problematic field (e.g., "paths./pets.get.responses")
	Path string
	// Message is a human-readable description of the issue
	Message string
	// Severity indicates the severity level of the issue
	Severity severity.Severity
	// Field is the specific field name that has the issue
	Field string
	// Value is the problematic value (optional)
	Value any
	// SpecRef is the URL to the relevant section of the OAS specification (optional, validation use)
	SpecRef string
	// Context provides additional information about the issue (optional, conversion use)
	Context string
	// Line is the 1-based line number in the source file (0 if unknown)
	Line int
	// Column is the 1-based column number in the source file (0 if unknown)
	Column int
	// File is the source file path (empty for main document)
	File string
	// OperationContext provides API operation context when the issue relates to
	// an operation or a component referenced by operations. Nil when not applicable.
	OperationContext *OperationContext
}

Issue represents a single problem found during validation or conversion.

func (Issue) HasLocation added in v1.27.0

func (i Issue) HasLocation() bool

HasLocation returns true if this issue has source location information.

func (Issue) Location added in v1.27.0

func (i Issue) Location() string

Location returns the source location in IDE-friendly format. Returns "file:line:column" if file is set, "line:column" if only line is set, or the JSON path if location is unknown.

func (Issue) String

func (i Issue) String() string

String returns a formatted string representation of the issue. Uses different symbols based on severity level: - "✗" for Error or Critical severity - "⚠" for Warning severity - "ℹ" for Info severity

type OperationContext added in v1.46.0

type OperationContext struct {
	// Method is the HTTP method (GET, POST, etc.) - empty for path-level issues
	Method string
	// Path is the API path pattern (e.g., "/users/{id}") or webhook name
	Path string
	// OperationID is the operationId if defined (may be empty)
	OperationID string
	// IsReusableComponent is true when the issue is in components/definitions
	IsReusableComponent bool
	// IsWebhook is true when the issue is in a webhook operation
	IsWebhook bool
	// AdditionalRefs is the count of other operations referencing this component.
	// Only relevant when IsReusableComponent is true.
	// -1 indicates the component is unused (not referenced by any operation).
	AdditionalRefs int
}

OperationContext provides API operation context for validation issues. For issues under paths.*, it identifies the specific operation. For issues outside paths.*, it shows which operations reference the component.

func (OperationContext) IsEmpty added in v1.46.0

func (c OperationContext) IsEmpty() bool

IsEmpty returns true if the context has no meaningful information.

func (OperationContext) String added in v1.46.0

func (c OperationContext) String() string

String returns a formatted string representation of the operation context. Returns empty string if the context is empty.

Jump to

Keyboard shortcuts

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