apiversion

package
v0.0.65 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StableStabilityLevel         = "stable"
	PreviewStabilityLevel        = "preview"
	UpcomingStabilityLevel       = "upcoming"
	PrivatePreviewStabilityLevel = "private-preview"
	PublicPreviewStabilityLevel  = "public-preview"
)

Variables

This section is empty.

Functions

func DateFromVersion

func DateFromVersion(version string) (time.Time, error)

func FindMatchesFromContentType

func FindMatchesFromContentType(contentType string) []string

func GetPreviewVersionName

func GetPreviewVersionName(contentTypeValue *openapi3.MediaType) (name string, err error)

GetPreviewVersionName returns the preview version name.

func IsPreviewStabilityLevel

func IsPreviewStabilityLevel(value string) bool

IsPreviewStabilityLevel checks if the version is a preview version, public or private.

func IsPrivatePreviewStabilityLevel

func IsPrivatePreviewStabilityLevel(value string) bool

IsPrivatePreviewStabilityLevel checks if the version is a private preview version.

func IsPublicPreviewStabilityLevel

func IsPublicPreviewStabilityLevel(value string) bool

IsPublicPreviewStabilityLevel checks if the version is a public preview version.

func IsStableStabilityLevel

func IsStableStabilityLevel(value string) bool

IsStableStabilityLevel checks if the version is a stable version.

func IsUpcomingStabilityLevel

func IsUpcomingStabilityLevel(value string) bool

IsUpcomingStabilityLevel checks if the version is an "upcoming" version.

func Parse

func Parse(contentType string) (string, error)

Parse extracts the version date from the content type.

func ReplaceContentType

func ReplaceContentType(contentType, replacement string) string

func Sort

func Sort(versions []*APIVersion)

Sort versions.

func ValidateStabilityLevel

func ValidateStabilityLevel(value string) error

ValidateStabilityLevel checks if the version is a valid stability level.

Types

type APIVersion

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

func FindLatestContentVersionMatched

func FindLatestContentVersionMatched(op *openapi3.Operation, requestedVersion *APIVersion) *APIVersion

FindLatestContentVersionMatched finds the latest content version that matches the requested version.

func New

func New(opts ...Option) (*APIVersion, error)

New creates a new API version.

func (*APIVersion) Date

func (v *APIVersion) Date() time.Time

func (*APIVersion) Equal

func (v *APIVersion) Equal(v2 *APIVersion) bool

func (*APIVersion) ExactMatchOnly

func (v *APIVersion) ExactMatchOnly() bool

func (*APIVersion) GreaterThan

func (v *APIVersion) GreaterThan(v2 *APIVersion) bool

func (*APIVersion) IsPreview

func (v *APIVersion) IsPreview() bool

func (*APIVersion) IsPrivatePreview

func (v *APIVersion) IsPrivatePreview() bool

func (*APIVersion) IsPublicPreview

func (v *APIVersion) IsPublicPreview() bool

func (*APIVersion) IsStable

func (v *APIVersion) IsStable() bool

func (*APIVersion) IsUpcoming

func (v *APIVersion) IsUpcoming() bool

func (*APIVersion) IsZero

func (v *APIVersion) IsZero() bool

func (*APIVersion) LessThan

func (v *APIVersion) LessThan(v2 *APIVersion) bool

func (*APIVersion) StabilityLevel

func (v *APIVersion) StabilityLevel() string

func (*APIVersion) String

func (v *APIVersion) String() string

type Option

type Option func(v *APIVersion) error

Option is a function that sets a value on the APIVersion.

func WithDate

func WithDate(date time.Time) Option

WithDate sets the version on the APIVersion.

func WithFullContent

func WithFullContent(contentType string, contentValue *openapi3.MediaType) Option

WithFullContent returns an Option to generate a new APIVersion given the contentType and contentValue.

func WithVersion

func WithVersion(version string) Option

WithVersion sets the version on the APIVersion.

Jump to

Keyboard shortcuts

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