diff

package
v1.10.15 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Overview

Package diff provides a diff function for OpenAPI Spec 3.

Index

Examples

Constants

View Source
const (
	ExcludeExamplesOption    = "examples"
	ExcludeDescriptionOption = "description"
	ExcludeEndpointsOption   = "endpoints"
	ExcludeTitleOption       = "title"
	ExcludeSummaryOption     = "summary"
	ExcludeExtensionsOption  = "extensions"
)
View Source
const (
	SunsetExtension          = "x-sunset"
	XStabilityLevelExtension = "x-stability-level"
	XExtensibleEnumExtension = "x-extensible-enum"
)
View Source
const SinceDateExtension = "x-since-date"

Variables

View Source
var (
	DefaultSinceDate = civil.Date{Year: 2000, Month: 1, Day: 1}
)

ParamLocations are the four possible locations of parameters: path, query, header or cookie

Functions

func GetPathsDiff added in v1.3.0

func GetPathsDiff(config *Config, s1, s2 []*load.SpecInfo) (*Diff, *OperationsSourcesMap, error)

GetPathsDiff calculates the diff between a pair of slice of OpenAPI objects. It is helpful when you want to find diff and check for breaking changes for API divided into multiple files. If there are same paths in different OpenAPI objects, then function uses version of the path with the last x-since-date extension. The x-since-date extension should be set on path or operations level. Extension set on the operations level overrides the value set on path level. If such path doesn't have the x-since-date extension, its value is default "2000-01-01" If there are same paths with the same x-since-date value, then function returns error. The format of the x-since-date is the RFC3339 full-date format

Note that Get expects OpenAPI References (https://swagger.io/docs/specification/using-ref/) to be resolved. References are normally resolved automatically when you load the spec. In other cases you can resolve refs using https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#Loader.ResolveRefsIn.

Example
package main

import (
	"fmt"
	"os"
	"strings"

	"github.com/getkin/kin-openapi/openapi3"
	"github.com/tufin/oasdiff/checker"
	"github.com/tufin/oasdiff/diff"
	"github.com/tufin/oasdiff/load"
)

func main() {
	loader := openapi3.NewLoader()
	loader.IsExternalRefsAllowed = true

	s1, err := load.NewSpecInfo(loader, load.NewSource("../data/openapi-test1.yaml"))
	if err != nil {
		fmt.Fprintf(os.Stderr, "failed to load spec: %v", err)
		return
	}

	s2, err := load.NewSpecInfo(loader, load.NewSource("../data/openapi-test3.yaml"))
	if err != nil {
		fmt.Fprintf(os.Stderr, "failed to load spec: %v", err)
		return
	}

	diffRes, operationsSources, err := diff.GetPathsDiff(diff.NewConfig(),
		[]*load.SpecInfo{s1},
		[]*load.SpecInfo{s2},
	)

	if err != nil {
		fmt.Fprintf(os.Stderr, "diff failed with %v", err)
		return
	}

	errs := checker.CheckBackwardCompatibility(checker.GetDefaultChecks(), diffRes, operationsSources)

	// process configuration file for ignoring errors
	errs, err = checker.ProcessIgnoredBackwardCompatibilityErrors(checker.ERR, errs, "../data/ignore-err-example.txt", checker.NewDefaultLocalizer())
	if err != nil {
		fmt.Fprintf(os.Stderr, "ignore errors failed with %v", err)
		return
	}

	// process configuration file for ignoring warnings
	errs, err = checker.ProcessIgnoredBackwardCompatibilityErrors(checker.WARN, errs, "../data/ignore-warn-example.txt", checker.NewDefaultLocalizer())
	if err != nil {
		fmt.Fprintf(os.Stderr, "ignore warnings failed with %v", err)
		return
	}

	// pretty print breaking changes errors
	if len(errs) > 0 {
		localizer := checker.NewDefaultLocalizer()
		count := errs.GetLevelCount()
		fmt.Print(localizer("total-errors", len(errs), count[checker.ERR], "error", count[checker.WARN], "warning"))
		for _, bcerr := range errs {
			fmt.Printf("%s\n\n", strings.TrimRight(bcerr.SingleLineError(localizer, checker.ColorNever), " "))
		}
	}

}
Output:

4 breaking changes: 1 error, 3 warning
error at ../data/openapi-test3.yaml, in API GET /api/{domain}/{project}/badges/security-score removed the success response with the status '201' [response-success-status-removed].

warning at ../data/openapi-test3.yaml, in API GET /api/{domain}/{project}/badges/security-score deleted the 'cookie' request parameter 'test' [request-parameter-removed].

warning at ../data/openapi-test3.yaml, in API GET /api/{domain}/{project}/badges/security-score deleted the 'header' request parameter 'user' [request-parameter-removed].

warning at ../data/openapi-test3.yaml, in API GET /api/{domain}/{project}/badges/security-score deleted the 'query' request parameter 'filter' [request-parameter-removed].

func GetWithOperationsSourcesMap added in v1.3.0

func GetWithOperationsSourcesMap(config *Config, s1, s2 *load.SpecInfo) (*Diff, *OperationsSourcesMap, error)

GetWithOperationsSourcesMap calculates the diff between a pair of OpenAPI objects.

Note that GetWithOperationsSourcesMap expects OpenAPI References (https://swagger.io/docs/specification/using-ref/) to be resolved. References are normally resolved automatically when you load the spec. In other cases you can resolve refs using https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#Loader.ResolveRefsIn.

Types

type CallbacksDiff added in v0.1.11

type CallbacksDiff struct {
	Added    utils.StringList  `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList  `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedCallbacks `json:"modified,omitempty" yaml:"modified,omitempty"`
}

CallbacksDiff describes the changes between a pair of callback objects: https://swagger.io/specification/#callback-object

func (*CallbacksDiff) Empty added in v0.2.10

func (diff *CallbacksDiff) Empty() bool

Empty indicates whether a change was found in this element

type ComponentsDiff added in v0.2.8

type ComponentsDiff struct {
	SchemasDiff         *SchemasDiff         `json:"schemas,omitempty" yaml:"schemas,omitempty"`
	ParametersDiff      *ParametersDiff      `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	HeadersDiff         *HeadersDiff         `json:"headers,omitempty" yaml:"headers,omitempty"`
	RequestBodiesDiff   *RequestBodiesDiff   `json:"requestBodies,omitempty" yaml:"requestBodies,omitempty"`
	ResponsesDiff       *ResponsesDiff       `json:"responses,omitempty" yaml:"responses,omitempty"`
	SecuritySchemesDiff *SecuritySchemesDiff `json:"securitySchemes,omitempty" yaml:"securitySchemes,omitempty"`
	ExamplesDiff        *ExamplesDiff        `json:"examples,omitempty" yaml:"examples,omitempty"`
	LinksDiff           *LinksDiff           `json:"links,omitempty" yaml:"links,omitempty"`
	CallbacksDiff       *CallbacksDiff       `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
}

ComponentsDiff describes the changes between a pair of component objects: https://swagger.io/specification/#components-object

type Config added in v0.2.1

type Config struct {
	PathFilter              string
	FilterExtension         string
	PathPrefixBase          string
	PathPrefixRevision      string
	PathStripPrefixBase     string
	PathStripPrefixRevision string
	ExcludeElements         utils.StringSet
	IncludePathParams       bool
}

Config includes various settings to control the diff

func NewConfig added in v0.2.1

func NewConfig() *Config

NewConfig returns a default configuration

func (*Config) IsExcludeDescription added in v1.3.17

func (config *Config) IsExcludeDescription() bool

func (*Config) IsExcludeEndpoints added in v1.3.17

func (config *Config) IsExcludeEndpoints() bool

func (*Config) IsExcludeExamples added in v1.3.17

func (config *Config) IsExcludeExamples() bool

func (*Config) IsExcludeExtensions added in v1.10.13

func (config *Config) IsExcludeExtensions() bool

func (*Config) IsExcludeSummary added in v1.3.17

func (config *Config) IsExcludeSummary() bool

func (*Config) IsExcludeTitle added in v1.3.17

func (config *Config) IsExcludeTitle() bool

func (*Config) WithExcludeElements added in v1.6.0

func (config *Config) WithExcludeElements(excludeElements []string) *Config

func (*Config) WithExcludeExtensions added in v1.10.13

func (config *Config) WithExcludeExtensions() *Config

type ContactDiff added in v0.3.5

type ContactDiff struct {
	Added          bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted        bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	NameDiff       *ValueDiff      `json:"name,omitempty" yaml:"name,omitempty"`
	URLDiff        *ValueDiff      `json:"url,omitempty" yaml:"url,omitempty"`
	EmailDiff      *ValueDiff      `json:"email,omitempty" yaml:"email,omitempty"`
}

ContactDiff describes the changes between a pair of contact objects: https://swagger.io/specification/#contact-object

func (*ContactDiff) Empty added in v0.3.5

func (diff *ContactDiff) Empty() bool

Empty indicates whether a change was found in this element

type ContentDiff

type ContentDiff struct {
	MediaTypeAdded    utils.StringList   `json:"mediaTypeAdded,omitempty" yaml:"mediaTypeAdded,omitempty"`
	MediaTypeDeleted  utils.StringList   `json:"mediaTypeDeleted,omitempty" yaml:"mediaTypeDeleted,omitempty"`
	MediaTypeModified ModifiedMediaTypes `json:"mediaTypeModified,omitempty" yaml:"mediaTypeModified,omitempty"`
}

ContentDiff describes the changes between content properties each containing media type objects: https://swagger.io/specification/#media-type-object

func (*ContentDiff) Empty added in v0.2.10

func (diff *ContentDiff) Empty() bool

Empty indicates whether a change was found in this element

type DetailName added in v0.2.10

type DetailName string

DetailName is the key type of the summary map

const (
	// Swagger
	PathsDetail        DetailName = "paths"
	SecurityDetail     DetailName = "security"
	ServersDetail      DetailName = "servers"
	TagsDetail         DetailName = "tags"
	ExternalDocsDetail DetailName = "externalDocs"

	// Components
	SchemasDetail         DetailName = "schemas"
	ParametersDetail      DetailName = "parameters"
	HeadersDetail         DetailName = "headers"
	RequestBodiesDetail   DetailName = "requestBodies"
	ResponsesDetail       DetailName = "responses"
	SecuritySchemesDetail DetailName = "securitySchemes"
	ExamplesDetail        DetailName = "examples"
	LinksDetail           DetailName = "links"
	CallbacksDetail       DetailName = "callbacks"

	// Special
	EndpointsDetail DetailName = "endpoints"
)

Detail constants are the keys in the summary map

type Diff

type Diff struct {
	ExtensionsDiff   *ExtensionsDiff           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	OpenAPIDiff      *ValueDiff                `json:"openAPI,omitempty" yaml:"openAPI,omitempty"`
	InfoDiff         *InfoDiff                 `json:"info,omitempty" yaml:"info,omitempty"`
	PathsDiff        *PathsDiff                `json:"paths,omitempty" yaml:"paths,omitempty"`
	EndpointsDiff    *EndpointsDiff            `json:"endpoints,omitempty" yaml:"endpoints,omitempty"`
	SecurityDiff     *SecurityRequirementsDiff `json:"security,omitempty" yaml:"security,omitempty"`
	ServersDiff      *ServersDiff              `json:"servers,omitempty" yaml:"servers,omitempty"`
	TagsDiff         *TagsDiff                 `json:"tags,omitempty" yaml:"tags,omitempty"`
	ExternalDocsDiff *ExternalDocsDiff         `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`

	ComponentsDiff `json:"components,omitempty" yaml:"components,omitempty"`
}

Diff describes the changes between a pair of OpenAPI objects: https://swagger.io/specification/#schema

func Get added in v0.1.9

func Get(config *Config, s1, s2 *openapi3.T) (*Diff, error)

Get calculates the diff between a pair of OpenAPI objects.

Note that Get expects OpenAPI References (https://swagger.io/docs/specification/using-ref/) to be resolved. References are normally resolved automatically when you load the spec. In other cases you can resolve refs using https://pkg.go.dev/github.com/getkin/kin-openapi/openapi3#Loader.ResolveRefsIn.

Example
loader := openapi3.NewLoader()
loader.IsExternalRefsAllowed = true

s1, err := loader.LoadFromFile("../data/simple1.yaml")
if err != nil {
	fmt.Fprintf(os.Stderr, "failed to load spec: %v", err)
	return
}

s2, err := loader.LoadFromFile("../data/simple2.yaml")
if err != nil {
	fmt.Fprintf(os.Stderr, "failed to load spec: %v", err)
	return
}

diffReport, err := diff.Get(diff.NewConfig(), s1, s2)

if err != nil {
	fmt.Fprintf(os.Stderr, "diff failed with %v", err)
	return
}

bytes, err := yaml.Marshal(diffReport)
if err != nil {
	fmt.Fprintf(os.Stderr, "failed to marshal result with %v", err)
	return
}
fmt.Printf("%s\n", bytes)
Output:

paths:
    modified:
        /api/test:
            operations:
                added:
                    - POST
                deleted:
                    - GET
endpoints:
    added:
        - method: POST
          path: /api/test
    deleted:
        - method: GET
          path: /api/test

func (*Diff) Empty added in v0.4.4

func (diff *Diff) Empty() bool

Empty indicates whether a change was found in this element

func (*Diff) GetSummary added in v0.4.4

func (diff *Diff) GetSummary() *Summary

GetSummary returns a summary of the changes in the diff

func (*Diff) Patch added in v0.4.4

func (diff *Diff) Patch(s *openapi3.T) error

Patch applies the patch to a spec

type DiscriminatorDiff added in v0.4.2

type DiscriminatorDiff struct {
	Added            bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted          bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff   *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	PropertyNameDiff *ValueDiff      `json:"propertyName,omitempty" yaml:"propertyName,omitempty"`
	MappingDiff      *StringMapDiff  `json:"mapping,omitempty" yaml:"mapping,omitempty"`
}

DiscriminatorDiff describes the changes between a pair of discriminator objects: https://swagger.io/specification/#discriminator-object

func (*DiscriminatorDiff) Empty added in v0.4.2

func (diff *DiscriminatorDiff) Empty() bool

Empty indicates whether a change was found in this element

type EncodingDiff added in v0.1.17

type EncodingDiff struct {
	ExtensionsDiff    *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	ContentTypeDiff   *ValueDiff      `json:"contentType,omitempty" yaml:"contentType,omitempty"`
	HeadersDiff       *HeadersDiff    `json:"headers,omitempty" yaml:"headers,omitempty"`
	StyleDiff         *ValueDiff      `json:"styleDiff,omitempty" yaml:"styleDiff,omitempty"`
	ExplodeDiff       *ValueDiff      `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowReservedDiff *ValueDiff      `json:"allowReservedDiff,omitempty" yaml:"allowReservedDiff,omitempty"`
}

EncodingDiff describes the changes between a pair of encoding objects: https://swagger.io/specification/#encoding-object

func (*EncodingDiff) Empty added in v0.2.10

func (diff *EncodingDiff) Empty() bool

Empty indicates whether a change was found in this element

type EncodingsDiff added in v0.1.17

type EncodingsDiff struct {
	Added    utils.StringList  `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList  `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedEncodings `json:"modified,omitempty" yaml:"modified,omitempty"`
}

EncodingsDiff describes the changes between a pair of sets of encoding objects: https://swagger.io/specification/#encoding-object

func (*EncodingsDiff) Empty added in v0.2.10

func (diff *EncodingsDiff) Empty() bool

Empty indicates whether a change was found in this element

type Endpoint added in v0.4.3

type Endpoint struct {
	Method string `json:"method,omitempty" yaml:"method,omitempty"`
	Path   string `json:"path,omitempty" yaml:"path,omitempty"`
}

Endpoint is a combination of an HTTP method and a Path

type Endpoints added in v0.4.3

type Endpoints []Endpoint

Endpoints is a list of endpoints

func (Endpoints) Len added in v0.5.3

func (endpoints Endpoints) Len() int

Len implements the sort.Interface interface

func (Endpoints) Less added in v0.5.3

func (endpoints Endpoints) Less(i, j int) bool

Less implements the sort.Interface interface

func (Endpoints) Swap added in v0.5.3

func (endpoints Endpoints) Swap(i, j int)

Swap implements the sort.Interface interface

type EndpointsDiff added in v0.4.3

type EndpointsDiff struct {
	Added    Endpoints         `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  Endpoints         `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedEndpoints `json:"modified,omitempty" yaml:"modified,omitempty"`
}

EndpointsDiff is an alternate, simplified view of PathsDiff. It describes the changes between Endpoints which are a flattened combination of OpenAPI Paths and Operations.

For example, if there's a new path "/test" with method POST then EndpointsDiff will describe this as a new endpoint: POST /test.

Or, if path "/test" was modified to include a new methdod, PUT, then EndpointsDiff will describe this as a new endpoint: PUT /test.

func (*EndpointsDiff) Empty added in v0.4.3

func (diff *EndpointsDiff) Empty() bool

Empty indicates whether a change was found in this element

type EnumDiff added in v0.1.3

type EnumDiff struct {
	EnumAdded   bool       `json:"enumAdded,omitempty" yaml:"enumAdded,omitempty"`
	EnumDeleted bool       `json:"enumDeleted,omitempty" yaml:"enumDeleted,omitempty"`
	Added       EnumValues `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted     EnumValues `json:"deleted,omitempty" yaml:"deleted,omitempty"`
}

EnumDiff describes the changes between a pair of enums

func (*EnumDiff) Empty added in v0.2.10

func (enumDiff *EnumDiff) Empty() bool

Empty indicates whether a change was found in this element

func (*EnumDiff) Patch added in v0.4.0

func (enumDiff *EnumDiff) Patch(enum *[]interface{})

Patch applies the patch to an enum

type EnumValues added in v0.1.5

type EnumValues []interface{}

EnumValues is a list of enum values

type ExampleDiff added in v0.3.6

type ExampleDiff struct {
	ExtensionsDiff    *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	SummaryDiff       *ValueDiff      `json:"summary,omitempty" yaml:"summary,omitempty"`
	DescriptionDiff   *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
	ValueDiff         *ValueDiff      `json:"value,omitempty" yaml:"value,omitempty"`
	ExternalValueDiff *ValueDiff      `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
}

ExampleDiff describes the changes between a pair of example objects: https://swagger.io/specification/#example-object

func (*ExampleDiff) Empty added in v0.3.6

func (diff *ExampleDiff) Empty() bool

Empty indicates whether a change was found in this element

type ExamplesDiff added in v0.3.6

type ExamplesDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedExamples `json:"modified,omitempty" yaml:"modified,omitempty"`
}

ExamplesDiff describes the changes between a pair of sets of example objects: https://swagger.io/specification/#example-object

func (*ExamplesDiff) Empty added in v0.3.6

func (diff *ExamplesDiff) Empty() bool

Empty indicates whether a change was found in this element

type ExtensionsDiff added in v0.1.20

type ExtensionsDiff InterfaceMapDiff

ExtensionsDiff describes the changes between a pair of sets of specification extensions: https://swagger.io/specification/#specification-extensions

func (*ExtensionsDiff) Empty added in v0.2.10

func (diff *ExtensionsDiff) Empty() bool

Empty indicates whether a change was found in this element

type ExternalDocsDiff added in v0.3.5

type ExternalDocsDiff struct {
	Added           bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted         bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff  *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	DescriptionDiff *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
	URLDiff         *ValueDiff      `json:"url,omitempty" yaml:"url,omitempty"`
}

ExternalDocsDiff describes the changes between a pair of external documentation objects: https://swagger.io/specification/#external-documentation-object

func (*ExternalDocsDiff) Empty added in v0.3.5

func (diff *ExternalDocsDiff) Empty() bool

Empty indicates whether a change was found in this element

type HeaderDiff added in v0.1.10

type HeaderDiff struct {
	ExtensionsDiff  *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	DescriptionDiff *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
	DeprecatedDiff  *ValueDiff      `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	RequiredDiff    *ValueDiff      `json:"required,omitempty" yaml:"required,omitempty"`
	ExampleDiff     *ValueDiff      `json:"example,omitempty" yaml:"example,omitempty"`
	ExamplesDiff    *ExamplesDiff   `json:"examples,omitempty" yaml:"examples,omitempty"`
	SchemaDiff      *SchemaDiff     `json:"schema,omitempty" yaml:"schema,omitempty"`
	ContentDiff     *ContentDiff    `json:"content,omitempty" yaml:"content,omitempty"`
}

HeaderDiff describes the changes between a pair of header objects: https://swagger.io/specification/#header-object

func (*HeaderDiff) Empty added in v0.2.10

func (headerDiff *HeaderDiff) Empty() bool

Empty indicates whether a change was found in this element

type HeadersDiff added in v0.1.10

type HeadersDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedHeaders  `json:"modified,omitempty" yaml:"modified,omitempty"`
}

HeadersDiff describes the changes between a pair of sets of header objects: https://swagger.io/specification/#header-object

func (*HeadersDiff) Empty added in v0.2.10

func (headersDiff *HeadersDiff) Empty() bool

Empty indicates whether a change was found in this element

type IDiff added in v0.5.4

type IDiff interface {
	Empty() bool
}

IDiff defines common operations for diff results

type InfoDiff added in v0.3.5

type InfoDiff struct {
	Added              bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted            bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff     *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	TitleDiff          *ValueDiff      `json:"title,omitempty" yaml:"title,omitempty"`
	DescriptionDiff    *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
	TermsOfServiceDiff *ValueDiff      `json:"termsOfService,omitempty" yaml:"termsOfService,omitempty"`
	ContactDiff        *ContactDiff    `json:"contact,omitempty" yaml:"contact,omitempty"`
	LicenseDiff        *LicenseDiff    `json:"license,omitempty" yaml:"license,omitempty"`
	VersionDiff        *ValueDiff      `json:"version,omitempty" yaml:"version,omitempty"`
}

InfoDiff describes the changes between a pair of info objects: https://swagger.io/specification/#info-object

func (*InfoDiff) Empty added in v0.3.5

func (diff *InfoDiff) Empty() bool

Empty indicates whether a change was found in this element

type InterfaceMap added in v0.4.2

type InterfaceMap map[string]interface{}

InterfaceMap is a map of string to interface

type InterfaceMapDiff added in v0.4.2

type InterfaceMapDiff struct {
	Added    utils.StringList   `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList   `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedInterfaces `json:"modified,omitempty" yaml:"modified,omitempty"`
}

InterfaceMapDiff describes the changes between a pair of InterfaceMap

func (*InterfaceMapDiff) Empty added in v0.4.2

func (diff *InterfaceMapDiff) Empty() bool

Empty indicates whether a change was found in this element

type LicenseDiff added in v0.3.5

type LicenseDiff struct {
	Added          bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted        bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	NameDiff       *ValueDiff      `json:"name,omitempty" yaml:"name,omitempty"`
	URLDiff        *ValueDiff      `json:"url,omitempty" yaml:"url,omitempty"`
}

LicenseDiff describes the changes between a pair of license objects: https://swagger.io/specification/#license-object

func (*LicenseDiff) Empty added in v0.3.5

func (diff *LicenseDiff) Empty() bool

Empty indicates whether a change was found in this element

type LinkDiff added in v0.4.2

type LinkDiff struct {
	ExtensionsDiff   *ExtensionsDiff   `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	OperationIDDiff  *ValueDiff        `json:"operationId,omitempty" yaml:"operationId,omitempty"`
	OperationRefDiff *ValueDiff        `json:"operationRef,omitempty" yaml:"operationRef,omitempty"`
	DescriptionDiff  *ValueDiff        `json:"description,omitempty" yaml:"description,omitempty"`
	ParametersDiff   *InterfaceMapDiff `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	ServerDiff       *ServerDiff       `json:"server,omitempty" yaml:"server,omitempty"`
	RequestBodyDiff  *ValueDiff        `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
}

LinkDiff describes the changes between a pair of link objects: https://swagger.io/specification/#link-object

func (*LinkDiff) Empty added in v0.4.2

func (diff *LinkDiff) Empty() bool

Empty indicates whether a change was found in this element

type LinksDiff added in v0.4.2

type LinksDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedLinks    `json:"modified,omitempty" yaml:"modified,omitempty"`
}

LinksDiff describes the changes between a pair of sets of link objects: https://swagger.io/specification/#link-object

func (*LinksDiff) Empty added in v0.4.2

func (diff *LinksDiff) Empty() bool

Empty indicates whether a change was found in this element

type MediaTypeDiff added in v1.0.6

type MediaTypeDiff struct {
	ExtensionsDiff *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	SchemaDiff     *SchemaDiff     `json:"schema,omitempty" yaml:"schema,omitempty"`
	ExampleDiff    *ValueDiff      `json:"example,omitempty" yaml:"example,omitempty"`
	ExamplesDiff   *ExamplesDiff   `json:"examples,omitempty" yaml:"examples,omitempty"`
	EncodingsDiff  *EncodingsDiff  `json:"encoding,omitempty" yaml:"encoding,omitempty"`
}

MediaTypeDiff describes the changes between a pair of media type objects

func (*MediaTypeDiff) Empty added in v1.0.6

func (diff *MediaTypeDiff) Empty() bool

Empty indicates whether a change was found in this element

type MethodDiff

type MethodDiff struct {
	ExtensionsDiff   *ExtensionsDiff           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	TagsDiff         *StringsDiff              `json:"tags,omitempty" yaml:"tags,omitempty"`
	SummaryDiff      *ValueDiff                `json:"summary,omitempty" yaml:"summary,omitempty"`
	DescriptionDiff  *ValueDiff                `json:"description,omitempty" yaml:"description,omitempty"`
	OperationIDDiff  *ValueDiff                `json:"operationID,omitempty" yaml:"operationID,omitempty"`
	ParametersDiff   *ParametersDiffByLocation `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	RequestBodyDiff  *RequestBodyDiff          `json:"requestBody,omitempty" yaml:"requestBody,omitempty"`
	ResponsesDiff    *ResponsesDiff            `json:"responses,omitempty" yaml:"responses,omitempty"`
	CallbacksDiff    *CallbacksDiff            `json:"callbacks,omitempty" yaml:"callbacks,omitempty"`
	DeprecatedDiff   *ValueDiff                `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	SecurityDiff     *SecurityRequirementsDiff `json:"securityRequirements,omitempty" yaml:"securityRequirements,omitempty"`
	ServersDiff      *ServersDiff              `json:"servers,omitempty" yaml:"servers,omitempty"`
	ExternalDocsDiff *ExternalDocsDiff         `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	Base             *openapi3.Operation       `json:"-" yaml:"-"`
	Revision         *openapi3.Operation       `json:"-" yaml:"-"`
}

MethodDiff describes the changes between a pair of operation objects: https://swagger.io/specification/#operation-object

func (*MethodDiff) Empty added in v0.2.10

func (methodDiff *MethodDiff) Empty() bool

Empty indicates whether a change was found in this element

func (*MethodDiff) Patch added in v0.4.0

func (methodDiff *MethodDiff) Patch(operation *openapi3.Operation) error

Patch applies the patch to a method

type ModifiedCallbacks added in v0.1.11

type ModifiedCallbacks map[string]*PathsDiff

ModifiedCallbacks is map of callback names to their respective diffs

type ModifiedEncodings added in v0.1.17

type ModifiedEncodings map[string]*EncodingDiff

ModifiedEncodings is map of enconding names to their respective diffs

type ModifiedEndpoints

type ModifiedEndpoints map[Endpoint]*MethodDiff

ModifiedEndpoints is a map of endpoints to their respective diffs

func (ModifiedEndpoints) ToEndpoints added in v0.5.3

func (modifiedEndpoints ModifiedEndpoints) ToEndpoints() Endpoints

ToEndpoints returns the modified endpoints

type ModifiedExamples added in v0.3.6

type ModifiedExamples map[string]*ExampleDiff

ModifiedExamples is map of enconding names to their respective diffs

type ModifiedHeaders added in v0.1.10

type ModifiedHeaders map[string]*HeaderDiff

ModifiedHeaders is map of header names to their respective diffs

type ModifiedInterfaces added in v0.4.2

type ModifiedInterfaces map[string]jsonPatch

ModifiedInterfaces is map of interface names to their respective diffs

func (ModifiedInterfaces) Empty added in v1.5.15

func (modifiedInterfaces ModifiedInterfaces) Empty() bool

Empty indicates whether a change was found in this element

type ModifiedKeys added in v0.2.7

type ModifiedKeys map[string]*ValueDiff

ModifiedKeys maps keys to their respective diffs

type ModifiedLinks map[string]*LinkDiff

ModifiedLinks is map of link values to their respective diffs

type ModifiedMediaTypes added in v1.0.6

type ModifiedMediaTypes map[string]*MediaTypeDiff

ModifiedMediaTypes is map of media type names to their respective diffs

type ModifiedOperations

type ModifiedOperations map[string]*MethodDiff

ModifiedOperations is a map of HTTP methods to their respective diffs

type ModifiedPaths added in v0.1.5

type ModifiedPaths map[string]*PathDiff

ModifiedPaths is a map of paths to their respective diffs

type ModifiedRequestBodies added in v0.1.17

type ModifiedRequestBodies map[string]*RequestBodyDiff

ModifiedRequestBodies is map of requestBody names to their respective diffs

type ModifiedResponses added in v0.1.5

type ModifiedResponses map[string]*ResponseDiff

ModifiedResponses is map of response values to their respective diffs

type ModifiedSchemasMap added in v1.10.14

type ModifiedSchemasMap map[string]*SchemaDiff

ModifiedSchemasMap is map of schema names to their respective diffs

type ModifiedSecurityRequirements added in v0.4.8

type ModifiedSecurityRequirements map[string]SecurityScopesDiff

ModifiedSecurityRequirements is map of security requirements to their respective diffs

type ModifiedSecuritySchemes added in v0.2.6

type ModifiedSecuritySchemes map[string]*SecuritySchemeDiff

ModifiedSecuritySchemes is map of security schemes to their respective diffs

type ModifiedServers added in v0.1.18

type ModifiedServers map[string]*ServerDiff

ModifiedServers is map of server names to their respective diffs

type ModifiedSubschema added in v1.10.14

type ModifiedSubschema struct {
	Base     Subschema   `json:"base" yaml:"base"`
	Revision Subschema   `json:"revision" yaml:"revision"`
	Diff     *SchemaDiff `json:"diff" yaml:"diff"`
}

ModifiedSubschema represents a modified subschema with its indentifiers in base and revision, and the schema diff

func (*ModifiedSubschema) String added in v1.10.14

func (modifiedSchema *ModifiedSubschema) String() string

String returns a string representation of the modified subschema

type ModifiedSubschemas added in v1.10.14

type ModifiedSubschemas []*ModifiedSubschema

ModifiedSubschemas is list of modified subschemas with their diffs Unlike other Modiefied types which are modeled as maps, this one is modeled as a slice to avoid complex mapping keys

type ModifiedTags added in v0.1.11

type ModifiedTags map[string]*TagDiff

ModifiedTags is map of tag names to their respective diffs

type ModifiedVariables added in v0.5.1

type ModifiedVariables map[string]*VariableDiff

ModifiedVariables is map of variable names to their respective diffs

type OAuthFlowDiff added in v0.2.6

type OAuthFlowDiff struct {
	Added                bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted              bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff       *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	AuthorizationURLDiff *ValueDiff      `json:"authorizationURL,omitempty" yaml:"authorizationURL,omitempty"`
	TokenURLDiff         *ValueDiff      `json:"tokenURL,omitempty" yaml:"tokenURL,omitempty"`
	RefreshURLDiff       *ValueDiff      `json:"refresh,omitempty" yaml:"refresh,omitempty"`
	ScopesDiff           *StringMapDiff  `json:"scopes,omitempty" yaml:"scopes,omitempty"`
}

OAuthFlowDiff describes the changes between a pair of oauth flow objects: https://swagger.io/specification/#oauth-flow-object

func (*OAuthFlowDiff) Empty added in v0.2.10

func (diff *OAuthFlowDiff) Empty() bool

Empty indicates whether a change was found in this element

type OAuthFlowsDiff added in v0.2.6

type OAuthFlowsDiff struct {
	Added                 bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted               bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff        *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	ImplicitDiff          *OAuthFlowDiff  `json:"implicit,omitempty" yaml:"implicit,omitempty"`
	PasswordDiff          *OAuthFlowDiff  `json:"password,omitempty" yaml:"password,omitempty"`
	ClientCredentialsDiff *OAuthFlowDiff  `json:"clientCredentials,omitempty" yaml:"clientCredentials,omitempty"`
	AuthorizationCodeDiff *OAuthFlowDiff  `json:"authorizationCode,omitempty" yaml:"authorizationCode,omitempty"`
}

OAuthFlowsDiff describes the changes between a pair of oauth flows objects: https://swagger.io/specification/#oauth-flows-object

func (*OAuthFlowsDiff) Empty added in v0.2.10

func (diff *OAuthFlowsDiff) Empty() bool

Empty indicates whether a change was found in this element

type OperationsDiff added in v0.1.17

type OperationsDiff struct {
	Added    utils.StringList   `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList   `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedOperations `json:"modified,omitempty" yaml:"modified,omitempty"`
}

OperationsDiff describes the changes between a pair of operation objects (https://swagger.io/specification/#operation-object) of two path item objects

func (*OperationsDiff) Empty added in v0.2.10

func (operationsDiff *OperationsDiff) Empty() bool

Empty indicates whether a change was found in this element

func (*OperationsDiff) Patch added in v0.4.0

func (operationsDiff *OperationsDiff) Patch(operations map[string]*openapi3.Operation) error

Patch applies the patch to operations

type OperationsSourcesMap added in v1.3.0

type OperationsSourcesMap map[*openapi3.Operation]string

type ParamDiffByLocation added in v0.1.4

type ParamDiffByLocation map[string]ParamDiffs

ParamDiffByLocation maps param location (path, query, header or cookie) to param diffs in this location

func (ParamDiffByLocation) Len added in v1.10.6

func (params ParamDiffByLocation) Len() int

Len returns the number of all params in all locations

type ParamDiffs

type ParamDiffs map[string]*ParameterDiff

ParamDiffs is map of parameter names to their respective diffs

type ParamNamesByLocation added in v0.1.4

type ParamNamesByLocation map[string]utils.StringList

ParamNamesByLocation maps param location (path, query, header or cookie) to the params in this location

func (ParamNamesByLocation) Len added in v1.10.6

func (params ParamNamesByLocation) Len() int

Len returns the number of all params in all locations

type ParameterDiff added in v0.1.5

type ParameterDiff struct {
	NameDiff            *ValueDiff          `json:"name,omitempty" yaml:"name,omitempty"`
	InDiff              *ValueDiff          `json:"in,omitempty" yaml:"in,omitempty"`
	ExtensionsDiff      *ExtensionsDiff     `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	DescriptionDiff     *ValueDiff          `json:"description,omitempty" yaml:"description,omitempty"`
	StyleDiff           *ValueDiff          `json:"style,omitempty" yaml:"style,omitempty"`
	ExplodeDiff         *ValueDiff          `json:"explode,omitempty" yaml:"explode,omitempty"`
	AllowEmptyValueDiff *ValueDiff          `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	AllowReservedDiff   *ValueDiff          `json:"allowReserved,omitempty" yaml:"allowReserved,omitempty"`
	DeprecatedDiff      *ValueDiff          `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	RequiredDiff        *ValueDiff          `json:"required,omitempty" yaml:"required,omitempty"`
	SchemaDiff          *SchemaDiff         `json:"schema,omitempty" yaml:"schema,omitempty"`
	ExampleDiff         *ValueDiff          `json:"example,omitempty" yaml:"example,omitempty"`
	ExamplesDiff        *ExamplesDiff       `json:"examples,omitempty" yaml:"examples,omitempty"`
	ContentDiff         *ContentDiff        `json:"content,omitempty" yaml:"content,omitempty"`
	Base                *openapi3.Parameter `json:"-" yaml:"-"`
	Revision            *openapi3.Parameter `json:"-" yaml:"-"`
}

ParameterDiff describes the changes between a pair of parameter objects: https://swagger.io/specification/#parameter-object

func (*ParameterDiff) Empty added in v0.2.10

func (diff *ParameterDiff) Empty() bool

Empty indicates whether a change was found in this element

func (*ParameterDiff) Patch added in v0.4.0

func (diff *ParameterDiff) Patch(parameter *openapi3.Parameter) error

Patch applies the patch to a parameter

type ParametersDiff added in v0.1.5

type ParametersDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ParamDiffs       `json:"modified,omitempty" yaml:"modified,omitempty"`
}

ParametersDiff describes the changes between a pair of lists of parameter objects: https://swagger.io/specification/#parameter-object

func (*ParametersDiff) Empty added in v0.2.10

func (diff *ParametersDiff) Empty() bool

Empty indicates whether a change was found in this element

type ParametersDiffByLocation added in v1.7.2

type ParametersDiffByLocation struct {
	Added    ParamNamesByLocation `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  ParamNamesByLocation `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ParamDiffByLocation  `json:"modified,omitempty" yaml:"modified,omitempty"`
}

ParametersDiffByLocation describes the changes, grouped by param location, between a pair of lists of parameter objects: https://swagger.io/specification/#parameter-object

func (*ParametersDiffByLocation) Empty added in v1.7.2

func (diff *ParametersDiffByLocation) Empty() bool

Empty indicates whether a change was found in this element

func (*ParametersDiffByLocation) Patch added in v1.7.2

func (diff *ParametersDiffByLocation) Patch(parameters openapi3.Parameters) error

Patch applies the patch to parameters

type PathDiff

type PathDiff struct {
	ExtensionsDiff  *ExtensionsDiff           `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	RefDiff         *ValueDiff                `json:"ref,omitempty" yaml:"ref,omitempty"`
	SummaryDiff     *ValueDiff                `json:"summary,omitempty" yaml:"summary,omitempty"`
	DescriptionDiff *ValueDiff                `json:"description,omitempty" yaml:"description,omitempty"`
	OperationsDiff  *OperationsDiff           `json:"operations,omitempty" yaml:"operations,omitempty"`
	ServersDiff     *ServersDiff              `json:"servers,omitempty" yaml:"servers,omitempty"`
	ParametersDiff  *ParametersDiffByLocation `json:"parameters,omitempty" yaml:"parameters,omitempty"`
	Base            *openapi3.PathItem        `json:"-" yaml:"-"`
	Revision        *openapi3.PathItem        `json:"-" yaml:"-"`
}

PathDiff describes the changes between a pair of path item objects: https://swagger.io/specification/#path-item-object

func (*PathDiff) Empty added in v0.2.10

func (pathDiff *PathDiff) Empty() bool

Empty indicates whether a change was found in this element

func (*PathDiff) Patch added in v0.4.0

func (pathDiff *PathDiff) Patch(pathItem *openapi3.PathItem) error

Patch applies the patch to a path item

type PathParamsMap added in v1.3.19

type PathParamsMap utils.StringMap

PathParamsMap handles path param renaming for example: person/{personName} -> /person/{name} in such cases, PathParamsMap stores the param mapping: personName -> name

func NewPathParamsMap added in v1.3.19

func NewPathParamsMap(pathParams1, pathParams2 []string) (PathParamsMap, bool)

func (PathParamsMap) Inverse added in v1.3.19

func (pathParamsMap PathParamsMap) Inverse() PathParamsMap

type PathsDiff added in v0.1.5

type PathsDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedPaths    `json:"modified,omitempty" yaml:"modified,omitempty"`
	Base     *openapi3.Paths  `json:"-" yaml:"-"`
	Revision *openapi3.Paths  `json:"-" yaml:"-"`
}

PathsDiff describes the changes between a pair of Paths objects: https://swagger.io/specification/#paths-object

func (*PathsDiff) Empty added in v0.2.10

func (pathsDiff *PathsDiff) Empty() bool

Empty indicates whether a change was found in this element

func (*PathsDiff) Patch added in v0.4.0

func (pathsDiff *PathsDiff) Patch(paths *openapi3.Paths) error

Patch applies the patch to paths

type RequestBodiesDiff added in v0.1.14

type RequestBodiesDiff struct {
	Added    utils.StringList      `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList      `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedRequestBodies `json:"modified,omitempty" yaml:"modified,omitempty"`
}

RequestBodiesDiff describes the changes between a pair of sets of request body objects: https://swagger.io/specification/#request-body-object

func (*RequestBodiesDiff) Empty added in v0.2.10

func (requestBodiesDiff *RequestBodiesDiff) Empty() bool

Empty indicates whether a change was found in this element

type RequestBodyDiff added in v0.1.14

type RequestBodyDiff struct {
	Added           bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted         bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff  *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	DescriptionDiff *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
	RequiredDiff    *ValueDiff      `json:"required,omitempty" yaml:"required,omitempty"`
	ContentDiff     *ContentDiff    `json:"content,omitempty" yaml:"content,omitempty"`
}

RequestBodyDiff describes the changes between a pair of request body objects: https://swagger.io/specification/#request-body-object

func (*RequestBodyDiff) Empty added in v0.2.10

func (diff *RequestBodyDiff) Empty() bool

Empty indicates whether a change was found in this element

type RequiredPropertiesDiff added in v1.1.3

type RequiredPropertiesDiff struct {
	StringsDiff
}

RequiredPropertiesDiff describes the changes between a pair of lists of required properties

func (*RequiredPropertiesDiff) Empty added in v1.1.3

func (diff *RequiredPropertiesDiff) Empty() bool

Empty indicates whether a change was found in this element

type ResponseDiff added in v0.1.5

type ResponseDiff struct {
	ExtensionsDiff  *ExtensionsDiff    `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	DescriptionDiff *ValueDiff         `json:"description,omitempty" yaml:"description,omitempty"`
	HeadersDiff     *HeadersDiff       `json:"headers,omitempty" yaml:"headers,omitempty"`
	ContentDiff     *ContentDiff       `json:"content,omitempty" yaml:"content,omitempty"`
	LinksDiff       *LinksDiff         `json:"links,omitempty" yaml:"links,omitempty"`
	Base            *openapi3.Response `json:"-" yaml:"-"`
	Revision        *openapi3.Response `json:"-" yaml:"-"`
}

ResponseDiff describes the changes between a pair of response objects: https://swagger.io/specification/#response-object

func (*ResponseDiff) Empty added in v0.2.10

func (diff *ResponseDiff) Empty() bool

Empty indicates whether a change was found in this element

type ResponsesDiff added in v0.1.5

type ResponsesDiff struct {
	Added    utils.StringList  `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList  `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedResponses `json:"modified,omitempty" yaml:"modified,omitempty"`
}

ResponsesDiff describes the changes between a pair of sets of response objects: https://swagger.io/specification/#responses-object

func (*ResponsesDiff) Empty added in v0.2.10

func (responsesDiff *ResponsesDiff) Empty() bool

Empty indicates whether a change was found in this element

type SchemaDiff

type SchemaDiff struct {
	SchemaAdded                     bool                    `json:"schemaAdded,omitempty" yaml:"schemaAdded,omitempty"`
	SchemaDeleted                   bool                    `json:"schemaDeleted,omitempty" yaml:"schemaDeleted,omitempty"`
	CircularRefDiff                 bool                    `json:"circularRef,omitempty" yaml:"circularRef,omitempty"`
	ExtensionsDiff                  *ExtensionsDiff         `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	OneOfDiff                       *SubschemasDiff         `json:"oneOf,omitempty" yaml:"oneOf,omitempty"`
	AnyOfDiff                       *SubschemasDiff         `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
	AllOfDiff                       *SubschemasDiff         `json:"allOf,omitempty" yaml:"allOf,omitempty"`
	NotDiff                         *SchemaDiff             `json:"not,omitempty" yaml:"not,omitempty"`
	TypeDiff                        *StringsDiff            `json:"type,omitempty" yaml:"type,omitempty"`
	TitleDiff                       *ValueDiff              `json:"title,omitempty" yaml:"title,omitempty"`
	FormatDiff                      *ValueDiff              `json:"format,omitempty" yaml:"format,omitempty"`
	DescriptionDiff                 *ValueDiff              `json:"description,omitempty" yaml:"description,omitempty"`
	EnumDiff                        *EnumDiff               `json:"enum,omitempty" yaml:"enum,omitempty"`
	DefaultDiff                     *ValueDiff              `json:"default,omitempty" yaml:"default,omitempty"`
	ExampleDiff                     *ValueDiff              `json:"example,omitempty" yaml:"example,omitempty"`
	ExternalDocsDiff                *ExternalDocsDiff       `json:"externalDocs,omitempty" yaml:"externalDocs,omitempty"`
	AdditionalPropertiesAllowedDiff *ValueDiff              `json:"additionalPropertiesAllowed,omitempty" yaml:"additionalPropertiesAllowed,omitempty"`
	UniqueItemsDiff                 *ValueDiff              `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"`
	ExclusiveMinDiff                *ValueDiff              `json:"exclusiveMin,omitempty" yaml:"exclusiveMin,omitempty"`
	ExclusiveMaxDiff                *ValueDiff              `json:"exclusiveMax,omitempty" yaml:"exclusiveMax,omitempty"`
	NullableDiff                    *ValueDiff              `json:"nullable,omitempty" yaml:"nullable,omitempty"`
	ReadOnlyDiff                    *ValueDiff              `json:"readOnly,omitempty" yaml:"readOnly,omitempty"`
	WriteOnlyDiff                   *ValueDiff              `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"`
	AllowEmptyValueDiff             *ValueDiff              `json:"allowEmptyValue,omitempty" yaml:"allowEmptyValue,omitempty"`
	XMLDiff                         *ValueDiff              `json:"XML,omitempty" yaml:"XML,omitempty"`
	DeprecatedDiff                  *ValueDiff              `json:"deprecated,omitempty" yaml:"deprecated,omitempty"`
	MinDiff                         *ValueDiff              `json:"min,omitempty" yaml:"min,omitempty"`
	MaxDiff                         *ValueDiff              `json:"max,omitempty" yaml:"max,omitempty"`
	MultipleOfDiff                  *ValueDiff              `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"`
	MinLengthDiff                   *ValueDiff              `json:"minLength,omitempty" yaml:"minLength,omitempty"`
	MaxLengthDiff                   *ValueDiff              `json:"maxLength,omitempty" yaml:"maxLength,omitempty"`
	PatternDiff                     *ValueDiff              `json:"pattern,omitempty" yaml:"pattern,omitempty"`
	MinItemsDiff                    *ValueDiff              `json:"minItems,omitempty" yaml:"minItems,omitempty"`
	MaxItemsDiff                    *ValueDiff              `json:"maxItems,omitempty" yaml:"maxItems,omitempty"`
	ItemsDiff                       *SchemaDiff             `json:"items,omitempty" yaml:"items,omitempty"`
	RequiredDiff                    *RequiredPropertiesDiff `json:"required,omitempty" yaml:"required,omitempty"`
	PropertiesDiff                  *SchemasDiff            `json:"properties,omitempty" yaml:"properties,omitempty"`
	MinPropsDiff                    *ValueDiff              `json:"minProps,omitempty" yaml:"minProps,omitempty"`
	MaxPropsDiff                    *ValueDiff              `json:"maxProps,omitempty" yaml:"maxProps,omitempty"`
	AdditionalPropertiesDiff        *SchemaDiff             `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"`
	DiscriminatorDiff               *DiscriminatorDiff      `json:"discriminatorDiff,omitempty" yaml:"discriminatorDiff,omitempty"`
	Base                            *openapi3.Schema        `json:"-" yaml:"-"`
	Revision                        *openapi3.Schema        `json:"-" yaml:"-"`
}

SchemaDiff describes the changes between a pair of schema objects: https://swagger.io/specification/#schema-object

func (*SchemaDiff) Empty added in v0.2.10

func (diff *SchemaDiff) Empty() bool

Empty indicates whether a change was found in this element

func (*SchemaDiff) Patch added in v0.4.0

func (diff *SchemaDiff) Patch(schema *openapi3.Schema) error

Patch applies the patch to a schema

type SchemasDiff added in v0.1.5

type SchemasDiff struct {
	Added    utils.StringList   `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList   `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedSchemasMap `json:"modified,omitempty" yaml:"modified,omitempty"`
	Base     openapi3.Schemas   `json:"-" yaml:"-"`
	Revision openapi3.Schemas   `json:"-" yaml:"-"`
}

SchemasDiff describes the changes between a pair of maps of schema objects like the components.schemas object

func (*SchemasDiff) Empty added in v0.2.10

func (schemasDiff *SchemasDiff) Empty() bool

Empty indicates whether a change was found in this element

type SecurityRequirementsDiff added in v0.2.9

type SecurityRequirementsDiff struct {
	Added    utils.StringList             `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList             `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedSecurityRequirements `json:"modified,omitempty" yaml:"modified,omitempty"`
}

SecurityRequirementsDiff describes the changes between a pair of sets of security requirement objects: https://swagger.io/specification/#security-requirement-object

func (*SecurityRequirementsDiff) Empty added in v0.2.10

func (diff *SecurityRequirementsDiff) Empty() bool

Empty indicates whether a change was found in this element

type SecuritySchemeDiff added in v0.2.6

type SecuritySchemeDiff struct {
	ExtensionsDiff       *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	TypeDiff             *ValueDiff      `json:"type,omitempty" yaml:"type,omitempty"`
	DescriptionDiff      *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
	NameDiff             *ValueDiff      `json:"name,omitempty" yaml:"name,omitempty"`
	InDiff               *ValueDiff      `json:"in,omitempty" yaml:"in,omitempty"`
	SchemeDiff           *ValueDiff      `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	BearerFormatDiff     *ValueDiff      `json:"bearerFormat,omitempty" yaml:"bearerFormat,omitempty"`
	OAuthFlowsDiff       *OAuthFlowsDiff `json:"OAuthFlows,omitempty" yaml:"OAuthFlows,omitempty"`
	OpenIDConnectURLDiff *ValueDiff      `json:"openIDConnectURL,omitempty" yaml:"openIDConnectURL,omitempty"`
}

SecuritySchemeDiff describes the changes between a pair of security scheme objects: https://swagger.io/specification/#security-scheme-object

func (*SecuritySchemeDiff) Empty added in v0.2.10

func (diff *SecuritySchemeDiff) Empty() bool

Empty indicates whether a change was found in this element

type SecuritySchemesDiff added in v0.2.6

type SecuritySchemesDiff struct {
	Added    utils.StringList        `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList        `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedSecuritySchemes `json:"modified,omitempty" yaml:"modified,omitempty"`
}

SecuritySchemesDiff describes the changes between a pair of sets of security scheme objects: https://swagger.io/specification/#security-scheme-object

func (*SecuritySchemesDiff) Empty added in v0.2.10

func (diff *SecuritySchemesDiff) Empty() bool

Empty indicates whether a change was found in this element

type SecurityScopesDiff added in v0.4.8

type SecurityScopesDiff map[string]*StringsDiff

SecurityScopesDiff is a map of security schemes to their respective scope diffs

func (SecurityScopesDiff) Empty added in v1.2.9

func (diff SecurityScopesDiff) Empty() bool

Empty indicates whether a change was found in this element

type ServerDiff added in v0.1.18

type ServerDiff struct {
	Added           bool            `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted         bool            `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	ExtensionsDiff  *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	URLDiff         *ValueDiff      `json:"urlType,omitempty" yaml:"urlType,omitempty"`
	DescriptionDiff *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
	VariablesDiff   *VariablesDiff  `json:"variables,omitempty" yaml:"variables,omitempty"`
}

ServerDiff describes the changes between a pair of server objects: https://swagger.io/specification/#server-object

func (*ServerDiff) Empty added in v0.2.10

func (diff *ServerDiff) Empty() bool

Empty indicates whether a change was found in this element

type ServersDiff added in v0.1.18

type ServersDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedServers  `json:"modified,omitempty" yaml:"modified,omitempty"`
}

ServersDiff describes the changes between a pair of sets of encoding objects: https://swagger.io/specification/#server-object

func (*ServersDiff) Empty added in v0.2.10

func (diff *ServersDiff) Empty() bool

Empty indicates whether a change was found in this element

type StringMapDiff added in v0.2.7

type StringMapDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedKeys     `json:"modified,omitempty" yaml:"modified,omitempty"`
}

StringMapDiff describes the changes between a pair of string maps

func (*StringMapDiff) Empty added in v0.2.10

func (diff *StringMapDiff) Empty() bool

Empty indicates whether a change was found in this element

type StringsDiff added in v0.1.11

type StringsDiff struct {
	Added   utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
}

StringsDiff describes the changes between a pair of lists of strings

func (*StringsDiff) Empty added in v0.2.10

func (stringsDiff *StringsDiff) Empty() bool

Empty indicates whether a change was found in this element

type Subschema added in v1.10.14

type Subschema struct {
	Index     int    `json:"index" yaml:"index"`                             // zero-based index in the schema's subschemas
	Component string `json:"component,omitempty" yaml:"component,omitempty"` // component name if the subschema is a reference to components/schemas
	Title     string `json:"title,omitempty" yaml:"title,omitempty"`         // title of the subschema
}

Subschema uniquely identifies a subschema by its index, component and title

func (Subschema) String added in v1.10.14

func (subschema Subschema) String() string

String returns a string representation of the subschema Note that we convert the index to 1-based index

type Subschemas added in v1.10.14

type Subschemas []Subschema

Subschemas is a list of subschemas

func (Subschemas) String added in v1.10.14

func (schemas Subschemas) String() string

String returns a string representation of the subschemas

type SubschemasDiff added in v1.10.14

type SubschemasDiff struct {
	Added    Subschemas         `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  Subschemas         `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedSubschemas `json:"modified,omitempty" yaml:"modified,omitempty"`
}

SubschemasDiff describes the changes between a pair of subschemas under AllOf, AnyOf or OneOf [oneOf, anyOf, allOf]: https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/ [Schema Objects]: https://swagger.io/specification/#schema-object SubschemasDiff is a combination of two diffs:

  1. Diff of referenced schemas: subschemas under AllOf, AnyOf or OneOf defined as references to schemas under components/schemas - schemas with the same $ref across base and revision are compared to each other and based on the result are considered as modified or unmodified - other schemas are considered added/deleted

  2. Diff of inline schemas: subschemas defined directly under AllOf, AnyOf or OneOf, without a reference to components/schemas Unlike referenced schemas, inline schemas cannot be matched by a unique name and are therefor compared by their content. - syntactically identical schemas across base and revision are considered unmodified - schemas with the same title across base and revision are compared to each other and based on the result are considered as modified or unmodified - other schemas are considered added/deleted

Special case: If there remains exactly one added schema and one deleted schema without a reference and without a title, they will be be compared to eachother and considered as modified or unmodified

func NewSubschemasDiff added in v1.10.14

func NewSubschemasDiff() *SubschemasDiff

NewSubschemasDiff creates a new SubschemasDiff

func (*SubschemasDiff) Empty added in v1.10.14

func (diff *SubschemasDiff) Empty() bool

Empty indicates whether a change was found in this element

type Summary added in v0.0.9

type Summary struct {
	Diff    bool                           `json:"diff" yaml:"diff"`
	Details map[DetailName]*SummaryDetails `json:"details,omitempty" yaml:"details,omitempty"`
}

Summary summarizes the changes between a pair of OpenAPI specifications

func (*Summary) GetSummaryDetails added in v0.1.13

func (summary *Summary) GetSummaryDetails(name DetailName) SummaryDetails

GetSummaryDetails returns the summary for a specific part

type SummaryDetails added in v0.1.8

type SummaryDetails struct {
	Added    int `json:"added,omitempty" yaml:"added,omitempty"`       // number of added items
	Deleted  int `json:"deleted,omitempty" yaml:"deleted,omitempty"`   // number of deleted items
	Modified int `json:"modified,omitempty" yaml:"modified,omitempty"` // number of modified items
}

SummaryDetails summarizes the changes between equivalent parts of the two OpenAPI specifications: paths, schemas, parameters, headers, responses etc.

type TagDiff added in v0.1.11

type TagDiff struct {
	NameDiff        *ValueDiff `json:"name,omitempty" yaml:"name,omitempty"`
	DescriptionDiff *ValueDiff `json:"description,omitempty" yaml:"description,omitempty"`
}

TagDiff describes the changes between a pair of tag objects: https://swagger.io/specification/#tag-object

func (*TagDiff) Empty added in v0.2.10

func (diff *TagDiff) Empty() bool

Empty indicates whether a change was found in this element

type TagsDiff added in v0.1.11

type TagsDiff struct {
	Added    utils.StringList `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedTags     `json:"modified,omitempty" yaml:"modified,omitempty"`
}

TagsDiff describes the changes between a pair of lists of tag objects: https://swagger.io/specification/#tag-object

func (*TagsDiff) Empty added in v0.2.10

func (tagsDiff *TagsDiff) Empty() bool

Empty indicates whether a change was found in this element

type ValueDiff

type ValueDiff struct {
	From interface{} `json:"from" yaml:"from"`
	To   interface{} `json:"to" yaml:"to"`
}

ValueDiff describes the changes between a pair of values

func (*ValueDiff) Empty added in v0.2.10

func (diff *ValueDiff) Empty() bool

Empty indicates whether a change was found in this element

type VariableDiff added in v0.5.1

type VariableDiff struct {
	ExtensionsDiff  *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
	EnumDiff        *StringsDiff    `json:"enum,omitempty" yaml:"enum,omitempty"`
	DefaultDiff     *ValueDiff      `json:"default,omitempty" yaml:"default,omitempty"`
	DescriptionDiff *ValueDiff      `json:"description,omitempty" yaml:"description,omitempty"`
}

VariableDiff describes the changes between a pair of server variable objects: https://swagger.io/specification/#server-variable-object

func (*VariableDiff) Empty added in v0.5.1

func (diff *VariableDiff) Empty() bool

Empty indicates whether a change was found in this element

type VariablesDiff added in v0.5.1

type VariablesDiff struct {
	Added    utils.StringList  `json:"added,omitempty" yaml:"added,omitempty"`
	Deleted  utils.StringList  `json:"deleted,omitempty" yaml:"deleted,omitempty"`
	Modified ModifiedVariables `json:"modified,omitempty" yaml:"modified,omitempty"`
}

VariablesDiff describes the changes between a pair of sets of server variable objects: https://swagger.io/specification/#server-variable-object

func (*VariablesDiff) Empty added in v0.5.1

func (diff *VariablesDiff) Empty() bool

Empty indicates whether a change was found in this element

Jump to

Keyboard shortcuts

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