api

package
v0.0.0-...-7f6939c Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidSemanticVersion

func IsValidSemanticVersion(v string) bool

IsValidSemanticVersion validates a version string.

Types

type APIVersion

type APIVersion struct {
	ServiceName     string           `json:"service_name"`
	Version         string           `json:"version"`
	Strategy        VersionStrategy  `json:"strategy"`
	Status          VersionStatus    `json:"status"`
	SupportedUntil  *time.Time       `json:"supported_until,omitempty"`
	MigrationPath   string           `json:"migration_path,omitempty"`
	BreakingChanges []BreakingChange `json:"breaking_changes"`
}

APIVersion holds metadata for a service version.

type APIVersionManager

type APIVersionManager struct {
	// contains filtered or unexported fields
}

APIVersionManager manages API versions.

func NewAPIVersionManager

func NewAPIVersionManager(db *sql.DB) *APIVersionManager

NewAPIVersionManager creates a new manager.

func (*APIVersionManager) CreateNewVersion

func (vm *APIVersionManager) CreateNewVersion(ctx context.Context, serviceName, currentVersion, newVersion string, changes []BreakingChange) (*APIVersion, error)

CreateNewVersion validates and stores a new version record.

type BreakingChange

type BreakingChange struct {
	Type        string
	Description string
	Impact      string
	Mitigation  string
}

BreakingChange describes a backward incompatible change.

type OpenAPIValidator

type OpenAPIValidator struct{}

OpenAPIValidator validates OpenAPI specifications.

func (*OpenAPIValidator) ValidateFile

func (v *OpenAPIValidator) ValidateFile(path string) error

ValidateFile loads and validates the specification at the given path.

type VersionStatus

type VersionStatus string

VersionStatus represents lifecycle state of a version.

const (
	VersionStatusDraft      VersionStatus = "draft"
	VersionStatusActive     VersionStatus = "active"
	VersionStatusDeprecated VersionStatus = "deprecated"
)

type VersionStrategy

type VersionStrategy string

VersionStrategy defines how clients select API versions.

const (
	VersionStrategyURL    VersionStrategy = "url"
	VersionStrategyHeader VersionStrategy = "header"
	VersionStrategyQuery  VersionStrategy = "query"
)

Jump to

Keyboard shortcuts

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