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
- func CheckForAddition[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)
- func CheckForModification[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)
- func CheckForObjectAdditionOrRemoval[T any](l, r map[string]*low.ValueReference[T], label string, changes *[]*Change, ...)
- func CheckForRemoval[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)
- func CheckMapForAdditionRemoval[T any](expLeft, expRight map[low.KeyReference[string]]low.ValueReference[T], ...) any
- func CheckMapForChanges[T any, R any](expLeft, expRight map[low.KeyReference[string]]low.ValueReference[T], ...) map[string]R
- func CheckMapForChangesWithComp[T any, R any](expLeft, expRight map[low.KeyReference[string]]low.ValueReference[T], ...) map[string]R
- func CheckProperties(properties []*PropertyCheck)
- func CheckPropertyAdditionOrRemoval[T any](l, r *yaml.Node, label string, changes *[]*Change, breaking bool, orig, new T)
- func CheckSpecificObjectAdded[T any](l, r map[string]*T, label string) bool
- func CheckSpecificObjectRemoved[T any](l, r map[string]*T, label string) bool
- func CountBreakingChanges(changes []*Change) int
- func CreateChange(changes *[]*Change, changeType int, property string, ...) *[]*Change
- func ExtractRawValueSliceChanges(lParam, rParam []low.ValueReference[any], changes *[]*Change, label string, ...)
- func ExtractStringValueSliceChanges(lParam, rParam []low.ValueReference[string], changes *[]*Change, label string, ...)
- func FlattenLowLevelMap[T any](lowMap map[low.KeyReference[string]]low.ValueReference[T]) map[string]*low.ValueReference[T]
- type CallbackChanges
- type Change
- type ChangeContext
- type ComponentsChanges
- type ContactChanges
- type DiscriminatorChanges
- type DocumentChanges
- type EncodingChanges
- type ExampleChanges
- type ExamplesChanges
- type ExtensionChanges
- type ExternalDocChanges
- type HeaderChanges
- type InfoChanges
- type ItemsChanges
- type LicenseChanges
- type LinkChanges
- type MediaTypeChanges
- type OAuthFlowChanges
- type OAuthFlowsChanges
- type OperationChanges
- type ParameterChanges
- type PathItemChanges
- type PathsChanges
- type PropertyChanges
- type PropertyCheck
- type RequestBodyChanges
- type ResponseChanges
- type ResponsesChanges
- type SchemaChanges
- type ScopesChanges
- type SecurityRequirementChanges
- type SecuritySchemeChanges
- type ServerChanges
- type ServerVariableChanges
- type TagChanges
- type WhatChanged
- type XMLChanges
Constants ¶
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
const ( HashPh = "%x" EMPTY_STR = "" )
Variables ¶
This section is empty.
Functions ¶
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 left, 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 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 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 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 CheckMapForAdditionRemoval ¶
func CheckMapForAdditionRemoval[T any](expLeft, expRight map[low.KeyReference[string]]low.ValueReference[T], changes *[]*Change, label string) any
func CheckMapForChanges ¶
func CheckMapForChanges[T any, R any](expLeft, expRight 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.
func CheckMapForChangesWithComp ¶
func CheckMapForChangesWithComp[T any, R any](expLeft, expRight 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.
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
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 CheckSpecificObjectAdded ¶
CheckSpecificObjectAdded returns true if a specific value is not in both maps.
func CheckSpecificObjectRemoved ¶
CheckSpecificObjectRemoved returns true if a specific value is not in both maps.
func CountBreakingChanges ¶
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 ExtractRawValueSliceChanges ¶
func ExtractRawValueSliceChanges(lParam, rParam []low.ValueReference[any], 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.
func FlattenLowLevelMap ¶
func FlattenLowLevelMap[T any]( lowMap map[low.KeyReference[string]]low.ValueReference[T]) map[string]*low.ValueReference[T]
Types ¶
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.
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 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"` // 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:"-"` }
Change represents a change between two different elements inside an OpenAPI specification.
type ChangeContext ¶
type ChangeContext struct { 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 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 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 always returns 0 for Contact objects, they are non-binding.
func (*ContactChanges) TotalChanges ¶
func (c *ContactChanges) TotalChanges() int
TotalChanges represents the total number of changes that have occurred to a Contact object
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 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 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 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.
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 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 ¶
func CompareExtensions(l, r map[low.KeyReference[string]]low.ValueReference[any]) *ExtensionChanges
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 always returns 0 for Extension objects, they are non-binding.
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 always returns 0 for ExternalDoc objects, they are non-binding.
func (*ExternalDocChanges) TotalChanges ¶
func (e *ExternalDocChanges) TotalChanges() int
TotalChanges returns a count of everything that changed
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 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 always returns 0 for Info objects, they are non-binding.
func (*InfoChanges) TotalChanges ¶
func (i *InfoChanges) TotalChanges() int
TotalChanges represents the total number of changes made to an Info object.
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
}
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 always returns 0 for License objects, they are non-binding.
func (*LicenseChanges) TotalChanges ¶
func (l *LicenseChanges) TotalChanges() int
TotalChanges represents the total number of changes made to a License instance.
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 ¶
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 MediaTypeChanges ¶
type MediaTypeChanges struct { *PropertyChanges SchemaChanges *SchemaChanges `json:"schemas,omitempty" yaml:"schemas,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"` }
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 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 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"` 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 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 ParameterChanges ¶
type ParameterChanges struct { *PropertyChanges 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 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"` 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 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 PropertyChanges ¶
type PropertyChanges struct { //Total *int `json:"total,omitempty" yaml:"total,omitempty"` //Breaking *int `json:"breaking,omitempty" yaml:"breaking,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) 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.) Breaking bool // 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.
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 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 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 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"` 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"` PatternPropertiesChanges map[string]*SchemaChanges `json:"patternProperties,omitempty" yaml:"patternProperties,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) 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 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 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 ServerChanges ¶
type ServerChanges struct { *PropertyChanges ServerVariableChanges map[string]*ServerVariableChanges `json:"serverVariables,omitempty" yaml:"serverVariables,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 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 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 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.
Source Files ¶
- callback.go
- change_types.go
- comparison_functions.go
- components.go
- contact.go
- discriminator.go
- document.go
- encoding.go
- example.go
- examples.go
- extensions.go
- external_docs.go
- header.go
- info.go
- items.go
- license.go
- link.go
- media_type.go
- oauth_flows.go
- operation.go
- parameter.go
- path_item.go
- paths.go
- request_body.go
- response.go
- responses.go
- schema.go
- scopes.go
- security_requirement.go
- security_scheme.go
- server.go
- server_variable.go
- tags.go
- xml.go