model

package
v0.31.1 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 14 Imported by: 17

Documentation

Overview

Package model

What-changed models are unified across OpenAPI and Swagger. Everything is kept flat for simplicity, so please excuse the size of the package. There is a lot of data to crunch!

Every model in here is either universal (works across both versions of OpenAPI) or is bound to a specific version of OpenAPI. There is only a single model however - so version specific objects are marked accordingly.

Index

Constants

View Source
const (
	CompCallback            = "callback"
	CompComponents          = "components"
	CompContact             = "contact"
	CompDiscriminator       = "discriminator"
	CompEncoding            = "encoding"
	CompExample             = "example"
	CompExternalDocs        = "externalDocs"
	CompHeader              = "header"
	CompInfo                = "info"
	CompJSONSchemaDialect   = "jsonSchemaDialect"
	CompLicense             = "license"
	CompLink                = "link"
	CompMediaType           = "mediaType"
	CompOAuthFlow           = "oauthFlow"
	CompOAuthFlows          = "oauthFlows"
	CompOpenAPI             = "openapi"
	CompOperation           = "operation"
	CompParameter           = "parameter"
	CompPathItem            = "pathItem"
	CompPaths               = "paths"
	CompRequestBody         = "requestBody"
	CompResponse            = "response"
	CompResponses           = "responses"
	CompSchema              = "schema"
	CompSchemas             = "schemas"
	CompSecurity            = "security"
	CompSecurityRequirement = "securityRequirement"
	CompServers             = "servers"
	CompSelf                = "$self"
	CompTags                = "tags"
	CompSecurityScheme      = "securityScheme"
	CompServer              = "server"
	CompServerVariable      = "serverVariable"
	CompTag                 = "tag"
	CompXML                 = "xml"
)

Component name constants for breaking change rule lookups. These match the JSON keys used in BreakingRulesConfig.

View Source
const (
	PropAdditionalOperations = "additionalOperations"
	PropAdditionalProperties = "additionalProperties"
	PropAllOf                = "allOf"
	PropAllowEmptyValue      = "allowEmptyValue"
	PropAllowReserved        = "allowReserved"
	PropAnyOf                = "anyOf"
	PropAttribute            = "attribute"
	PropAuthorizationCode    = "authorizationCode"
	PropAuthorizationURL     = "authorizationUrl"
	PropBearerFormat         = "bearerFormat"
	PropCallbacks            = "callbacks"
	PropCodes                = "codes"
	PropClientCredentials    = "clientCredentials"
	PropCollectionFormat     = "collectionFormat"
	PropComment              = "$comment"
	PropConst                = "const"
	PropContact              = "contact"
	PropContains             = "contains"
	PropContentEncoding      = "contentEncoding"
	PropContentMediaType     = "contentMediaType"
	PropContentSchema        = "contentSchema"
	PropContentType          = "contentType"
	PropDataValue            = "dataValue"
	PropDefault              = "default"
	PropDefaultMapping       = "defaultMapping"
	PropDelete               = "delete"
	PropDeprecated           = "deprecated"
	PropDependentRequired    = "dependentRequired"
	PropDescription          = "description"
	PropDevice               = "device"
	PropDiscriminator        = "discriminator"
	PropDynamicAnchor        = "$dynamicAnchor"
	PropDynamicRef           = "$dynamicRef"
	PropId                   = "$id"
	PropElse                 = "else"
	PropEmail                = "email"
	PropEnum                 = "enum"
	PropExample              = "example"
	PropExamples             = "examples"
	PropExclusiveMaximum     = "exclusiveMaximum"
	PropExclusiveMinimum     = "exclusiveMinimum"
	PropExplode              = "explode"
	PropExpressions          = "expressions"
	PropExternalDocs         = "externalDocs"
	PropExternalValue        = "externalValue"
	PropFlow                 = "flow"
	PropFlows                = "flows"
	PropFormat               = "format"
	PropGet                  = "get"
	PropHead                 = "head"
	PropIdentifier           = "identifier"
	PropIf                   = "if"
	PropImplicit             = "implicit"
	PropIn                   = "in"
	PropItems                = "items"
	PropItemEncoding         = "itemEncoding"
	PropItemSchema           = "itemSchema"
	PropKind                 = "kind"
	PropLicense              = "license"
	PropMapping              = "mapping"
	PropMaxItems             = "maxItems"
	PropMaxLength            = "maxLength"
	PropMaxProperties        = "maxProperties"
	PropMaximum              = "maximum"
	PropMinItems             = "minItems"
	PropMinLength            = "minLength"
	PropMinProperties        = "minProperties"
	PropMinimum              = "minimum"
	PropMultipleOf           = "multipleOf"
	PropName                 = "name"
	PropNamespace            = "namespace"
	PropNodeType             = "nodeType"
	PropNot                  = "not"
	PropNullable             = "nullable"
	PropOAuth2MetadataUrl    = "oauth2MetadataUrl"
	PropOneOf                = "oneOf"
	PropOpenIDConnectURL     = "openIdConnectUrl"
	PropOperationID          = "operationId"
	PropOperationRef         = "operationRef"
	PropOptions              = "options"
	PropParameters           = "parameters"
	PropParent               = "parent"
	PropPassword             = "password"
	PropPatch                = "patch"
	PropPath                 = "path"
	PropPattern              = "pattern"
	PropPost                 = "post"
	PropPrefix               = "prefix"
	PropPrefixItems          = "prefixItems"
	PropProperties           = "properties"
	PropPropertyName         = "propertyName"
	PropPropertyNames        = "propertyNames"
	PropPut                  = "put"
	PropQuery                = "query"
	PropReadOnly             = "readOnly"
	PropRef                  = "$ref"
	PropRefreshURL           = "refreshUrl"
	PropRequired             = "required"
	PropRequestBody          = "requestBody"
	PropResponses            = "responses"
	PropScheme               = "scheme"
	PropSchemaDialect        = "schemaDialect"
	PropSchemas              = "schemas"
	PropSchemes              = "schemes"
	PropSchema               = "schema"
	PropScopes               = "scopes"
	PropSecurity             = "security"
	PropSelf                 = "$self"
	PropSerializedValue      = "serializedValue"
	PropServer               = "server"
	PropServers              = "servers"
	PropStyle                = "style"
	PropSummary              = "summary"
	PropTags                 = "tags"
	PropTermsOfService       = "termsOfService"
	PropThen                 = "then"
	PropTitle                = "title"
	PropTokenURL             = "tokenUrl"
	PropTrace                = "trace"
	PropType                 = "type"
	PropUnevaluatedItems     = "unevaluatedItems"
	PropUnevaluatedProps     = "unevaluatedProperties"
	PropUniqueItems          = "uniqueItems"
	PropURL                  = "url"
	PropValue                = "value"
	PropVersion              = "version"
	PropVocabulary           = "$vocabulary"
	PropWrapped              = "wrapped"
	PropWriteOnly            = "writeOnly"
	PropXML                  = "xml"
)

Property name constants for breaking change rule lookups. These match the JSON keys used in the various *Rules structs.

View Source
const (
	ChangeTypeAdded    = "added"
	ChangeTypeModified = "modified"
	ChangeTypeRemoved  = "removed"
)

ChangeType constants for IsBreaking lookup

View Source
const (

	// Modified means that was a modification of a value was made
	Modified = iota + 1

	// PropertyAdded means that a new property to an object was added
	PropertyAdded

	// ObjectAdded means that a new object was added to a parent object
	ObjectAdded

	// ObjectRemoved means that an object was removed from a parent object
	ObjectRemoved

	// PropertyRemoved means that a property of an object was removed
	PropertyRemoved
)

Definitions of the possible changes between two items

View Source
const (
	HashPh    = "%x"
	EMPTY_STR = ""
)

Variables

This section is empty.

Functions

func BreakingAdded added in v0.29.0

func BreakingAdded(component, property string) bool

BreakingAdded returns whether adding the specified property is a breaking change.

func BreakingModified added in v0.29.0

func BreakingModified(component, property string) bool

BreakingModified returns whether modifying the specified property is a breaking change.

func BreakingRemoved added in v0.29.0

func BreakingRemoved(component, property string) bool

BreakingRemoved returns whether removing the specified property is a breaking change.

func CheckForAddition

func CheckForAddition[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)

CheckForAddition will check left and right yaml.Node instances for changes. Anything that is found missing on the left, but present on the right, is considered an addition. A new Change[T] will be created with the type

PropertyAdded

The Change is then added to the slice of []Change[T] instances provided as a pointer.

func CheckForAdditionWithEncoding added in v0.29.0

func CheckForAdditionWithEncoding[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)

CheckForAdditionWithEncoding checks for additions with YAML encoding.

func CheckForModification

func CheckForModification[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)

CheckForModification will check left and right yaml.Node instances for changes. Anything that is found in both sides, but vary in value is considered a modification.

If there is a change in value the function adds a change type of Modified.

The Change is then added to the slice of []Change[T] instances provided as a pointer.

func CheckForModificationWithEncoding added in v0.29.0

func CheckForModificationWithEncoding[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)

CheckForModificationWithEncoding checks for modifications with YAML encoding.

func CheckForObjectAdditionOrRemoval

func CheckForObjectAdditionOrRemoval[T any](l, r map[string]*low.ValueReference[T], label string, changes *[]*Change,
	breakingAdd, breakingRemove bool,
)

CheckForObjectAdditionOrRemoval will check for the addition or removal of an object from left and right maps. The label is the key to look for in the left and right maps.

To determine this a breaking change for an addition then set breakingAdd to true (however I can't think of many scenarios that adding things should break anything). Removals are generally breaking, except for non contract properties like descriptions, summaries and other non-binding values, so a breakingRemove value can be tuned for these circumstances.

func CheckForObjectAdditionOrRemovalWithEncoding added in v0.29.0

func CheckForObjectAdditionOrRemovalWithEncoding[T any](l, r map[string]*low.ValueReference[T], label string, changes *[]*Change,
	breakingAdd, breakingRemove bool,
)

CheckForObjectAdditionOrRemovalWithEncoding is like CheckForObjectAdditionOrRemoval but populates encoded fields. Use this for extensions where complex values need to be serialized to YAML.

func CheckForRemoval

func CheckForRemoval[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)

CheckForRemoval will check left and right yaml.Node instances for changes. Anything that is found missing on the right, but present on the left, is considered a removal. A new Change[T] will be created with the type

PropertyRemoved

The Change is then added to the slice of []Change[T] instances provided as a pointer.

func CheckForRemovalWithEncoding added in v0.29.0

func CheckForRemovalWithEncoding[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)

CheckForRemovalWithEncoding checks for removals with YAML encoding.

func CheckMapForAdditionRemoval

func CheckMapForAdditionRemoval[T any](expLeft, expRight *orderedmap.Map[low.KeyReference[string], low.ValueReference[T]],
	changes *[]*Change, label string,
) any

CheckMapForAdditionRemoval checks a left and right low level map for any additions or subtractions, but not modifications

func CheckMapForChanges

func CheckMapForChanges[T any, R any](expLeft, expRight *orderedmap.Map[low.KeyReference[string], low.ValueReference[T]],
	changes *[]*Change, label string, compareFunc func(l, r T) R,
) map[string]R

CheckMapForChanges checks a left and right low level map for any additions, subtractions or modifications to values. The compareFunc argument should reference the correct comparison function for the generic type. Uses original hardcoded breaking behavior (removals breaking, additions non-breaking).

func CheckMapForChangesWithComp

func CheckMapForChangesWithComp[T any, R any](expLeft, expRight *orderedmap.Map[low.KeyReference[string], low.ValueReference[T]],
	changes *[]*Change, label string, compareFunc func(l, r T) R, compare bool,
) map[string]R

CheckMapForChangesWithComp checks a left and right low level map for any additions, subtractions or modifications to values. The compareFunc argument should reference the correct comparison function for the generic type. The compare bit determines if the comparison should be run or not. Deprecated: Use checkMapForChangesInternal with explicit breaking parameters instead.

func CheckMapForChangesWithNilSupport added in v0.30.0

func CheckMapForChangesWithNilSupport[T any, R any](expLeft, expRight *orderedmap.Map[low.KeyReference[string], low.ValueReference[T]],
	changes *[]*Change, label string, compareFunc func(l, r T) R,
) map[string]R

CheckMapForChangesWithNilSupport checks a left and right low level map for any additions, subtractions or modifications. Unlike CheckMapForChanges, this function calls compareFunc for added/removed items by passing nil for the missing side. The compareFunc MUST handle nil inputs gracefully (return appropriate changes for added/removed cases). This allows the returned map to include entries for added/removed items, enabling proper tree rendering.

func CheckMapForChangesWithRules added in v0.30.0

func CheckMapForChangesWithRules[T any, R any](expLeft, expRight *orderedmap.Map[low.KeyReference[string], low.ValueReference[T]],
	changes *[]*Change, label string, compareFunc func(l, r T) R, component, property string,
) map[string]R

CheckMapForChangesWithRules checks a left and right low level map for any additions, subtractions or modifications to values, using the configurable breaking rules system for the specified component and property.

func CheckProperties

func CheckProperties(properties []*PropertyCheck)

CheckProperties will iterate through a slice of PropertyCheck pointers of type T. The method is a convenience method for running checks on the following methods in order:

CheckPropertyAdditionOrRemoval
CheckForModification

When PropertyCheck has Component set, the configurable breaking rules system is used to look up the correct breaking value for each change type (added, modified, removed).

func CheckPropertiesWithEncoding added in v0.29.0

func CheckPropertiesWithEncoding(properties []*PropertyCheck)

CheckPropertiesWithEncoding is like CheckProperties but uses CreateChangeWithEncoding for complex values. Use this for extensions where YAML serialization is needed.

func CheckPropertyAdditionOrRemoval

func CheckPropertyAdditionOrRemoval[T any](l, r *yaml.Node,
	label string, changes *[]*Change, breaking bool, orig, new T,
)

CheckPropertyAdditionOrRemoval will run both CheckForRemoval (first) and CheckForAddition (second)

func CheckPropertyAdditionOrRemovalWithEncoding added in v0.29.0

func CheckPropertyAdditionOrRemovalWithEncoding[T any](l, r *yaml.Node,
	label string, changes *[]*Change, breaking bool, orig, new T,
)

CheckPropertyAdditionOrRemovalWithEncoding checks for additions and removals with encoding.

func CheckSpecificObjectAdded

func CheckSpecificObjectAdded[T any](l, r map[string]*T, label string) bool

CheckSpecificObjectAdded returns true if a specific value is not in both maps.

func CheckSpecificObjectRemoved

func CheckSpecificObjectRemoved[T any](l, r map[string]*T, label string) bool

CheckSpecificObjectRemoved returns true if a specific value is not in both maps.

func CountBreakingChanges

func CountBreakingChanges(changes []*Change) int

CountBreakingChanges counts the number of changes in a slice that are breaking

func CreateChange

func CreateChange(changes *[]*Change, changeType int, property string, leftValueNode, rightValueNode *yaml.Node,
	breaking bool, originalObject, newObject any,
) *[]*Change

CreateChange is a generic function that will create a Change of type T, populate all properties if set and then add a pointer to Change[T] in the slice of Change pointers provided

func CreateChangeWithEncoding added in v0.29.0

func CreateChangeWithEncoding(changes *[]*Change, changeType int, property string, leftValueNode, rightValueNode *yaml.Node,
	breaking bool, originalObject, newObject any,
) *[]*Change

CreateChangeWithEncoding is like CreateChange but also populates the encoded fields for complex values. use this ONLY for extensions or other cases where complex YAML structures need to be serialized. the encoded values are serialized to YAML format.

func ExtractRawValueSliceChanges

func ExtractRawValueSliceChanges[T any](lParam, rParam []low.ValueReference[T],
	changes *[]*Change, label string, breaking bool,
)

ExtractRawValueSliceChanges will compare two low level interface{} slices for changes.

func ExtractStringValueSliceChanges

func ExtractStringValueSliceChanges(lParam, rParam []low.ValueReference[string],
	changes *[]*Change, label string, breaking bool,
)

ExtractStringValueSliceChanges will compare two low level string slices for changes. The breaking parameter is deprecated - use ExtractStringValueSliceChangesWithRules instead.

func ExtractStringValueSliceChangesWithRules added in v0.30.0

func ExtractStringValueSliceChangesWithRules(lParam, rParam []low.ValueReference[string],
	changes *[]*Change, label string, component, property string,
)

ExtractStringValueSliceChangesWithRules compares two low level string slices for changes, using the configurable breaking rules system to determine breaking status.

func FlattenLowLevelOrderedMap added in v0.14.0

func FlattenLowLevelOrderedMap[T any](
	lowMap *orderedmap.Map[low.KeyReference[string], low.ValueReference[T]],
) map[string]*low.ValueReference[T]

func IsBreakingChange added in v0.29.0

func IsBreakingChange(component, property, changeType string) bool

IsBreakingChange is a package-level helper that looks up whether a change is breaking using the currently active configuration.

func PreserveParameterReference added in v0.29.0

func PreserveParameterReference[T any](lRefs, rRefs map[string]*low.ValueReference[T], name string, changes ChangeIsReferenced)

PreserveParameterReference checks if a parameter is a reference and preserves it on the changes object. This eliminates duplicate reference preservation logic in operation.go and path_item.go.

func ResetActiveBreakingRulesConfig added in v0.29.0

func ResetActiveBreakingRulesConfig()

ResetActiveBreakingRulesConfig clears any custom config and reverts to defaults.

func ResetDefaultBreakingRules added in v0.29.0

func ResetDefaultBreakingRules()

ResetDefaultBreakingRules resets the cached default rules. This is primarily intended for testing scenarios where the cache needs to be cleared.

func SetActiveBreakingRulesConfig added in v0.29.0

func SetActiveBreakingRulesConfig(config *BreakingRulesConfig)

SetActiveBreakingRulesConfig sets the active breaking rules configuration used by comparison functions. Pass nil to reset to defaults.

func SetReferenceIfExists added in v0.28.2

func SetReferenceIfExists[T any](value *low.ValueReference[T], changeObj any)

SetReferenceIfExists checks if a low-level value has a reference and sets it on the change object if the change object implements the ChangeIsReferenced interface.

Types

type BreakingChangeRule added in v0.29.0

type BreakingChangeRule struct {
	Added    *bool `json:"added,omitempty" yaml:"added,omitempty"`
	Modified *bool `json:"modified,omitempty" yaml:"modified,omitempty"`
	Removed  *bool `json:"removed,omitempty" yaml:"removed,omitempty"`
}

BreakingChangeRule holds the breaking status for a property's change types. nil values mean "use default" - only set values override the defaults.

type BreakingRulesConfig added in v0.29.0

type BreakingRulesConfig struct {
	OpenAPI             *BreakingChangeRule       `json:"openapi,omitempty" yaml:"openapi,omitempty"`
	JSONSchemaDialect   *BreakingChangeRule       `json:"jsonSchemaDialect,omitempty" yaml:"jsonSchemaDialect,omitempty"`
	Self                *BreakingChangeRule       `json:"$self,omitempty" yaml:"$self,omitempty"`
	Components          *BreakingChangeRule       `json:"components,omitempty" yaml:"components,omitempty"`
	Info                *InfoRules                `json:"info,omitempty" yaml:"info,omitempty"`
	Contact             *ContactRules             `json:"contact,omitempty" yaml:"contact,omitempty"`
	License             *LicenseRules             `json:"license,omitempty" yaml:"license,omitempty"`
	Paths               *PathsRules               `json:"paths,omitempty" yaml:"paths,omitempty"`
	PathItem            *PathItemRules            `json:"pathItem,omitempty" yaml:"pathItem,omitempty"`
	Operation           *OperationRules           `json:"operation,omitempty" yaml:"operation,omitempty"`
	Parameter           *ParameterRules           `json:"parameter,omitempty" yaml:"parameter,omitempty"`
	RequestBody         *RequestBodyRules         `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Responses           *ResponsesRules           `json:"responses,omitempty" yaml:"responses,omitempty"`
	Response            *ResponseRules            `json:"response,omitempty" yaml:"response,omitempty"`
	MediaType           *MediaTypeRules           `json:"mediaType,omitempty" yaml:"mediaType,omitempty"`
	Encoding            *EncodingRules            `json:"encoding,omitempty" yaml:"encoding,omitempty"`
	Header              *HeaderRules              `json:"header,omitempty" yaml:"header,omitempty"`
	Schema              *SchemaRules              `json:"schema,omitempty" yaml:"schema,omitempty"`
	Schemas             *BreakingChangeRule       `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	Servers             *BreakingChangeRule       `json:"servers,omitempty" yaml:"servers,omitempty"`
	Discriminator       *DiscriminatorRules       `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`
	XML                 *XMLRules                 `json:"xml,omitempty" yaml:"xml,omitempty"`
	Server              *ServerRules              `json:"server,omitempty" yaml:"server,omitempty"`
	ServerVariable      *ServerVariableRules      `json:"serverVariable,omitempty" yaml:"serverVariable,omitempty"`
	Tags                *BreakingChangeRule       `json:"tags,omitempty" yaml:"tags,omitempty"`
	Tag                 *TagRules                 `json:"tag,omitempty" yaml:"tag,omitempty"`
	Security            *BreakingChangeRule       `json:"security,omitempty" yaml:"security,omitempty"`
	ExternalDocs        *ExternalDocsRules        `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	SecurityScheme      *SecuritySchemeRules      `json:"securityScheme,omitempty" yaml:"securityScheme,omitempty"`
	SecurityRequirement *SecurityRequirementRules `json:"securityRequirement,omitempty" yaml:"securityRequirement,omitempty"`
	OAuthFlows          *OAuthFlowsRules          `json:"oauthFlows,omitempty" yaml:"oauthFlows,omitempty"`
	OAuthFlow           *OAuthFlowRules           `json:"oauthFlow,omitempty" yaml:"oauthFlow,omitempty"`
	Callback            *CallbackRules            `json:"callback,omitempty" yaml:"callback,omitempty"`
	Link                *LinkRules                `json:"link,omitempty" yaml:"link,omitempty"`
	Example             *ExampleRules             `json:"example,omitempty" yaml:"example,omitempty"`
	// contains filtered or unexported fields
}

BreakingRulesConfig holds all breaking change rules organized by OpenAPI component. Structure mirrors the OpenAPI 3.x specification.

func GenerateDefaultBreakingRules added in v0.29.0

func GenerateDefaultBreakingRules() *BreakingRulesConfig

GenerateDefaultBreakingRules returns the default breaking change rules for OpenAPI 3.x. These rules match the currently hardcoded behavior in the comparison functions. The returned config is cached and reused for performance.

func GetActiveBreakingRulesConfig added in v0.29.0

func GetActiveBreakingRulesConfig() *BreakingRulesConfig

GetActiveBreakingRulesConfig returns the currently active breaking rules config. If no custom config has been set, returns the default rules.

func (*BreakingRulesConfig) GetRule added in v0.29.0

func (c *BreakingRulesConfig) GetRule(component, property string) *BreakingChangeRule

GetRule returns the BreakingChangeRule for a given component and property. Returns nil if no rule is defined. Uses internal cache for O(1) lookups.

func (*BreakingRulesConfig) IsBreaking added in v0.29.0

func (c *BreakingRulesConfig) IsBreaking(component, property, changeType string) bool

IsBreaking looks up whether a change is breaking based on the component, property, and change type. Returns the configured breaking status, or false if the rule is not found.

func (*BreakingRulesConfig) Merge added in v0.29.0

func (c *BreakingRulesConfig) Merge(override *BreakingRulesConfig)

Merge applies user overrides to the configuration. Only non-nil values from the override config replace the current values. Uses reflection to reduce boilerplate.

type CallbackChanges

type CallbackChanges struct {
	*PropertyChanges
	ExpressionChanges map[string]*PathItemChanges `json:"expressions,omitempty" yaml:"expressions,omitempty"`
	ExtensionChanges  *ExtensionChanges           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

CallbackChanges represents all changes made between two Callback OpenAPI objects.

func CompareCallback

func CompareCallback(l, r *v3.Callback) *CallbackChanges

CompareCallback will compare two Callback objects and return a pointer to CallbackChanges with all the things that have changed between them. Handles nil inputs for added/removed callback scenarios.

func (*CallbackChanges) GetAllChanges added in v0.7.0

func (c *CallbackChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Callback objects

func (*CallbackChanges) TotalBreakingChanges

func (c *CallbackChanges) TotalBreakingChanges() int

TotalBreakingChanges returns a total count of all changes made between Callback objects

func (*CallbackChanges) TotalChanges

func (c *CallbackChanges) TotalChanges() int

TotalChanges returns a total count of all changes made between Callback objects

type CallbackRules added in v0.29.0

type CallbackRules struct {
	Expressions *BreakingChangeRule `json:"expressions,omitempty" yaml:"expressions,omitempty"`
}

CallbackRules defines breaking rules for the Callback object properties.

type Change

type Change struct {
	// Context represents the lines and column numbers of the original and new values
	// It's worth noting that these values may frequently be different and are not used to calculate
	// a change. If the positions change, but values do not, then no change is recorded.
	Context *ChangeContext `json:"context,omitempty" yaml:"context,omitempty"`

	// ChangeType represents the type of change that occurred. stored as an integer, defined by constants above.
	ChangeType int `json:"change,omitempty" yaml:"change,omitempty"`

	// Property is the property name key being changed.
	Property string `json:"property,omitempty" yaml:"property,omitempty"`

	// Original is the original value represented as a string.
	Original string `json:"original,omitempty" yaml:"original,omitempty"`

	// New is the new value represented as a string.
	New string `json:"new,omitempty" yaml:"new,omitempty"`

	// OriginalEncoded is the original value serialized to YAML (for complex types like extensions).
	// Only populated for specific use cases (e.g., extension values that are objects/arrays).
	OriginalEncoded string `json:"originalEncoded,omitempty" yaml:"originalEncoded,omitempty"`

	// NewEncoded is the new value serialized to YAML (for complex types like extensions).
	// Only populated for specific use cases (e.g., extension values that are objects/arrays).
	NewEncoded string `json:"newEncoded,omitempty" yaml:"newEncoded,omitempty"`

	// Breaking determines if the change is a breaking one or not.
	Breaking bool `json:"breaking" yaml:"breaking"`

	// OriginalObject represents the original object that was changed.
	OriginalObject any `json:"-" yaml:"-"`

	// NewObject represents the new object that has been modified.
	NewObject any `json:"-" yaml:"-"`

	// Type represents the type of object that was changed. (not used in the current implementation).
	Type string `json:"type,omitempty"`

	// Path represents the path to the object that was changed (not used in the current implementation).
	Path string `json:"path,omitempty"`

	// Reference is populated when the change is related to a $ref change.
	Reference string `json:"reference,omitempty"`
}

Change represents a change between two different elements inside an OpenAPI specification.

func (*Change) MarshalJSON added in v0.15.12

func (c *Change) MarshalJSON() ([]byte, error)

MarshalJSON is a custom JSON marshaller for the Change object.

type ChangeContext

type ChangeContext struct {
	DocumentLocation string `json:"document,omitempty" yaml:"document,omitempty"`
	OriginalLine     *int   `json:"originalLine,omitempty" yaml:"originalLine,omitempty"`
	OriginalColumn   *int   `json:"originalColumn,omitempty" yaml:"originalColumn,omitempty"`
	NewLine          *int   `json:"newLine,omitempty" yaml:"newLine,omitempty"`
	NewColumn        *int   `json:"newColumn,omitempty" yaml:"newColumn,omitempty"`
}

ChangeContext holds a reference to the line and column positions of original and new change.

func CreateContext

func CreateContext(l, r *yaml.Node) *ChangeContext

CreateContext will return a pointer to a ChangeContext containing the original and new line and column numbers of the left and right value nodes.

func (*ChangeContext) HasChanged

func (c *ChangeContext) HasChanged() bool

HasChanged determines if the line and column numbers of the original and new values have changed.

It's worth noting that there is no guarantee to the positions of anything in either left or right, so considering these values as 'changes' is going to add a considerable amount of noise to results.

type ChangeIsReferenced added in v0.28.2

type ChangeIsReferenced interface {
	GetChangeReference() string
	SetChangeReference(ref string)
}

type ComponentsChanges

type ComponentsChanges struct {
	*PropertyChanges
	SchemaChanges         map[string]*SchemaChanges         `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	SecuritySchemeChanges map[string]*SecuritySchemeChanges `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
	ExtensionChanges      *ExtensionChanges                 `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

ComponentsChanges represents changes made to both OpenAPI and Swagger documents. This model is based on OpenAPI 3 components, however it's also used to contain Swagger definitions changes. Swagger for some reason decided to not contain definitions inside a single parent like Components, and instead scattered them across the root of the Swagger document, giving everything a `Definitions` postfix. This design attempts to unify those models into a single entity that contains all changes.

Schemas are treated differently from every other component / definition in this library. Schemas can be highly recursive, and are not resolved by the model, every ref is recorded, but it's not looked at essentially. This means that when what-changed performs a check, everything that is *not* a schema is checked *inline*, Those references are resolved in place and a change is recorded in place. Schemas however are *not* resolved. which means no change will be recorded in place for any object referencing it.

That is why there is a separate SchemaChanges object in ComponentsChanges. Schemas are checked at the source, and not inline when referenced. A schema change will only be found once, however a change to ANY other definition or component, will be found inline (and will duplicate for every use).

The other oddity here is SecuritySchemes. For some reason OpenAPI does not use a $ref for these entities, it uses a name lookup, which means there are no direct links between any model and a security scheme reference. So like Schemas, SecuritySchemes are treated differently and handled individually.

An important note: Everything EXCEPT Schemas and SecuritySchemes is ONLY checked for additions or removals. modifications are not checked, these checks occur in-place by implementing objects as they are autp-resolved when the model is built.

func CompareComponents

func CompareComponents(l, r any) *ComponentsChanges

CompareComponents will compare OpenAPI components for any changes. Accepts Swagger Definition objects like ParameterDefinitions or Definitions etc.

func (*ComponentsChanges) GetAllChanges added in v0.7.0

func (c *ComponentsChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Callback objects

func (*ComponentsChanges) TotalBreakingChanges

func (c *ComponentsChanges) TotalBreakingChanges() int

TotalBreakingChanges returns all breaking changes found for all Components and Definitions

func (*ComponentsChanges) TotalChanges

func (c *ComponentsChanges) TotalChanges() int

TotalChanges returns total changes for all Components and Definitions

type ConfigValidationError added in v0.30.0

type ConfigValidationError struct {
	// Message is a human-readable description of the issue.
	Message string

	// Path is the YAML path where the issue was found (e.g., "schema.discriminator").
	Path string

	// Line is the 1-based line number in the YAML source (0 if unknown).
	Line int

	// Column is the 1-based column number in the YAML source (0 if unknown).
	Column int

	// FoundKey is the misplaced key that was detected.
	FoundKey string

	// SuggestedPath is where the key should be placed instead.
	SuggestedPath string
}

ConfigValidationError represents a single validation issue in a breaking rules config.

func (*ConfigValidationError) Error added in v0.30.0

func (e *ConfigValidationError) Error() string

Error implements the error interface.

type ConfigValidationResult added in v0.30.0

type ConfigValidationResult struct {
	// Errors contains all validation issues found.
	Errors []*ConfigValidationError
}

ConfigValidationResult holds the results of validating a breaking rules config.

func ValidateBreakingRulesConfigYAML added in v0.30.0

func ValidateBreakingRulesConfigYAML(yamlBytes []byte) *ConfigValidationResult

ValidateBreakingRulesConfigYAML validates raw YAML bytes for a breaking rules config. It detects misplaced nested configurations (e.g., "schema.discriminator" should be just "discriminator" at the top level) and returns all validation errors found. Returns nil if the configuration is valid.

func (*ConfigValidationResult) Error added in v0.30.0

func (r *ConfigValidationResult) Error() string

Error implements the error interface, joining all errors.

func (*ConfigValidationResult) HasErrors added in v0.30.0

func (r *ConfigValidationResult) HasErrors() bool

HasErrors returns true if any validation errors were found.

type ContactChanges

type ContactChanges struct {
	*PropertyChanges
}

ContactChanges Represent changes to a Contact object that is a child of Info, part of an OpenAPI document.

func CompareContact

func CompareContact(l, r *base.Contact) *ContactChanges

CompareContact will check a left (original) and right (new) Contact object for any changes. If there were any, a pointer to a ContactChanges object is returned, otherwise if nothing changed - the function returns nil.

func (*ContactChanges) GetAllChanges added in v0.7.0

func (c *ContactChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Callback objects

func (*ContactChanges) TotalBreakingChanges

func (c *ContactChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes in Contact objects.

func (*ContactChanges) TotalChanges

func (c *ContactChanges) TotalChanges() int

TotalChanges represents the total number of changes that have occurred to a Contact object

type ContactRules added in v0.29.0

type ContactRules struct {
	URL   *BreakingChangeRule `json:"url,omitempty" yaml:"url,omitempty"`
	Name  *BreakingChangeRule `json:"name,omitempty" yaml:"name,omitempty"`
	Email *BreakingChangeRule `json:"email,omitempty" yaml:"email,omitempty"`
}

ContactRules defines breaking rules for the Contact object properties.

type DiscriminatorChanges

type DiscriminatorChanges struct {
	*PropertyChanges
	MappingChanges []*Change `json:"mappings,omitempty" yaml:"mappings,omitempty"`
}

DiscriminatorChanges represents changes made to a Discriminator OpenAPI object

func CompareDiscriminator

func CompareDiscriminator(l, r *base.Discriminator) *DiscriminatorChanges

CompareDiscriminator will check a left (original) and right (new) Discriminator object for changes and will return a pointer to DiscriminatorChanges

func (*DiscriminatorChanges) GetAllChanges added in v0.7.0

func (c *DiscriminatorChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Callback objects

func (*DiscriminatorChanges) TotalBreakingChanges

func (d *DiscriminatorChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the number of breaking changes made by the Discriminator

func (*DiscriminatorChanges) TotalChanges

func (d *DiscriminatorChanges) TotalChanges() int

TotalChanges returns a count of everything changed within the Discriminator object

type DiscriminatorRules added in v0.29.0

type DiscriminatorRules struct {
	PropertyName   *BreakingChangeRule `json:"propertyName,omitempty" yaml:"propertyName,omitempty"`
	DefaultMapping *BreakingChangeRule `json:"defaultMapping,omitempty" yaml:"defaultMapping,omitempty"`
	Mapping        *BreakingChangeRule `json:"mapping,omitempty" yaml:"mapping,omitempty"`
}

DiscriminatorRules defines breaking rules for the Discriminator object properties.

type DocumentChanges

type DocumentChanges struct {
	*PropertyChanges
	InfoChanges                *InfoChanges                  `json:"info,omitempty" yaml:"info,omitempty"`
	PathsChanges               *PathsChanges                 `json:"paths,omitempty" yaml:"paths,omitempty"`
	TagChanges                 []*TagChanges                 `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocChanges         *ExternalDocChanges           `json:"externalDoc,omitempty" yaml:"externalDoc,omitempty"`
	WebhookChanges             map[string]*PathItemChanges   `json:"webhooks,omitempty" yaml:"webhooks,omitempty"`
	ServerChanges              []*ServerChanges              `json:"servers,omitempty" yaml:"servers,omitempty"`
	SecurityRequirementChanges []*SecurityRequirementChanges `json:"securityRequirements,omitempty" yaml:"securityRequirements,omitempty"`
	ComponentsChanges          *ComponentsChanges            `json:"components,omitempty" yaml:"components,omitempty"`
	ExtensionChanges           *ExtensionChanges             `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

DocumentChanges represents all the changes made to an OpenAPI document.

func CompareDocuments

func CompareDocuments(l, r any) *DocumentChanges

CompareDocuments will compare any two OpenAPI documents (either Swagger or OpenAPI) and return a pointer to DocumentChanges that outlines everything that was found to have changed.

func (*DocumentChanges) GetAllChanges added in v0.7.0

func (d *DocumentChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Document objects

func (*DocumentChanges) TotalBreakingChanges

func (d *DocumentChanges) TotalBreakingChanges() int

TotalBreakingChanges returns a total count of all breaking changes made in the Document

func (*DocumentChanges) TotalChanges

func (d *DocumentChanges) TotalChanges() int

TotalChanges returns a total count of all changes made in the Document

type DocumentChangesFlat added in v0.15.12

type DocumentChangesFlat struct {
	*PropertyChanges
	InfoChanges                []*Change `json:"info,omitempty" yaml:"info,omitempty"`
	PathsChanges               []*Change `json:"paths,omitempty" yaml:"paths,omitempty"`
	TagChanges                 []*Change `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocChanges         []*Change `json:"externalDoc,omitempty" yaml:"externalDoc,omitempty"`
	WebhookChanges             []*Change `json:"webhooks,omitempty" yaml:"webhooks,omitempty"`
	ServerChanges              []*Change `json:"servers,omitempty" yaml:"servers,omitempty"`
	SecurityRequirementChanges []*Change `json:"securityRequirements,omitempty" yaml:"securityRequirements,omitempty"`
	ComponentsChanges          []*Change `json:"components,omitempty" yaml:"components,omitempty"`
	ExtensionChanges           []*Change `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

type EncodingChanges

type EncodingChanges struct {
	*PropertyChanges
	HeaderChanges map[string]*HeaderChanges `json:"headers,omitempty" yaml:"headers,omitempty"`
}

EncodingChanges represent all the changes made to an Encoding object

func CompareEncoding

func CompareEncoding(l, r *v3.Encoding) *EncodingChanges

CompareEncoding returns a pointer to *EncodingChanges that contain all changes made between a left and right set of Encoding objects.

func (*EncodingChanges) GetAllChanges added in v0.7.0

func (e *EncodingChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Encoding objects

func (*EncodingChanges) TotalBreakingChanges

func (e *EncodingChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the number of changes made between two Encoding objects that were breaking.

func (*EncodingChanges) TotalChanges

func (e *EncodingChanges) TotalChanges() int

TotalChanges returns the total number of changes made between two Encoding objects

type EncodingRules added in v0.29.0

type EncodingRules struct {
	ContentType   *BreakingChangeRule `json:"contentType,omitempty" yaml:"contentType,omitempty"`
	Style         *BreakingChangeRule `json:"style,omitempty" yaml:"style,omitempty"`
	Explode       *BreakingChangeRule `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowReserved *BreakingChangeRule `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
}

EncodingRules defines breaking rules for the Encoding object properties.

type ExampleChanges

type ExampleChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

ExampleChanges represent changes to an Example object, part of an OpenAPI specification.

func CompareExamples

func CompareExamples(l, r *base.Example) *ExampleChanges

CompareExamples returns a pointer to ExampleChanges that contains all changes made between left and right Example instances. If l is nil, the example was added. If r is nil, it was removed.

func (*ExampleChanges) GetAllChanges added in v0.7.0

func (e *ExampleChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Example objects

func (*ExampleChanges) TotalBreakingChanges

func (e *ExampleChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes made to Example

func (*ExampleChanges) TotalChanges

func (e *ExampleChanges) TotalChanges() int

TotalChanges returns the total number of changes made to Example

type ExampleRules added in v0.29.0

type ExampleRules struct {
	Summary         *BreakingChangeRule `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description     *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Value           *BreakingChangeRule `json:"value,omitempty" yaml:"value,omitempty"`
	ExternalValue   *BreakingChangeRule `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
	DataValue       *BreakingChangeRule `json:"dataValue,omitempty" yaml:"dataValue,omitempty"`
	SerializedValue *BreakingChangeRule `json:"serializedValue,omitempty" yaml:"serializedValue,omitempty"`
}

ExampleRules defines breaking rules for the Example object properties.

type ExamplesChanges

type ExamplesChanges struct {
	*PropertyChanges
}

ExamplesChanges represents changes made between Swagger Examples objects (Not OpenAPI 3).

func CompareExamplesV2

func CompareExamplesV2(l, r *v2.Examples) *ExamplesChanges

CompareExamplesV2 compares two Swagger Examples objects, returning a pointer to ExamplesChanges if anything was found.

func (*ExamplesChanges) GetAllChanges added in v0.7.0

func (a *ExamplesChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Examples objects

func (*ExamplesChanges) TotalBreakingChanges

func (a *ExamplesChanges) TotalBreakingChanges() int

TotalBreakingChanges will always return 0. Examples cannot break a contract.

func (*ExamplesChanges) TotalChanges

func (a *ExamplesChanges) TotalChanges() int

TotalChanges represents the total number of changes made between Example instances.

type ExtensionChanges

type ExtensionChanges struct {
	*PropertyChanges
}

ExtensionChanges represents any changes to custom extensions defined for an OpenAPI object.

func CheckExtensions

func CheckExtensions[T low.HasExtensions[T]](l, r T) *ExtensionChanges

CheckExtensions is a helper method to un-pack a left and right model that contains extensions. Once unpacked the extensions are compared and returns a pointer to ExtensionChanges. If nothing changed, nil is returned.

func CompareExtensions

CompareExtensions will compare a left and right map of Tag/ValueReference models for any changes to anything. This function does not try and cast the value of an extension to perform checks, it will perform a basic value check.

A current limitation relates to extensions being objects and a property of the object changes, there is currently no support for knowing anything changed - so it is ignored.

func (*ExtensionChanges) GetAllChanges added in v0.7.0

func (e *ExtensionChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Extension objects

func (*ExtensionChanges) TotalBreakingChanges

func (e *ExtensionChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes in Extension objects.

func (*ExtensionChanges) TotalChanges

func (e *ExtensionChanges) TotalChanges() int

TotalChanges returns the total number of object extensions that were made.

type ExternalDocChanges

type ExternalDocChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

ExternalDocChanges represents changes made to any ExternalDoc object from an OpenAPI document.

func CompareExternalDocs

func CompareExternalDocs(l, r *base.ExternalDoc) *ExternalDocChanges

CompareExternalDocs will compare a left (original) and a right (new) slice of ValueReference nodes for any changes between them. If there are changes, then a pointer to ExternalDocChanges is returned, otherwise if nothing changed - then nil is returned.

func (*ExternalDocChanges) GetAllChanges added in v0.7.0

func (e *ExternalDocChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Example objects

func (*ExternalDocChanges) TotalBreakingChanges

func (e *ExternalDocChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes in ExternalDoc objects.

func (*ExternalDocChanges) TotalChanges

func (e *ExternalDocChanges) TotalChanges() int

TotalChanges returns a count of everything that changed

type ExternalDocsRules added in v0.29.0

type ExternalDocsRules struct {
	URL         *BreakingChangeRule `json:"url,omitempty" yaml:"url,omitempty"`
	Description *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
}

ExternalDocsRules defines breaking rules for the External Documentation object properties.

type HeaderChanges

type HeaderChanges struct {
	*PropertyChanges
	SchemaChanges    *SchemaChanges               `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	ExamplesChanges  map[string]*ExampleChanges   `json:"examples,omitempty" yaml:"examples,omitempty"`
	ContentChanges   map[string]*MediaTypeChanges `json:"content,omitempty" yaml:"content,omitempty"`
	ExtensionChanges *ExtensionChanges            `json:"extensions,omitempty" yaml:"extensions,omitempty"`

	// Items only supported by Swagger (V2)
	ItemsChanges *ItemsChanges `json:"items,omitempty" yaml:"items,omitempty"`
}

HeaderChanges represents changes made between two Header objects. Supports both Swagger and OpenAPI header objects, V2 only property Items is broken out into its own.

func CompareHeaders

func CompareHeaders(l, r any) *HeaderChanges

CompareHeaders will compare left and right Header objects (any version of Swagger or OpenAPI) and return a pointer to HeaderChanges with anything that has changed, or nil if nothing changed.

func CompareHeadersV2

func CompareHeadersV2(l, r *v2.Header) *HeaderChanges

CompareHeadersV2 is a Swagger compatible, typed signature used for other generic functions. It simply wraps CompareHeaders and provides nothing other that a typed interface.

func CompareHeadersV3

func CompareHeadersV3(l, r *v3.Header) *HeaderChanges

CompareHeadersV3 is an OpenAPI 3+ compatible, typed signature used for other generic functions. It simply wraps CompareHeaders and provides nothing other that a typed interface.

func (*HeaderChanges) GetAllChanges added in v0.7.0

func (h *HeaderChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Header objects

func (*HeaderChanges) TotalBreakingChanges

func (h *HeaderChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes made between two Header instances.

func (*HeaderChanges) TotalChanges

func (h *HeaderChanges) TotalChanges() int

TotalChanges returns the total number of changes made between two Header objects.

type HeaderRules added in v0.29.0

type HeaderRules struct {
	Description     *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Style           *BreakingChangeRule `json:"style,omitempty" yaml:"style,omitempty"`
	AllowReserved   *BreakingChangeRule `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	AllowEmptyValue *BreakingChangeRule `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	Explode         *BreakingChangeRule `json:"explode,omitempty" yaml:"explode,omitempty"`
	Example         *BreakingChangeRule `json:"example,omitempty" yaml:"example,omitempty"`
	Deprecated      *BreakingChangeRule `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Required        *BreakingChangeRule `json:"required,omitempty" yaml:"required,omitempty"`
	Schema          *BreakingChangeRule `json:"schema,omitempty" yaml:"schema,omitempty"`
	Items           *BreakingChangeRule `json:"items,omitempty" yaml:"items,omitempty"`
}

HeaderRules defines breaking rules for the Header object properties.

type InfoChanges

type InfoChanges struct {
	*PropertyChanges
	ContactChanges   *ContactChanges   `json:"contact,omitempty" yaml:"contact,omitempty"`
	LicenseChanges   *LicenseChanges   `json:"license,omitempty" yaml:"license,omitempty"`
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

InfoChanges represents the number of changes to an Info object. Part of an OpenAPI document

func CompareInfo

func CompareInfo(l, r *base.Info) *InfoChanges

CompareInfo will compare a left (original) and a right (new) Info object. Any changes will be returned in a pointer to InfoChanges, otherwise if nothing is found, then nil is returned instead.

func (*InfoChanges) GetAllChanges added in v0.7.0

func (i *InfoChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Info objects

func (*InfoChanges) TotalBreakingChanges

func (i *InfoChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes in Info objects.

func (*InfoChanges) TotalChanges

func (i *InfoChanges) TotalChanges() int

TotalChanges represents the total number of changes made to an Info object.

type InfoRules added in v0.29.0

type InfoRules struct {
	Title          *BreakingChangeRule `json:"title,omitempty" yaml:"title,omitempty"`
	Summary        *BreakingChangeRule `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description    *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	TermsOfService *BreakingChangeRule `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"`
	Version        *BreakingChangeRule `json:"version,omitempty" yaml:"version,omitempty"`
	Contact        *BreakingChangeRule `json:"contact,omitempty" yaml:"contact,omitempty"`
	License        *BreakingChangeRule `json:"license,omitempty" yaml:"license,omitempty"`
}

InfoRules defines breaking rules for the Info object properties.

type ItemsChanges

type ItemsChanges struct {
	*PropertyChanges
	ItemsChanges *ItemsChanges `json:"items,omitempty" yaml:"items,omitempty"`
}

ItemsChanges represent changes found between a left (original) and right (modified) object. Items is only used by Swagger documents.

func CompareItems

func CompareItems(l, r *v2.Items) *ItemsChanges

CompareItems compares two sets of Swagger Item objects. If there are any changes found then a pointer to ItemsChanges will be returned, otherwise nil is returned.

It is worth nothing that Items can contain Items. This means recursion is possible and has the potential for runaway code if not using the resolver's circular reference checking.

func (*ItemsChanges) GetAllChanges added in v0.7.0

func (i *ItemsChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Items objects

func (*ItemsChanges) TotalBreakingChanges

func (i *ItemsChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes found between two Swagger Items objects This is a recursive method, Items are recursive, be careful!

func (*ItemsChanges) TotalChanges

func (i *ItemsChanges) TotalChanges() int

TotalChanges returns the total number of changes found between two Items objects This is a recursive function because Items can contain Items. Be careful!

type LicenseChanges

type LicenseChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

LicenseChanges represent changes to a License object that is a child of Info object. Part of an OpenAPI document

func CompareLicense

func CompareLicense(l, r *base.License) *LicenseChanges

CompareLicense will check a left (original) and right (new) License object for any changes. If there were any, a pointer to a LicenseChanges object is returned, otherwise if nothing changed - the function returns nil.

func (*LicenseChanges) GetAllChanges added in v0.7.0

func (l *LicenseChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between License objects

func (*LicenseChanges) TotalBreakingChanges

func (l *LicenseChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes in License objects.

func (*LicenseChanges) TotalChanges

func (l *LicenseChanges) TotalChanges() int

TotalChanges represents the total number of changes made to a License instance.

type LicenseRules added in v0.29.0

type LicenseRules struct {
	URL        *BreakingChangeRule `json:"url,omitempty" yaml:"url,omitempty"`
	Name       *BreakingChangeRule `json:"name,omitempty" yaml:"name,omitempty"`
	Identifier *BreakingChangeRule `json:"identifier,omitempty" yaml:"identifier,omitempty"`
}

LicenseRules defines breaking rules for the License object properties.

type LinkChanges

type LinkChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	ServerChanges    *ServerChanges    `json:"server,omitempty" yaml:"server,omitempty"`
}

LinkChanges represent changes made between two OpenAPI Link Objects.

func CompareLinks(l, r *v3.Link) *LinkChanges

CompareLinks checks a left and right OpenAPI Link for any changes. If they are found, returns a pointer to LinkChanges, and returns nil if nothing is found.

func (*LinkChanges) GetAllChanges added in v0.7.0

func (l *LinkChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Link objects

func (*LinkChanges) TotalBreakingChanges

func (l *LinkChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the number of breaking changes made between two OpenAPI Link Objects

func (*LinkChanges) TotalChanges

func (l *LinkChanges) TotalChanges() int

TotalChanges returns the total changes made between OpenAPI Link objects

type LinkRules added in v0.29.0

type LinkRules struct {
	OperationRef *BreakingChangeRule `json:"operationRef,omitempty" yaml:"operationRef,omitempty"`
	OperationID  *BreakingChangeRule `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	RequestBody  *BreakingChangeRule `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Description  *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Server       *BreakingChangeRule `json:"server,omitempty" yaml:"server,omitempty"`
	Parameters   *BreakingChangeRule `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

LinkRules defines breaking rules for the Link object properties.

type MediaTypeChanges

type MediaTypeChanges struct {
	*PropertyChanges
	SchemaChanges       *SchemaChanges              `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	ItemSchemaChanges   *SchemaChanges              `json:"itemSchemas,omitempty" yaml:"itemSchemas,omitempty"`
	ExtensionChanges    *ExtensionChanges           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	ExampleChanges      map[string]*ExampleChanges  `json:"examples,omitempty" yaml:"examples,omitempty"`
	EncodingChanges     map[string]*EncodingChanges `json:"encoding,omitempty" yaml:"encoding,omitempty"`
	ItemEncodingChanges map[string]*EncodingChanges `json:"itemEncoding,omitempty" yaml:"itemEncoding,omitempty"`
}

MediaTypeChanges represent changes made between two OpenAPI MediaType instances.

func CompareMediaTypes

func CompareMediaTypes(l, r *v3.MediaType) *MediaTypeChanges

CompareMediaTypes compares a left and a right MediaType object for any changes. If found, a pointer to a MediaTypeChanges instance is returned; otherwise nothing is returned.

func (*MediaTypeChanges) GetAllChanges added in v0.7.0

func (m *MediaTypeChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between MediaType objects

func (*MediaTypeChanges) TotalBreakingChanges

func (m *MediaTypeChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes made between two MediaType instances.

func (*MediaTypeChanges) TotalChanges

func (m *MediaTypeChanges) TotalChanges() int

TotalChanges returns the total number of changes between two MediaType instances.

type MediaTypeRules added in v0.29.0

type MediaTypeRules struct {
	Example      *BreakingChangeRule `json:"example,omitempty" yaml:"example,omitempty"`
	Schema       *BreakingChangeRule `json:"schema,omitempty" yaml:"schema,omitempty"`
	ItemSchema   *BreakingChangeRule `json:"itemSchema,omitempty" yaml:"itemSchema,omitempty"`
	ItemEncoding *BreakingChangeRule `json:"itemEncoding,omitempty" yaml:"itemEncoding,omitempty"`
}

MediaTypeRules defines breaking rules for the Media Type object properties.

type OAuthFlowChanges

type OAuthFlowChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

OAuthFlowChanges represents an OpenAPI OAuthFlow object.

func CompareOAuthFlow

func CompareOAuthFlow(l, r *v3.OAuthFlow) *OAuthFlowChanges

CompareOAuthFlow checks a left and a right OAuthFlow object for changes. If found, returns a pointer to an OAuthFlowChanges instance, or nil if nothing is found.

func (*OAuthFlowChanges) GetAllChanges added in v0.7.0

func (o *OAuthFlowChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between OAuthFlow objects

func (*OAuthFlowChanges) TotalBreakingChanges

func (o *OAuthFlowChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes made between two OAuthFlow objects

func (*OAuthFlowChanges) TotalChanges

func (o *OAuthFlowChanges) TotalChanges() int

TotalChanges returns the total number of changes made between two OAuthFlow objects

type OAuthFlowRules added in v0.29.0

type OAuthFlowRules struct {
	AuthorizationURL *BreakingChangeRule `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
	TokenURL         *BreakingChangeRule `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
	RefreshURL       *BreakingChangeRule `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"`
	Scopes           *BreakingChangeRule `json:"scopes,omitempty" yaml:"scopes,omitempty"`
}

OAuthFlowRules defines breaking rules for the OAuth Flow object properties.

type OAuthFlowsChanges

type OAuthFlowsChanges struct {
	*PropertyChanges
	ImplicitChanges          *OAuthFlowChanges `json:"implicit,omitempty" yaml:"implicit,omitempty"`
	PasswordChanges          *OAuthFlowChanges `json:"password,omitempty" yaml:"password,omitempty"`
	ClientCredentialsChanges *OAuthFlowChanges `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"`
	AuthorizationCodeChanges *OAuthFlowChanges `json:"authCode,omitempty" yaml:"authCode,omitempty"`
	DeviceChanges            *OAuthFlowChanges `json:"device,omitempty" yaml:"device,omitempty"` // OpenAPI 3.2+ device flow
	ExtensionChanges         *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

OAuthFlowsChanges represents changes found between two OpenAPI OAuthFlows objects.

func CompareOAuthFlows

func CompareOAuthFlows(l, r *v3.OAuthFlows) *OAuthFlowsChanges

CompareOAuthFlows compares a left and right OAuthFlows object. If changes are found a pointer to *OAuthFlowsChanges is returned, otherwise nil is returned.

func (*OAuthFlowsChanges) GetAllChanges added in v0.7.0

func (o *OAuthFlowsChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between OAuthFlows objects

func (*OAuthFlowsChanges) TotalBreakingChanges

func (o *OAuthFlowsChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the number of breaking changes made between two OAuthFlows objects.

func (*OAuthFlowsChanges) TotalChanges

func (o *OAuthFlowsChanges) TotalChanges() int

TotalChanges returns the number of changes made between two OAuthFlows instances.

type OAuthFlowsRules added in v0.29.0

type OAuthFlowsRules struct {
	Implicit          *BreakingChangeRule `json:"implicit,omitempty" yaml:"implicit,omitempty"`
	Password          *BreakingChangeRule `json:"password,omitempty" yaml:"password,omitempty"`
	ClientCredentials *BreakingChangeRule `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"`
	AuthorizationCode *BreakingChangeRule `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"`
	Device            *BreakingChangeRule `json:"device,omitempty" yaml:"device,omitempty"`
}

OAuthFlowsRules defines breaking rules for the OAuth Flows object properties.

type OperationChanges

type OperationChanges struct {
	*PropertyChanges
	ExternalDocChanges         *ExternalDocChanges           `json:"externalDoc,omitempty" yaml:"externalDoc,omitempty"`
	ParameterChanges           []*ParameterChanges           `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	ResponsesChanges           *ResponsesChanges             `json:"responses,omitempty" yaml:"responses,omitempty"`
	SecurityRequirementChanges []*SecurityRequirementChanges `json:"securityRequirements,omitempty" yaml:"securityRequirements,omitempty"`

	// OpenAPI 3+ only changes
	RequestBodyChanges *RequestBodyChanges         `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"`
	ServerChanges      []*ServerChanges            `json:"servers,omitempty" yaml:"servers,omitempty"`
	ExtensionChanges   *ExtensionChanges           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	CallbackChanges    map[string]*CallbackChanges `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
}

OperationChanges represent changes made between two Swagger or OpenAPI Operation objects.

func CompareOperations

func CompareOperations(l, r any) *OperationChanges

CompareOperations compares a left and right Swagger or OpenAPI Operation object. If changes are found, returns a pointer to an OperationChanges instance, or nil if nothing is found.

func (*OperationChanges) GetAllChanges added in v0.7.0

func (o *OperationChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Operation objects

func (*OperationChanges) TotalBreakingChanges

func (o *OperationChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes made between two Swagger or OpenAPI Operation objects.

func (*OperationChanges) TotalChanges

func (o *OperationChanges) TotalChanges() int

TotalChanges returns the total number of changes made between two Swagger or OpenAPI Operation objects.

type OperationRules added in v0.29.0

type OperationRules struct {
	Tags         *BreakingChangeRule `json:"tags,omitempty" yaml:"tags,omitempty"`
	Summary      *BreakingChangeRule `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description  *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Deprecated   *BreakingChangeRule `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	OperationID  *BreakingChangeRule `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	ExternalDocs *BreakingChangeRule `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Responses    *BreakingChangeRule `json:"responses,omitempty" yaml:"responses,omitempty"`
	Parameters   *BreakingChangeRule `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Security     *BreakingChangeRule `json:"security,omitempty" yaml:"security,omitempty"`
	RequestBody  *BreakingChangeRule `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	Callbacks    *BreakingChangeRule `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
	Servers      *BreakingChangeRule `json:"servers,omitempty" yaml:"servers,omitempty"`
}

OperationRules defines breaking rules for the Operation object properties.

type ParameterChanges

type ParameterChanges struct {
	*PropertyChanges
	Name             string            `json:"name,omitempty" yaml:"name,omitempty"`
	SchemaChanges    *SchemaChanges    `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`

	// Swagger supports Items.
	ItemsChanges *ItemsChanges `json:"items,omitempty" yaml:"items,omitempty"`

	// OpenAPI supports examples and content types.
	ExamplesChanges map[string]*ExampleChanges   `json:"examples,omitempty" yaml:"examples,omitempty"`
	ContentChanges  map[string]*MediaTypeChanges `json:"content,omitempty" yaml:"content,omitempty"`
}

ParameterChanges represents changes found between Swagger or OpenAPI Parameter objects.

func CompareParameters

func CompareParameters(l, r any) *ParameterChanges

CompareParameters compares a left and right Swagger or OpenAPI Parameter object for any changes. If found returns a pointer to ParameterChanges. If nothing is found, returns nil.

func CompareParametersV3

func CompareParametersV3(l, r *v3.Parameter) *ParameterChanges

CompareParametersV3 is an OpenAPI type safe proxy for CompareParameters

func (*ParameterChanges) GetAllChanges added in v0.7.0

func (p *ParameterChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Parameter objects

func (*ParameterChanges) TotalBreakingChanges

func (p *ParameterChanges) TotalBreakingChanges() int

TotalBreakingChanges always returns 0 for ExternalDoc objects, they are non-binding.

func (*ParameterChanges) TotalChanges

func (p *ParameterChanges) TotalChanges() int

TotalChanges returns a count of everything that changed

type ParameterRules added in v0.29.0

type ParameterRules struct {
	Name            *BreakingChangeRule `json:"name,omitempty" yaml:"name,omitempty"`
	In              *BreakingChangeRule `json:"in,omitempty" yaml:"in,omitempty"`
	Description     *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Required        *BreakingChangeRule `json:"required,omitempty" yaml:"required,omitempty"`
	AllowEmptyValue *BreakingChangeRule `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	Style           *BreakingChangeRule `json:"style,omitempty" yaml:"style,omitempty"`
	AllowReserved   *BreakingChangeRule `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	Explode         *BreakingChangeRule `json:"explode,omitempty" yaml:"explode,omitempty"`
	Deprecated      *BreakingChangeRule `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Example         *BreakingChangeRule `json:"example,omitempty" yaml:"example,omitempty"`
	Schema          *BreakingChangeRule `json:"schema,omitempty" yaml:"schema,omitempty"`
	Items           *BreakingChangeRule `json:"items,omitempty" yaml:"items,omitempty"`
}

ParameterRules defines breaking rules for the Parameter object properties.

type PathItemChanges

type PathItemChanges struct {
	*PropertyChanges
	GetChanges                 *OperationChanges            `json:"get,omitempty" yaml:"get,omitempty"`
	PutChanges                 *OperationChanges            `json:"put,omitempty" yaml:"put,omitempty"`
	PostChanges                *OperationChanges            `json:"post,omitempty" yaml:"post,omitempty"`
	DeleteChanges              *OperationChanges            `json:"delete,omitempty" yaml:"delete,omitempty"`
	OptionsChanges             *OperationChanges            `json:"options,omitempty" yaml:"options,omitempty"`
	HeadChanges                *OperationChanges            `json:"head,omitempty" yaml:"head,omitempty"`
	PatchChanges               *OperationChanges            `json:"patch,omitempty" yaml:"patch,omitempty"`
	TraceChanges               *OperationChanges            `json:"trace,omitempty" yaml:"trace,omitempty"`
	QueryChanges               *OperationChanges            `json:"query,omitempty" yaml:"query,omitempty"`
	AdditionalOperationChanges map[string]*OperationChanges `json:"additionalOperations,omitempty" yaml:"additionalOperations,omitempty"` // OpenAPI 3.2+ additional operations
	ServerChanges              []*ServerChanges             `json:"servers,omitempty" yaml:"servers,omitempty"`
	ParameterChanges           []*ParameterChanges          `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	ExtensionChanges           *ExtensionChanges            `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

PathItemChanges represents changes found between to Swagger or OpenAPI PathItem object.

func ComparePathItems

func ComparePathItems(l, r any) *PathItemChanges

ComparePathItems compare a left and right Swagger or OpenAPI PathItem object for changes. If found, returns a pointer to PathItemChanges, or returns nil if nothing is found.

func ComparePathItemsV3

func ComparePathItemsV3(l, r *v3.PathItem) *PathItemChanges

ComparePathItemsV3 is an OpenAPI typesafe proxy method for ComparePathItems

func (*PathItemChanges) GetAllChanges added in v0.7.0

func (p *PathItemChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between PathItem objects

func (*PathItemChanges) TotalBreakingChanges

func (p *PathItemChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes found between two Swagger or OpenAPI PathItems

func (*PathItemChanges) TotalChanges

func (p *PathItemChanges) TotalChanges() int

TotalChanges returns the total number of changes found between two Swagger or OpenAPI PathItems

type PathItemRules added in v0.29.0

type PathItemRules struct {
	Description          *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Summary              *BreakingChangeRule `json:"summary,omitempty" yaml:"summary,omitempty"`
	Get                  *BreakingChangeRule `json:"get,omitempty" yaml:"get,omitempty"`
	Put                  *BreakingChangeRule `json:"put,omitempty" yaml:"put,omitempty"`
	Post                 *BreakingChangeRule `json:"post,omitempty" yaml:"post,omitempty"`
	Delete               *BreakingChangeRule `json:"delete,omitempty" yaml:"delete,omitempty"`
	Options              *BreakingChangeRule `json:"options,omitempty" yaml:"options,omitempty"`
	Head                 *BreakingChangeRule `json:"head,omitempty" yaml:"head,omitempty"`
	Patch                *BreakingChangeRule `json:"patch,omitempty" yaml:"patch,omitempty"`
	Trace                *BreakingChangeRule `json:"trace,omitempty" yaml:"trace,omitempty"`
	Query                *BreakingChangeRule `json:"query,omitempty" yaml:"query,omitempty"`
	AdditionalOperations *BreakingChangeRule `json:"additionalOperations,omitempty" yaml:"additionalOperations,omitempty"`
	Servers              *BreakingChangeRule `json:"servers,omitempty" yaml:"servers,omitempty"`
	Parameters           *BreakingChangeRule `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

PathItemRules defines breaking rules for the Path Item object properties.

type PathsChanges

type PathsChanges struct {
	*PropertyChanges
	PathItemsChanges map[string]*PathItemChanges `json:"pathItems,omitempty" yaml:"pathItems,omitempty"`
	ExtensionChanges *ExtensionChanges           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

PathsChanges represents changes found between two Swagger or OpenAPI Paths Objects.

func ComparePaths

func ComparePaths(l, r any) *PathsChanges

ComparePaths compares a left and right Swagger or OpenAPI Paths Object for changes. If found, returns a pointer to a PathsChanges instance. Returns nil if nothing is found.

func (*PathsChanges) GetAllChanges added in v0.7.0

func (p *PathsChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Paths objects

func (*PathsChanges) TotalBreakingChanges

func (p *PathsChanges) TotalBreakingChanges() int

TotalBreakingChanges returns tht total number of changes found between two Swagger or OpenAPI Path Objects

func (*PathsChanges) TotalChanges

func (p *PathsChanges) TotalChanges() int

TotalChanges returns the total number of changes between two Swagger or OpenAPI Paths Objects

type PathsRules added in v0.29.0

type PathsRules struct {
	Path *BreakingChangeRule `json:"path,omitempty" yaml:"path,omitempty"`
}

PathsRules defines breaking rules for the Paths object properties.

type PropertyChanges

type PropertyChanges struct {
	RenderPropertiesOnly bool      `json:"-" yaml:"-"`
	ChangeReference      string    `json:"changeReference,omitempty""`
	Changes              []*Change `json:"changes,omitempty" yaml:"changes,omitempty"`
}

PropertyChanges holds a slice of Change pointers

func NewPropertyChanges added in v0.2.4

func NewPropertyChanges(changes []*Change) *PropertyChanges

func (*PropertyChanges) GetChangeReference added in v0.28.2

func (p *PropertyChanges) GetChangeReference() string

func (*PropertyChanges) GetPropertyChanges added in v0.21.9

func (p *PropertyChanges) GetPropertyChanges() []*Change

GetPropertyChanges will return just the property changes

func (*PropertyChanges) PropertiesOnly added in v0.21.9

func (p *PropertyChanges) PropertiesOnly()

PropertiesOnly will set the change object to only render properties, not the timeline.

func (*PropertyChanges) SetChangeReference added in v0.28.2

func (p *PropertyChanges) SetChangeReference(ref string)

func (*PropertyChanges) TotalBreakingChanges

func (p *PropertyChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of property breaking changes made.

func (*PropertyChanges) TotalChanges

func (p *PropertyChanges) TotalChanges() int

TotalChanges returns the total number of property changes made.

type PropertyCheck

type PropertyCheck struct {
	// Original is the property we're checking on the left
	Original any

	// New is s the property we're checking on the right
	New any

	// Label is the identifier we're looking for on the left and right hand sides
	Label string

	// LeftNode is the yaml.Node pointer that holds the original node structure of the value
	LeftNode *yaml.Node

	// RightNode is the yaml.Node pointer that holds the new node structure of the value
	RightNode *yaml.Node

	// Breaking determines if the check is a breaking change (modifications or removals etc.)
	//
	// Deprecated: Use Component and Property fields for configurable breaking rules.
	// This field is used as a fallback when Component is not set.
	//
	// TODO: Migration to Component/Property-based breaking rules
	//
	// Current state: CreateChange() takes a `breaking bool` parameter that is computed via
	// BreakingAdded/Modified/Removed(component, property) and stored directly on this field.
	// The breaking status is fixed at Change creation time.
	//
	// Target state: CreateChange() should accept `component, property string` parameters instead,
	// store them on the Change, and breaking status should be computed at runtime via IsBreaking().
	// This allows users to apply different breaking rule configs to the same set of changes.
	//
	// Migration steps:
	//   1. Extend CreateChange signature to accept component, property string
	//   2. Update ~198 CreateChange call sites across 23 files
	//   3. Add IsBreaking() method on Change that computes from Component/Property
	//   4. Keep Breaking field populated for backward compatibility
	//
	// Files with most CreateChange calls: schema.go (51), path_item.go (42), operation.go (22)
	Breaking bool

	// Component is the OpenAPI component type (e.g., CompTag, CompSchema) for breaking rules lookup.
	// When set along with Property, the configurable breaking rules system is used instead of Breaking.
	// TODO: Currently not populated - see Breaking field TODO for migration plan.
	Component string

	// Property is the property name within the component (e.g., PropParent, PropName) for breaking rules lookup.
	// Used together with Component to look up the correct breaking rule for each change type.
	// TODO: Currently not populated - see Breaking field TODO for migration plan.
	Property string

	// Changes represents a pointer to the slice to contain all changes found.
	Changes *[]*Change
}

PropertyCheck is used by functions to check the state of left and right values.

func NewPropertyCheck added in v0.30.0

func NewPropertyCheck(
	component, property string,
	leftNode, rightNode *yaml.Node,
	label string,
	changes *[]*Change,
	original, new any,
) *PropertyCheck

NewPropertyCheck creates a PropertyCheck with the Component and Property fields set for configurable breaking rules. This is the preferred way to create PropertyCheck instances.

type RequestBodyChanges

type RequestBodyChanges struct {
	*PropertyChanges
	ContentChanges   map[string]*MediaTypeChanges `json:"content,omitempty" yaml:"content,omitempty"`
	ExtensionChanges *ExtensionChanges            `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

RequestBodyChanges represents changes made between two OpenAPI RequestBody Objects

func CompareRequestBodies

func CompareRequestBodies(l, r *v3.RequestBody) *RequestBodyChanges

CompareRequestBodies compares a left and right OpenAPI RequestBody object for changes. If found returns a pointer to a RequestBodyChanges instance. Returns nil if nothing was found.

func (*RequestBodyChanges) GetAllChanges added in v0.7.0

func (rb *RequestBodyChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between RequestBody objects

func (*RequestBodyChanges) TotalBreakingChanges

func (rb *RequestBodyChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes found between OpenAPI RequestBody objects

func (*RequestBodyChanges) TotalChanges

func (rb *RequestBodyChanges) TotalChanges() int

TotalChanges returns the total number of changes found between two OpenAPI RequestBody objects

type RequestBodyRules added in v0.29.0

type RequestBodyRules struct {
	Description *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Required    *BreakingChangeRule `json:"required,omitempty" yaml:"required,omitempty"`
}

RequestBodyRules defines breaking rules for the Request Body object properties.

type ResponseChanges

type ResponseChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges         `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	HeadersChanges   map[string]*HeaderChanges `json:"headers,omitempty" yaml:"headers,omitempty"`

	// Swagger Response Properties.
	SchemaChanges   *SchemaChanges   `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	ExamplesChanges *ExamplesChanges `json:"examples,omitempty" yaml:"examples,omitempty"`

	// OpenAPI Response Properties.
	ContentChanges map[string]*MediaTypeChanges `json:"content,omitempty" yaml:"content,omitempty"`
	LinkChanges    map[string]*LinkChanges      `json:"links,omitempty" yaml:"links,omitempty"`
}

ResponseChanges represents changes found between two Swagger or OpenAPI Response objects.

func CompareResponse

func CompareResponse(l, r any) *ResponseChanges

CompareResponse compares a left and right Swagger or OpenAPI Response object. If anything is found a pointer to a ResponseChanges is returned, otherwise it returns nil.

func CompareResponseV2

func CompareResponseV2(l, r *v2.Response) *ResponseChanges

CompareResponseV2 is a Swagger type safe proxy for CompareResponse

func CompareResponseV3

func CompareResponseV3(l, r *v3.Response) *ResponseChanges

CompareResponseV3 is an OpenAPI type safe proxy for CompareResponse

func (*ResponseChanges) GetAllChanges added in v0.7.0

func (r *ResponseChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between RequestBody objects

func (*ResponseChanges) TotalBreakingChanges

func (r *ResponseChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes found between two swagger or OpenAPI Response Objects

func (*ResponseChanges) TotalChanges

func (r *ResponseChanges) TotalChanges() int

TotalChanges returns the total number of changes found between two Swagger or OpenAPI Response Objects

type ResponseRules added in v0.29.0

type ResponseRules struct {
	Description *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Summary     *BreakingChangeRule `json:"summary,omitempty" yaml:"summary,omitempty"`
	Schema      *BreakingChangeRule `json:"schema,omitempty" yaml:"schema,omitempty"`
	Examples    *BreakingChangeRule `json:"examples,omitempty" yaml:"examples,omitempty"`
}

ResponseRules defines breaking rules for the Response object properties.

type ResponsesChanges

type ResponsesChanges struct {
	*PropertyChanges
	ResponseChanges  map[string]*ResponseChanges `json:"response,omitempty" yaml:"response,omitempty"`
	DefaultChanges   *ResponseChanges            `json:"default,omitempty" yaml:"default,omitempty"`
	ExtensionChanges *ExtensionChanges           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

ResponsesChanges represents changes made between two Swagger or OpenAPI Responses objects.

func CompareResponses

func CompareResponses(l, r any) *ResponsesChanges

CompareResponses compares a left and right Swagger or OpenAPI Responses object for any changes. If found returns a pointer to ResponsesChanges, or returns nil.

func (*ResponsesChanges) GetAllChanges added in v0.7.0

func (r *ResponsesChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Responses objects

func (*ResponsesChanges) TotalBreakingChanges

func (r *ResponsesChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of changes found between two Swagger or OpenAPI Responses Objects

func (*ResponsesChanges) TotalChanges

func (r *ResponsesChanges) TotalChanges() int

TotalChanges returns the total number of changes found between two Swagger or OpenAPI Responses objects

type ResponsesRules added in v0.29.0

type ResponsesRules struct {
	Default *BreakingChangeRule `json:"default,omitempty" yaml:"default,omitempty"`
	Codes   *BreakingChangeRule `json:"codes,omitempty" yaml:"codes,omitempty"`
}

ResponsesRules defines breaking rules for the Responses object properties.

type SchemaChanges

type SchemaChanges struct {
	*PropertyChanges
	DiscriminatorChanges        *DiscriminatorChanges     `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`
	AllOfChanges                []*SchemaChanges          `json:"allOf,omitempty" yaml:"allOf,omitempty"`
	AnyOfChanges                []*SchemaChanges          `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
	OneOfChanges                []*SchemaChanges          `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
	PrefixItemsChanges          []*SchemaChanges          `json:"prefixItems,omitempty" yaml:"prefixItems,omitempty"`
	NotChanges                  *SchemaChanges            `json:"not,omitempty" yaml:"not,omitempty"`
	ItemsChanges                *SchemaChanges            `json:"items,omitempty" yaml:"items,omitempty"`
	SchemaPropertyChanges       map[string]*SchemaChanges `json:"properties,omitempty" yaml:"properties,omitempty"`
	ExternalDocChanges          *ExternalDocChanges       `json:"externalDoc,omitempty" yaml:"externalDoc,omitempty"`
	XMLChanges                  *XMLChanges               `json:"xml,omitempty" yaml:"xml,omitempty"`
	ExtensionChanges            *ExtensionChanges         `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	AdditionalPropertiesChanges *SchemaChanges            `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`

	// 3.1 specifics
	IfChanges                    *SchemaChanges            `json:"if,omitempty" yaml:"if,omitempty"`
	ElseChanges                  *SchemaChanges            `json:"else,omitempty" yaml:"else,omitempty"`
	ThenChanges                  *SchemaChanges            `json:"then,omitempty" yaml:"then,omitempty"`
	PropertyNamesChanges         *SchemaChanges            `json:"propertyNames,omitempty" yaml:"propertyNames,omitempty"`
	ContainsChanges              *SchemaChanges            `json:"contains,omitempty" yaml:"contains,omitempty"`
	UnevaluatedItemsChanges      *SchemaChanges            `json:"unevaluatedItems,omitempty" yaml:"unevaluatedItems,omitempty"`
	UnevaluatedPropertiesChanges *SchemaChanges            `json:"unevaluatedProperties,omitempty" yaml:"unevaluatedProperties,omitempty"`
	DependentSchemasChanges      map[string]*SchemaChanges `json:"dependentSchemas,omitempty" yaml:"dependentSchemas,omitempty"`
	DependentRequiredChanges     []*Change                 `json:"dependentRequired,omitempty" yaml:"dependentRequired,omitempty"`
	PatternPropertiesChanges     map[string]*SchemaChanges `json:"patternProperties,omitempty" yaml:"patternProperties,omitempty"`
	ContentSchemaChanges         *SchemaChanges            `json:"contentSchema,omitempty" yaml:"contentSchema,omitempty"`
	VocabularyChanges            []*Change                 `json:"$vocabulary,omitempty" yaml:"$vocabulary,omitempty"`
}

SchemaChanges represent all changes to a base.Schema OpenAPI object. These changes are represented by all versions of OpenAPI.

Any additions or removals to slice based results will be recorded in the PropertyChanges of the parent changes, and not the child for example, adding a new schema to `anyOf` will create a new change result in PropertyChanges.Changes, and not in the AnyOfChanges property.

func CompareSchemas

func CompareSchemas(l, r *base.SchemaProxy) *SchemaChanges

CompareSchemas accepts a left and right SchemaProxy and checks for changes. If anything is found, returns a pointer to SchemaChanges, otherwise returns nil

func (*SchemaChanges) GetAllChanges added in v0.7.0

func (s *SchemaChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Responses objects

func (*SchemaChanges) GetPropertyChanges added in v0.21.9

func (s *SchemaChanges) GetPropertyChanges() []*Change

func (*SchemaChanges) TotalBreakingChanges

func (s *SchemaChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes made to this schema and all sub-schemas.

func (*SchemaChanges) TotalChanges

func (s *SchemaChanges) TotalChanges() int

TotalChanges returns a count of the total number of changes made to this schema and all sub-schemas

type SchemaRules added in v0.29.0

type SchemaRules struct {
	Ref                   *BreakingChangeRule `json:"$ref,omitempty" yaml:"$ref,omitempty"`
	Type                  *BreakingChangeRule `json:"type,omitempty" yaml:"type,omitempty"`
	Title                 *BreakingChangeRule `json:"title,omitempty" yaml:"title,omitempty"`
	Description           *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Format                *BreakingChangeRule `json:"format,omitempty" yaml:"format,omitempty"`
	Maximum               *BreakingChangeRule `json:"maximum,omitempty" yaml:"maximum,omitempty"`
	Minimum               *BreakingChangeRule `json:"minimum,omitempty" yaml:"minimum,omitempty"`
	ExclusiveMaximum      *BreakingChangeRule `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"`
	ExclusiveMinimum      *BreakingChangeRule `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"`
	MaxLength             *BreakingChangeRule `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	MinLength             *BreakingChangeRule `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	Pattern               *BreakingChangeRule `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MaxItems              *BreakingChangeRule `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	MinItems              *BreakingChangeRule `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxProperties         *BreakingChangeRule `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"`
	MinProperties         *BreakingChangeRule `json:"minProperties,omitempty" yaml:"minProperties,omitempty"`
	UniqueItems           *BreakingChangeRule `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	MultipleOf            *BreakingChangeRule `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
	ContentEncoding       *BreakingChangeRule `json:"contentEncoding,omitempty" yaml:"contentEncoding,omitempty"`
	ContentMediaType      *BreakingChangeRule `json:"contentMediaType,omitempty" yaml:"contentMediaType,omitempty"`
	Default               *BreakingChangeRule `json:"default,omitempty" yaml:"default,omitempty"`
	Const                 *BreakingChangeRule `json:"const,omitempty" yaml:"const,omitempty"`
	Nullable              *BreakingChangeRule `json:"nullable,omitempty" yaml:"nullable,omitempty"`
	ReadOnly              *BreakingChangeRule `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
	WriteOnly             *BreakingChangeRule `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"`
	Deprecated            *BreakingChangeRule `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	Example               *BreakingChangeRule `json:"example,omitempty" yaml:"example,omitempty"`
	Examples              *BreakingChangeRule `json:"examples,omitempty" yaml:"examples,omitempty"`
	Required              *BreakingChangeRule `json:"required,omitempty" yaml:"required,omitempty"`
	Enum                  *BreakingChangeRule `json:"enum,omitempty" yaml:"enum,omitempty"`
	Properties            *BreakingChangeRule `json:"properties,omitempty" yaml:"properties,omitempty"`
	AdditionalProperties  *BreakingChangeRule `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
	AllOf                 *BreakingChangeRule `json:"allOf,omitempty" yaml:"allOf,omitempty"`
	AnyOf                 *BreakingChangeRule `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
	OneOf                 *BreakingChangeRule `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
	PrefixItems           *BreakingChangeRule `json:"prefixItems,omitempty" yaml:"prefixItems,omitempty"`
	Items                 *BreakingChangeRule `json:"items,omitempty" yaml:"items,omitempty"`
	Discriminator         *BreakingChangeRule `json:"discriminator,omitempty" yaml:"discriminator,omitempty"`
	ExternalDocs          *BreakingChangeRule `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Not                   *BreakingChangeRule `json:"not,omitempty" yaml:"not,omitempty"`
	If                    *BreakingChangeRule `json:"if,omitempty" yaml:"if,omitempty"`
	Then                  *BreakingChangeRule `json:"then,omitempty" yaml:"then,omitempty"`
	Else                  *BreakingChangeRule `json:"else,omitempty" yaml:"else,omitempty"`
	PropertyNames         *BreakingChangeRule `json:"propertyNames,omitempty" yaml:"propertyNames,omitempty"`
	Contains              *BreakingChangeRule `json:"contains,omitempty" yaml:"contains,omitempty"`
	UnevaluatedItems      *BreakingChangeRule `json:"unevaluatedItems,omitempty" yaml:"unevaluatedItems,omitempty"`
	UnevaluatedProperties *BreakingChangeRule `json:"unevaluatedProperties,omitempty" yaml:"unevaluatedProperties,omitempty"`
	DynamicAnchor         *BreakingChangeRule `json:"$dynamicAnchor,omitempty" yaml:"$dynamicAnchor,omitempty"`
	DynamicRef            *BreakingChangeRule `json:"$dynamicRef,omitempty" yaml:"$dynamicRef,omitempty"`
	Id                    *BreakingChangeRule `json:"$id,omitempty" yaml:"$id,omitempty"`
	Comment               *BreakingChangeRule `json:"$comment,omitempty" yaml:"$comment,omitempty"`
	ContentSchema         *BreakingChangeRule `json:"contentSchema,omitempty" yaml:"contentSchema,omitempty"`
	Vocabulary            *BreakingChangeRule `json:"$vocabulary,omitempty" yaml:"$vocabulary,omitempty"`
	DependentRequired     *BreakingChangeRule `json:"dependentRequired,omitempty" yaml:"dependentRequired,omitempty"`
	XML                   *BreakingChangeRule `json:"xml,omitempty" yaml:"xml,omitempty"`
	SchemaDialect         *BreakingChangeRule `json:"schemaDialect,omitempty" yaml:"schemaDialect,omitempty"`
}

SchemaRules defines breaking rules for the Schema object properties.

type ScopesChanges

type ScopesChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

ScopesChanges represents changes between two Swagger Scopes Objects

func CompareScopes

func CompareScopes(l, r *v2.Scopes) *ScopesChanges

CompareScopes compares a left and right Swagger Scopes objects for changes. If anything is found, returns a pointer to ScopesChanges, or returns nil if nothing is found.

func (*ScopesChanges) GetAllChanges added in v0.7.0

func (s *ScopesChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Scopes objects

func (*ScopesChanges) TotalBreakingChanges

func (s *ScopesChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes between two Swagger Scopes objects.

func (*ScopesChanges) TotalChanges

func (s *ScopesChanges) TotalChanges() int

TotalChanges returns the total changes found between two Swagger Scopes objects.

type SecurityRequirementChanges

type SecurityRequirementChanges struct {
	*PropertyChanges
}

SecurityRequirementChanges represents changes found between two SecurityRequirement Objects.

func CompareSecurityRequirement

func CompareSecurityRequirement(l, r *base.SecurityRequirement) *SecurityRequirementChanges

CompareSecurityRequirement compares left and right SecurityRequirement objects for changes. If anything is found, then a pointer to SecurityRequirementChanges is returned, otherwise nil.

func (*SecurityRequirementChanges) GetAllChanges added in v0.7.0

func (s *SecurityRequirementChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between SecurityRequirement objects

func (*SecurityRequirementChanges) TotalBreakingChanges

func (s *SecurityRequirementChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes between two SecurityRequirement Objects.

func (*SecurityRequirementChanges) TotalChanges

func (s *SecurityRequirementChanges) TotalChanges() int

TotalChanges returns the total number of changes between two SecurityRequirement Objects.

type SecurityRequirementRules added in v0.29.0

type SecurityRequirementRules struct {
	Schemes *BreakingChangeRule `json:"schemes,omitempty" yaml:"schemes,omitempty"`
	Scopes  *BreakingChangeRule `json:"scopes,omitempty" yaml:"scopes,omitempty"`
}

SecurityRequirementRules defines breaking rules for the Security Requirement object properties.

type SecuritySchemeChanges

type SecuritySchemeChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`

	// OpenAPI Version
	OAuthFlowChanges *OAuthFlowsChanges `json:"oAuthFlow,omitempty" yaml:"oAuthFlow,omitempty"`

	// Swagger Version
	ScopesChanges *ScopesChanges `json:"scopes,omitempty" yaml:"scopes,omitempty"`
}

SecuritySchemeChanges represents changes made between Swagger or OpenAPI SecurityScheme Objects.

func CompareSecuritySchemes

func CompareSecuritySchemes(l, r any) *SecuritySchemeChanges

CompareSecuritySchemes compares left and right Swagger or OpenAPI Security Scheme objects for changes. If anything is found, returns a pointer to *SecuritySchemeChanges or nil if nothing is found.

func CompareSecuritySchemesV2

func CompareSecuritySchemesV2(l, r *v2.SecurityScheme) *SecuritySchemeChanges

CompareSecuritySchemesV2 is a Swagger type safe proxy for CompareSecuritySchemes

func CompareSecuritySchemesV3

func CompareSecuritySchemesV3(l, r *v3.SecurityScheme) *SecuritySchemeChanges

CompareSecuritySchemesV3 is an OpenAPI type safe proxt for CompareSecuritySchemes

func (*SecuritySchemeChanges) GetAllChanges added in v0.7.0

func (ss *SecuritySchemeChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between SecurityRequirement objects

func (*SecuritySchemeChanges) TotalBreakingChanges

func (ss *SecuritySchemeChanges) TotalBreakingChanges() int

TotalBreakingChanges returns total number of breaking changes between two SecurityScheme Objects.

func (*SecuritySchemeChanges) TotalChanges

func (ss *SecuritySchemeChanges) TotalChanges() int

TotalChanges represents total changes found between two Swagger or OpenAPI SecurityScheme instances.

type SecuritySchemeRules added in v0.29.0

type SecuritySchemeRules struct {
	Type              *BreakingChangeRule `json:"type,omitempty" yaml:"type,omitempty"`
	Description       *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Name              *BreakingChangeRule `json:"name,omitempty" yaml:"name,omitempty"`
	In                *BreakingChangeRule `json:"in,omitempty" yaml:"in,omitempty"`
	Scheme            *BreakingChangeRule `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	BearerFormat      *BreakingChangeRule `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"`
	OpenIDConnectURL  *BreakingChangeRule `json:"openIdConnectUrl,omitempty" yaml:"openIdConnectUrl,omitempty"`
	OAuth2MetadataUrl *BreakingChangeRule `json:"oauth2MetadataUrl,omitempty" yaml:"oauth2MetadataUrl,omitempty"`
	Flows             *BreakingChangeRule `json:"flows,omitempty" yaml:"flows,omitempty"`
	Scopes            *BreakingChangeRule `json:"scopes,omitempty" yaml:"scopes,omitempty"`
	Flow              *BreakingChangeRule `json:"flow,omitempty" yaml:"flow,omitempty"`                         // Swagger 2.0
	AuthorizationURL  *BreakingChangeRule `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"` // Swagger 2.0
	TokenURL          *BreakingChangeRule `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`                 // Swagger 2.0
	Deprecated        *BreakingChangeRule `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
}

SecuritySchemeRules defines breaking rules for the Security Scheme object properties.

type ServerChanges

type ServerChanges struct {
	*PropertyChanges
	Server                *v3.Server
	ServerVariableChanges map[string]*ServerVariableChanges `json:"serverVariables,omitempty" yaml:"serverVariables,omitempty"`
	ExtensionChanges      *ExtensionChanges                 `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

ServerChanges represents changes found between two OpenAPI Server Objects

func CompareServers

func CompareServers(l, r *v3.Server) *ServerChanges

CompareServers compares two OpenAPI Server objects for any changes. If anything is found, returns a pointer to a ServerChanges instance, or returns nil if nothing is found.

func (*ServerChanges) GetAllChanges added in v0.7.0

func (s *ServerChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between SecurityRequirement objects

func (*ServerChanges) TotalBreakingChanges

func (s *ServerChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the total number of breaking changes found between two OpenAPI Server objects.

func (*ServerChanges) TotalChanges

func (s *ServerChanges) TotalChanges() int

TotalChanges returns total changes found between two OpenAPI Server Objects

type ServerRules added in v0.29.0

type ServerRules struct {
	Name        *BreakingChangeRule `json:"name,omitempty" yaml:"name,omitempty"`
	URL         *BreakingChangeRule `json:"url,omitempty" yaml:"url,omitempty"`
	Description *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
}

ServerRules defines breaking rules for the Server object properties.

type ServerVariableChanges

type ServerVariableChanges struct {
	*PropertyChanges
}

ServerVariableChanges represents changes found between two OpenAPI ServerVariable Objects

func CompareServerVariables

func CompareServerVariables(l, r *v3.ServerVariable) *ServerVariableChanges

CompareServerVariables compares a left and right OpenAPI ServerVariable object for changes. If anything is found, returns a pointer to a ServerVariableChanges instance, otherwise returns nil.

func (*ServerVariableChanges) GetAllChanges added in v0.7.0

func (s *ServerVariableChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between SecurityRequirement objects

type ServerVariableRules added in v0.29.0

type ServerVariableRules struct {
	Enum        *BreakingChangeRule `json:"enum,omitempty" yaml:"enum,omitempty"`
	Default     *BreakingChangeRule `json:"default,omitempty" yaml:"default,omitempty"`
	Description *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
}

ServerVariableRules defines breaking rules for the Server Variable object properties.

type TagChanges

type TagChanges struct {
	*PropertyChanges
	ExternalDocs     *ExternalDocChanges `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	ExtensionChanges *ExtensionChanges   `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

TagChanges represents changes made to the Tags object of an OpenAPI document.

func CompareTags

func CompareTags(l, r []low.ValueReference[*base.Tag]) []*TagChanges

CompareTags will compare a left (original) and a right (new) slice of ValueReference nodes for any changes between them. If there are changes, a pointer to TagChanges is returned, if not then nil is returned instead.

func (*TagChanges) GetAllChanges added in v0.7.0

func (t *TagChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between Tag objects

func (*TagChanges) TotalBreakingChanges

func (t *TagChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the number of breaking changes made by Tags

func (*TagChanges) TotalChanges

func (t *TagChanges) TotalChanges() int

TotalChanges returns a count of everything that changed within tags.

type TagRules added in v0.29.0

type TagRules struct {
	Name         *BreakingChangeRule `json:"name,omitempty" yaml:"name,omitempty"`
	Summary      *BreakingChangeRule `json:"summary,omitempty" yaml:"summary,omitempty"`
	Description  *BreakingChangeRule `json:"description,omitempty" yaml:"description,omitempty"`
	Parent       *BreakingChangeRule `json:"parent,omitempty" yaml:"parent,omitempty"`
	Kind         *BreakingChangeRule `json:"kind,omitempty" yaml:"kind,omitempty"`
	ExternalDocs *BreakingChangeRule `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
}

TagRules defines breaking rules for the Tag object properties.

type WhatChanged

type WhatChanged struct {
	Added        int `json:"added,omitempty" yaml:"added,omitempty"`
	Removed      int `json:"removed,omitempty" yaml:"removed,omitempty"`
	Modified     int `json:"modified,omitempty" yaml:"modified,omitempty"`
	TotalChanges int `json:"total,omitempty" yaml:"total,omitempty"`
}

WhatChanged is a summary object that contains a high level summary of everything changed.

type XMLChanges

type XMLChanges struct {
	*PropertyChanges
	ExtensionChanges *ExtensionChanges `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

XMLChanges represents changes made to the XML object of an OpenAPI document.

func CompareXML

func CompareXML(l, r *base.XML) *XMLChanges

CompareXML will compare a left (original) and a right (new) XML instance, and check for any changes between them. If changes are found, the function returns a pointer to XMLChanges, otherwise, if nothing changed - it will return nil

func (*XMLChanges) GetAllChanges added in v0.7.0

func (x *XMLChanges) GetAllChanges() []*Change

GetAllChanges returns a slice of all changes made between XML objects

func (*XMLChanges) TotalBreakingChanges

func (x *XMLChanges) TotalBreakingChanges() int

TotalBreakingChanges returns the number of breaking changes made by the XML object.

func (*XMLChanges) TotalChanges

func (x *XMLChanges) TotalChanges() int

TotalChanges returns a count of everything that was changed within an XML object.

type XMLRules added in v0.29.0

type XMLRules struct {
	Name      *BreakingChangeRule `json:"name,omitempty" yaml:"name,omitempty"`
	Namespace *BreakingChangeRule `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	Prefix    *BreakingChangeRule `json:"prefix,omitempty" yaml:"prefix,omitempty"`
	Attribute *BreakingChangeRule `json:"attribute,omitempty" yaml:"attribute,omitempty"`
	NodeType  *BreakingChangeRule `json:"nodeType,omitempty" yaml:"nodeType,omitempty"`
	Wrapped   *BreakingChangeRule `json:"wrapped,omitempty" yaml:"wrapped,omitempty"`
}

XMLRules defines breaking rules for the XML object properties.

Jump to

Keyboard shortcuts

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