Documentation
¶
Overview ¶
Package diff calculates the difference between two OpenAPI specifications.
Overview ¶
The diff package compares OpenAPI 3.x specifications and produces a structured diff report describing all changes. It supports OpenAPI 3.0 and 3.1, including JSON Schema 2020-12 keywords.
Usage ¶
The main entry points are Get and GetWithOperationsSourcesMap:
config := diff.NewConfig() diffReport, err := diff.Get(config, spec1, spec2) // Or with operation source tracking for better error messages: diffReport, operationsSources, err := diff.GetWithOperationsSourcesMap(config, specInfo1, specInfo2)
Configuration ¶
Config controls diff behavior:
- MatchPath/UnmatchPath: filter paths by regex pattern
- FilterExtension: filter by x- extension presence
- PathPrefixBase/PathPrefixRevision: add prefix to paths before comparison
- PathStripPrefixBase/PathStripPrefixRevision: strip prefix from paths before comparison
- ExcludeElements: skip comparing certain elements (examples, description, title, summary, extensions, endpoints)
- ExcludeExtensions: skip specific x- extensions
- IncludePathParams: include path parameter names in endpoint identity
Diff Structure ¶
The Diff type contains nested diff objects for each OpenAPI component:
- PathsDiff: changes to path items and operations
- WebhooksDiff: changes to webhooks (OpenAPI 3.1)
- ComponentsDiff: changes to reusable components (schemas, parameters, responses, etc.)
- InfoDiff, SecurityDiff, ServersDiff, TagsDiff: other top-level changes
Each diff type follows a consistent pattern with Added, Deleted, and Modified fields. Modified entries contain detailed nested diffs showing exactly what changed.
Schema Diffing ¶
SchemaDiff handles JSON Schema comparison including:
- Type changes, format, pattern, enum values
- Numeric constraints (min, max, multipleOf)
- String constraints (minLength, maxLength)
- Array constraints (minItems, maxItems, uniqueItems)
- Object constraints (required, properties, additionalProperties)
- Composition (allOf, oneOf, anyOf, not)
- JSON Schema 2020-12: $defs, if/then/else, dependentSchemas, prefixItems, contains, etc.
References ¶
OpenAPI $ref references should be resolved before diffing. The load package resolves refs automatically. For manually loaded specs, use openapi3.Loader.ResolveRefsIn.
Index ¶
- Constants
- Variables
- func GetExcludeDiffOptions() []string
- func GetPathsDiff(config *Config, s1, s2 []*load.SpecInfo) (*Diff, *OperationsSourcesMap, error)
- func GetWithOperationsSourcesMap(config *Config, s1, s2 *load.SpecInfo) (*Diff, *OperationsSourcesMap, error)
- func IsMediaTypeNameContained(mediaType1, mediaType2 string) bool
- func PrefixItemsValidationEquivalent(config *Config, base, revision *openapi3.Schema) bool
- func SchemaRefsValidationEquivalent(config *Config, schemaRef1, schemaRef2 *openapi3.SchemaRef) bool
- type CallbacksDiff
- type ComponentsDiff
- type Config
- func (config *Config) IsExcludeDescription() bool
- func (config *Config) IsExcludeEndpoints() bool
- func (config *Config) IsExcludeExamples() bool
- func (config *Config) IsExcludeExtensions() bool
- func (config *Config) IsExcludeSummary() bool
- func (config *Config) IsExcludeTitle() bool
- func (config *Config) IsExcludedExtension(name string) bool
- type ContactDiff
- type ContentDiff
- type DependentRequiredDiff
- type DetailName
- type Diff
- type DiscriminatorDiff
- type EncodingDiff
- type EncodingsDiff
- type Endpoint
- type Endpoints
- type EndpointsDiff
- type EnumDiff
- type EnumValues
- type ExampleDiff
- type ExamplesDiff
- type ExtensionsDiff
- type ExternalDocsDiff
- type HeaderDiff
- type HeadersDiff
- type IDiff
- type InfoDiff
- type InterfaceMap
- type InterfaceMapDiff
- type JsonOperation
- type JsonPatch
- type LicenseDiff
- type LinkDiff
- type LinksDiff
- type ListOfTypesDiff
- type MediaTypeDiff
- type MediaTypeName
- type MediaTypeNameDiff
- type MethodDiff
- type ModifiedCallbacks
- type ModifiedEncodings
- type ModifiedEndpoints
- type ModifiedExamples
- type ModifiedHeaders
- type ModifiedInterfaces
- type ModifiedKeys
- type ModifiedLinks
- type ModifiedMediaTypes
- type ModifiedOperations
- type ModifiedPaths
- type ModifiedRequestBodies
- type ModifiedResponses
- type ModifiedSchemasMap
- type ModifiedSecurityRequirement
- type ModifiedSecurityRequirements
- type ModifiedSecuritySchemes
- type ModifiedServers
- type ModifiedSubschema
- type ModifiedSubschemas
- type ModifiedTags
- type ModifiedVariables
- type ModifiedWebhooks
- type NullableWrappingDiff
- type OAuthFlowDiff
- type OAuthFlowsDiff
- type OneOfWrappingDiff
- type OperationsDiff
- type OperationsSourcesMap
- type Option
- type ParamDiffByLocation
- type ParamDiffs
- type ParamNamesByLocation
- type ParameterDiff
- type ParametersDiff
- type ParametersDiffByLocation
- type PathDiff
- type PathParamsMap
- type PathsDiff
- type RequestBodiesDiff
- type RequestBodyDiff
- type RequiredPropertiesDiff
- type ResponseDiff
- type ResponsesDiff
- type SchemaDiff
- type SchemasDiff
- type SecurityAlternative
- type SecurityAlternatives
- type SecurityRequirementsDiff
- type SecuritySchemeDiff
- type SecuritySchemesDiff
- type SecurityScopesDiff
- type ServerDiff
- type ServersDiff
- type StringMapDiff
- type StringsDiff
- type Subschema
- type Subschemas
- type SubschemasDiff
- type Summary
- type SummaryDetails
- type TagDiff
- type TagsDiff
- type ValueDiff
- type VariableDiff
- type VariablesDiff
- type WebhooksDiff
Examples ¶
Constants ¶
const ( ExcludeExamplesOption = "examples" ExcludeDescriptionOption = "description" ExcludeEndpointsOption = "endpoints" ExcludeTitleOption = "title" ExcludeSummaryOption = "summary" ExcludeExtensionsOption = "extensions" )
const ( SunsetExtension = "x-sunset" XStabilityLevelExtension = "x-stability-level" XExtensibleEnumExtension = "x-extensible-enum" )
const SinceDateExtension = "x-since-date"
Variables ¶
var (
DefaultSinceDate = civil.Date{Year: 2000, Month: 1, Day: 1}
)
var ParamLocations = []string{openapi3.ParameterInPath, openapi3.ParameterInQuery, openapi3.ParameterInHeader, openapi3.ParameterInCookie}
ParamLocations are the four possible locations of parameters: path, query, header or cookie
Functions ¶
func GetExcludeDiffOptions ¶
func GetExcludeDiffOptions() []string
func GetPathsDiff ¶
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.
func GetWithOperationsSourcesMap ¶
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.
func IsMediaTypeNameContained ¶ added in v1.11.4
IsMediaTypeNameContained checks if mediaType2 is a specialization of mediaType1. For example: - "application/xml" contains "application/atom+xml" (base type contains suffixed type) - "application/json" contains "application/problem+json" (base type contains suffixed type) - "application/xml;q=0.9" contains "application/xml;q=0.8" (parameter values are ignored)
func PrefixItemsValidationEquivalent ¶ added in v1.30.0
PrefixItemsValidationEquivalent reports whether two schemas validate every array position covered by prefixItems against the same contract. A position past the end of prefixItems is governed by items, so adding or removing an entry leaves the accepted arrays unchanged when the entry and the items schema it stands in for have the same contract.
func SchemaRefsValidationEquivalent ¶ added in v1.17.0
func SchemaRefsValidationEquivalent(config *Config, schemaRef1, schemaRef2 *openapi3.SchemaRef) bool
SchemaRefsValidationEquivalent reports whether two resolved schema refs have the same validation contract according to oasdiff's schema diff model. Annotation-only changes such as title, description, examples, default, and comments are ignored; checker-significant metadata such as deprecated is treated as a contract change.
Types ¶
type CallbacksDiff ¶
type CallbacksDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *CallbacksDiff) Empty() bool
Empty indicates whether a change was found in this element
type ComponentsDiff ¶
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
func (*ComponentsDiff) Empty ¶ added in v1.11.5
func (diff *ComponentsDiff) Empty() bool
Empty indicates whether a change was found in this element
type Config ¶
type Config struct {
MatchPath string
UnmatchPath string
FilterExtension string
PathPrefixBase string
PathPrefixRevision string
PathStripPrefixBase string
PathStripPrefixRevision string
ExcludeElements utils.StringSet
ExcludeExtensions utils.StringSet
IncludePathParams bool
MatchInlineRefs bool
}
Config includes various settings to control the diff
func NewConfig ¶
NewConfig returns a default configuration, then applies the given options in order.
func (*Config) IsExcludeDescription ¶
func (*Config) IsExcludeEndpoints ¶
func (*Config) IsExcludeExamples ¶
func (*Config) IsExcludeExtensions ¶
func (*Config) IsExcludeSummary ¶
func (*Config) IsExcludeTitle ¶
func (*Config) IsExcludedExtension ¶ added in v1.11.10
IsExcludedExtension checks if a specific extension name should be excluded from diff
type ContactDiff ¶
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 ¶
func (diff *ContactDiff) Empty() bool
Empty indicates whether a change was found in this element
type ContentDiff ¶
type ContentDiff struct {
MediaTypeAdded []string `json:"added,omitempty" yaml:"added,omitempty"`
MediaTypeDeleted []string `json:"deleted,omitempty" yaml:"deleted,omitempty"`
MediaTypeModified ModifiedMediaTypes `json:"modified,omitempty" yaml:"modified,omitempty"`
}
ContentDiff describes the changes between content properties each containing media type objects: https://swagger.io/specification/#media-type-object
func (*ContentDiff) Empty ¶
func (diff *ContentDiff) Empty() bool
Empty indicates whether a change was found in this element
type DependentRequiredDiff ¶ added in v1.15.0
type DependentRequiredDiff struct {
Added map[string][]string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted map[string][]string `json:"deleted,omitempty" yaml:"deleted,omitempty"`
Modified map[string]*StringsDiff `json:"modified,omitempty" yaml:"modified,omitempty"`
}
DependentRequiredDiff describes the changes between a pair of dependentRequired maps. Each key in the map is a property name, and the value is the list of properties that become required when that property is present.
func (*DependentRequiredDiff) Empty ¶ added in v1.15.0
func (diff *DependentRequiredDiff) Empty() bool
Empty indicates whether a change was found in this element
type DetailName ¶
type DetailName string
DetailName is the key type of the summary map
const ( // Swagger PathsDetail DetailName = "paths" WebhooksDetail DetailName = "webhooks" 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"`
WebhooksDiff *WebhooksDiff `json:"webhooks,omitempty" yaml:"webhooks,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 *ComponentsDiff `json:"components,omitempty" yaml:"components,omitempty"`
JSONSchemaDialectDiff *ValueDiff `json:"jsonSchemaDialect,omitempty" yaml:"jsonSchemaDialect,omitempty"`
// BaseInfo and RevisionInfo are the info object from each spec, carried as
// context for checkers that judge it against the changes (see the
// versioning policy in checker). Same Base/Revision convention as
// PathsDiff, SchemaDiff and the rest.
//
// They live here rather than on InfoDiff because InfoDiff is nil exactly
// when info is unchanged, which is the case the versioning policy cares
// about most, and making it non-nil would emit "info": {} into every diff
// whose info did not change.
//
// Set only on a non-empty diff, which keeps Empty() (a struct comparison)
// meaning what it says: a diff carrying nothing else carries no info
// either. Excluded from output because they are context, not a change.
BaseInfo *openapi3.Info `json:"-" yaml:"-"`
RevisionInfo *openapi3.Info `json:"-" yaml:"-"`
}
Diff describes the changes between a pair of OpenAPI objects: https://swagger.io/specification/#schema
func Get ¶
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 ¶
package main
import (
"fmt"
"os"
"github.com/getkin/kin-openapi/openapi3"
"github.com/oasdiff/oasdiff/diff"
"go.yaml.in/yaml/v3"
)
func main() {
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) GetSummary ¶
GetSummary returns a summary of the changes in the diff
type DiscriminatorDiff ¶
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 ¶
func (diff *DiscriminatorDiff) Empty() bool
Empty indicates whether a change was found in this element
type EncodingDiff ¶
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 ¶
func (diff *EncodingDiff) Empty() bool
Empty indicates whether a change was found in this element
type EncodingsDiff ¶
type EncodingsDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *EncodingsDiff) Empty() bool
Empty indicates whether a change was found in this element
type Endpoint ¶
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 EndpointsDiff ¶
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 ¶
func (diff *EndpointsDiff) Empty() bool
Empty indicates whether a change was found in this element
type EnumDiff ¶
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
type ExampleDiff ¶
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 ¶
func (diff *ExampleDiff) Empty() bool
Empty indicates whether a change was found in this element
type ExamplesDiff ¶
type ExamplesDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *ExamplesDiff) Empty() bool
Empty indicates whether a change was found in this element
type ExtensionsDiff ¶
type ExtensionsDiff InterfaceMapDiff
ExtensionsDiff describes the changes between a pair of sets of specification extensions: https://swagger.io/specification/#specification-extensions
func (*ExtensionsDiff) Empty ¶
func (diff *ExtensionsDiff) Empty() bool
Empty indicates whether a change was found in this element
type ExternalDocsDiff ¶
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 ¶
func (diff *ExternalDocsDiff) Empty() bool
Empty indicates whether a change was found in this element
type HeaderDiff ¶
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 ¶
func (headerDiff *HeaderDiff) Empty() bool
Empty indicates whether a change was found in this element
type HeadersDiff ¶
type HeadersDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (headersDiff *HeadersDiff) Empty() bool
Empty indicates whether a change was found in this element
type InfoDiff ¶
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"`
SummaryDiff *ValueDiff `json:"summary,omitempty" yaml:"summary,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
type InterfaceMapDiff ¶
type InterfaceMapDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *InterfaceMapDiff) Empty() bool
Empty indicates whether a change was found in this element
type JsonOperation ¶
type JsonOperation struct {
OldValue any `json:"oldValue" yaml:"oldValue"`
Value any `json:"value" yaml:"value"`
Type string `json:"op" yaml:"op"`
From string `json:"from" yaml:"from"`
Path string `json:"path" yaml:"path"`
}
JsonOperation is a wrapper to jsondiff.JsonOperation with proper serialization for json and yaml
func (*JsonOperation) String ¶
func (op *JsonOperation) String() string
type JsonPatch ¶
type JsonPatch []*JsonOperation
JsonPatch is a wrapper to jsondiff.JsonPatch with proper serialization for json and yaml
type LicenseDiff ¶
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"`
IdentifierDiff *ValueDiff `json:"identifier,omitempty" yaml:"identifier,omitempty"`
}
LicenseDiff describes the changes between a pair of license objects: https://swagger.io/specification/#license-object
func (*LicenseDiff) Empty ¶
func (diff *LicenseDiff) Empty() bool
Empty indicates whether a change was found in this element
type LinkDiff ¶
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
type LinksDiff ¶
type LinksDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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
type ListOfTypesDiff ¶ added in v1.11.6
type ListOfTypesDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"` // Types added to the list-of-types pattern
Deleted []string `json:"deleted,omitempty" yaml:"deleted,omitempty"` // Types removed from the list-of-types pattern
}
ListOfTypesDiff represents changes in the "list-of-types" design pattern. This is not an OpenAPI object, but rather a common pattern where oneOf/anyOf schemas are used with simple type schemas to allow multiple types for a field. For example: oneOf: [{type: string}, {type: integer}] allows string OR integer values. This diff tracks when types are added to or removed from such patterns.
func (*ListOfTypesDiff) Empty ¶ added in v1.11.6
func (diff *ListOfTypesDiff) Empty() bool
Empty indicates whether a change was found in this element
type MediaTypeDiff ¶
type MediaTypeDiff struct {
// fields from openapi media type object
ExtensionsDiff *ExtensionsDiff `json:"extensions,omitempty" yaml:"extensions,omitempty"`
SchemaDiff *SchemaDiff `json:"schema,omitempty" yaml:"schema,omitempty"`
ItemSchemaDiff *SchemaDiff `json:"itemSchema,omitempty" yaml:"itemSchema,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"`
// additional fields to describe changes to media type name
NameDiff *MediaTypeNameDiff `json:"name,omitempty" yaml:"name,omitempty"`
}
MediaTypeDiff describes the changes between a pair of media type objects: https://swagger.io/specification/#media-type-object
func (*MediaTypeDiff) Empty ¶
func (diff *MediaTypeDiff) Empty() bool
Empty indicates whether a change was found in this element
type MediaTypeName ¶ added in v1.11.4
type MediaTypeName struct {
Name string `json:"name,omitempty" yaml:"name,omitempty"`
Type string `json:"type,omitempty" yaml:"type,omitempty"`
Subtype string `json:"subtype,omitempty" yaml:"subtype,omitempty"`
Suffix string `json:"suffix,omitempty" yaml:"suffix,omitempty"`
Parameters map[string]string `json:"parameters,omitempty" yaml:"parameters,omitempty"`
}
func ParseMediaTypeName ¶ added in v1.11.4
func ParseMediaTypeName(mediaType string) (*MediaTypeName, error)
type MediaTypeNameDiff ¶ added in v1.11.4
type MediaTypeNameDiff struct {
NameDiff *ValueDiff `json:"name,omitempty" yaml:"name,omitempty"`
TypeDiff *ValueDiff `json:"type,omitempty" yaml:"type,omitempty"`
SubtypeDiff *ValueDiff `json:"subtype,omitempty" yaml:"subtype,omitempty"`
SuffixDiff *ValueDiff `json:"suffix,omitempty" yaml:"suffix,omitempty"`
ParametersDiff *StringMapDiff `json:"parameters,omitempty" yaml:"parameters,omitempty"`
// contains filtered or unexported fields
}
func (*MediaTypeNameDiff) Empty ¶ added in v1.11.4
func (diff *MediaTypeNameDiff) Empty() bool
func (*MediaTypeNameDiff) IsContained ¶ added in v1.11.4
func (diff *MediaTypeNameDiff) IsContained() bool
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 ¶
func (methodDiff *MethodDiff) Empty() bool
Empty indicates whether a change was found in this element
type ModifiedCallbacks ¶
ModifiedCallbacks is map of callback names to their respective diffs
type ModifiedEncodings ¶
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 ¶
func (modifiedEndpoints ModifiedEndpoints) ToEndpoints() Endpoints
ToEndpoints returns the modified endpoints
type ModifiedExamples ¶
type ModifiedExamples map[string]*ExampleDiff
ModifiedExamples is map of enconding names to their respective diffs
type ModifiedHeaders ¶
type ModifiedHeaders map[string]*HeaderDiff
ModifiedHeaders is map of header names to their respective diffs
type ModifiedInterfaces ¶
ModifiedInterfaces is map of interface names to their respective diffs
func (ModifiedInterfaces) Empty ¶
func (modifiedInterfaces ModifiedInterfaces) Empty() bool
Empty indicates whether a change was found in this element
type ModifiedKeys ¶
ModifiedKeys maps keys to their respective diffs
type ModifiedLinks ¶
ModifiedLinks is map of link values to their respective diffs
type ModifiedMediaTypes ¶
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 ¶
ModifiedPaths is a map of paths to their respective diffs
type ModifiedRequestBodies ¶
type ModifiedRequestBodies map[string]*RequestBodyDiff
ModifiedRequestBodies is map of requestBody names to their respective diffs
type ModifiedResponses ¶
type ModifiedResponses map[string]*ResponseDiff
ModifiedResponses is map of response values to their respective diffs
type ModifiedSchemasMap ¶
type ModifiedSchemasMap map[string]*SchemaDiff
ModifiedSchemasMap is map of schema names to their respective diffs
type ModifiedSecurityRequirement ¶ added in v1.20.1
type ModifiedSecurityRequirement struct {
Base SecurityAlternative `json:"base" yaml:"base"`
Revision SecurityAlternative `json:"revision" yaml:"revision"`
Scopes SecurityScopesDiff `json:"scopes" yaml:"scopes"`
}
ModifiedSecurityRequirement is an alternative whose scopes changed, with its identity in base and revision and the per-scheme scope diff.
type ModifiedSecurityRequirements ¶
type ModifiedSecurityRequirements []*ModifiedSecurityRequirement
ModifiedSecurityRequirements is a list of alternatives whose scopes changed. Like ModifiedSubschemas, it is modeled as a slice rather than a map to avoid a composite key.
type ModifiedSecuritySchemes ¶
type ModifiedSecuritySchemes map[string]*SecuritySchemeDiff
ModifiedSecuritySchemes is map of security schemes to their respective diffs
type ModifiedServers ¶
type ModifiedServers map[string]*ServerDiff
ModifiedServers is map of server names to their respective diffs
type ModifiedSubschema ¶
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 ¶
func (modifiedSchema *ModifiedSubschema) String() string
String returns a string representation of the modified subschema
type ModifiedSubschemas ¶
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 ¶
ModifiedTags is map of tag names to their respective diffs
type ModifiedVariables ¶
type ModifiedVariables map[string]*VariableDiff
ModifiedVariables is map of variable names to their respective diffs
type ModifiedWebhooks ¶ added in v1.15.0
ModifiedWebhooks is a map of webhook names to their respective diffs
type NullableWrappingDiff ¶ added in v1.23.0
type NullableWrappingDiff struct {
// NullabilityAdded is true when the base schema was wrapped (the revision
// accepts everything the base did, plus null).
NullabilityAdded bool `json:"nullabilityAdded,omitempty" yaml:"nullabilityAdded,omitempty"`
// NullabilityRemoved is true when the base was the wrapper and the
// revision is its non-null branch (the revision accepts everything the
// base did, except null).
NullabilityRemoved bool `json:"nullabilityRemoved,omitempty" yaml:"nullabilityRemoved,omitempty"`
}
NullableWrappingDiff marks that a schema was made nullable by wrapping it in a oneOf with a bare null alternative: base X becomes oneOf: [{type: "null"}, X'] where X' is validation-equivalent to X. This is the common OpenAPI 3.1 idiom for making a $ref'd schema nullable, since a $ref cannot carry a type array.
The wrap is equivalent to adding "null" to X's type set: the null branch cannot overlap X (the detector requires X to reject null), so oneOf's exactly-one rule behaves as anyOf here. Recognizing it keeps naive top-level comparisons (enum, pattern, type) from reading X's constraints as removed; they moved into the branch unchanged.
Third member of the wrapping-recognition family, after ListOfTypesDiff (scalar type sets) and OneOfWrappingDiff (object alternatives, a breaking restructuring): this is the provably-safe wrapping shape those two don't classify. See oasdiff/oasdiff#1088.
func (*NullableWrappingDiff) Empty ¶ added in v1.23.0
func (diff *NullableWrappingDiff) Empty() bool
Empty indicates whether a change was found in this element.
type OAuthFlowDiff ¶
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 ¶
func (diff *OAuthFlowDiff) Empty() bool
Empty indicates whether a change was found in this element
type OAuthFlowsDiff ¶
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 ¶
func (diff *OAuthFlowsDiff) Empty() bool
Empty indicates whether a change was found in this element
type OneOfWrappingDiff ¶ added in v1.20.1
type OneOfWrappingDiff struct {
// NumAlternatives is the number of oneOf alternatives on the revision side.
NumAlternatives int `json:"numAlternatives,omitempty" yaml:"numAlternatives,omitempty"`
// MovedProperties are base property names that appear in at least one
// alternative, i.e. they moved into the wrapping rather than being removed.
MovedProperties []string `json:"movedProperties,omitempty" yaml:"movedProperties,omitempty"`
// OriginalPreserved is true when one alternative has the same validation
// contract as the base schema, so every payload the base accepted matches
// that alternative. It says nothing about whether such a payload also
// matches another alternative, which oneOf rejects.
OriginalPreserved bool `json:"originalPreserved,omitempty" yaml:"originalPreserved,omitempty"`
}
OneOfWrappingDiff marks that a concrete object schema was wrapped into a oneOf of alternatives: a concrete object schema (properties, no oneOf) on the base side becomes a oneOf of object subschemas on the revision side, with no top-level type or properties. The base properties move into the alternatives rather than being removed.
Wrapping a concrete object request body into a oneOf is a breaking restructuring: under oneOf (validate against exactly one), a previously valid payload can match multiple overlapping alternatives and be rejected.
It follows the precedent of ListOfTypesDiff, which promotes a single<->oneOf transition to a first-class diff so the checker can avoid naive field-level false positives. The two are complementary, not reflections: ListOfTypesDiff handles the scalar type-set case (oneOf alternatives that differ by type, and its detector skips schemas with properties), while OneOfWrappingDiff handles the object case it skips (alternatives that are objects differing by properties/required). The checker reads it to (a) suppress the spurious "property removed" findings the raw property diff would otherwise produce for the moved properties, and (b) emit an accurate breaking finding. See oasdiff/oasdiff#702.
func (*OneOfWrappingDiff) Empty ¶ added in v1.20.1
func (diff *OneOfWrappingDiff) Empty() bool
Empty indicates whether a change was found in this element.
type OperationsDiff ¶
type OperationsDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (operationsDiff *OperationsDiff) Empty() bool
Empty indicates whether a change was found in this element
type OperationsSourcesMap ¶
OperationsSourcesMap maps OpenAPI operations to their source file paths
type Option ¶ added in v1.15.3
type Option func(*Config)
Option configures a Config during NewConfig. Options compose: each receives the Config after defaults and prior options have been applied.
func WithExcludeElements ¶ added in v1.15.3
WithExcludeElements sets the elements (description, summary, endpoints, examples, extensions, title) to omit from the diff.
func WithExcludeExtensions ¶ added in v1.15.3
WithExcludeExtensions sets specific OpenAPI extension names to omit from the diff (only takes effect when "extensions" is also in ExcludeElements).
func WithMatchInlineRefs ¶ added in v1.17.0
WithMatchInlineRefs controls whether validation-equivalent inline/$ref subschemas under anyOf/oneOf are matched as the same branch. Default true. Set to false to restore the previous behaviour where an inline-to-$ref refactor of an equivalent component is reported as one branch added and one branch removed.
type ParamDiffByLocation ¶
type ParamDiffByLocation map[string]ParamDiffs
ParamDiffByLocation maps param location (path, query, header or cookie) to param diffs in this location
func (ParamDiffByLocation) Len ¶
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 ¶
ParamNamesByLocation maps param location (path, query, header or cookie) to the params in this location
func (ParamNamesByLocation) Len ¶
func (params ParamNamesByLocation) Len() int
Len returns the number of all params in all locations
type ParameterDiff ¶
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 ¶
func (diff *ParameterDiff) Empty() bool
Empty indicates whether a change was found in this element
type ParametersDiff ¶
type ParametersDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *ParametersDiff) Empty() bool
Empty indicates whether a change was found in this element
type ParametersDiffByLocation ¶
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 ¶
func (diff *ParametersDiffByLocation) Empty() bool
Empty indicates whether a change was found in this element
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
type PathParamsMap ¶
PathParamsMap handles path param renaming for example: person/{personName} -> /person/{name} in such cases, PathParamsMap stores the param mapping: personName -> name
func NewPathParamsMap ¶
func NewPathParamsMap(pathParams1, pathParams2 []string) (PathParamsMap, bool)
type PathsDiff ¶
type PathsDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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
type RequestBodiesDiff ¶
type RequestBodiesDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (requestBodiesDiff *RequestBodiesDiff) Empty() bool
Empty indicates whether a change was found in this element
type RequestBodyDiff ¶
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 ¶
func (diff *RequestBodyDiff) Empty() bool
Empty indicates whether a change was found in this element
type RequiredPropertiesDiff ¶
type RequiredPropertiesDiff struct {
StringsDiff
}
RequiredPropertiesDiff describes the changes between a pair of lists of required properties
func (*RequiredPropertiesDiff) Empty ¶
func (diff *RequiredPropertiesDiff) Empty() bool
Empty indicates whether a change was found in this element
type ResponseDiff ¶
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 ¶
func (diff *ResponseDiff) Empty() bool
Empty indicates whether a change was found in this element
type ResponsesDiff ¶
type ResponsesDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
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"`
// OpenAPI 3.1 / JSON Schema 2020-12 fields
AlwaysDiff *ValueDiff `json:"always,omitempty" yaml:"always,omitempty"`
ConstDiff *ValueDiff `json:"const,omitempty" yaml:"const,omitempty"`
ExamplesDiff *ValueDiff `json:"examples,omitempty" yaml:"examples,omitempty"`
PrefixItemsDiff *SubschemasDiff `json:"prefixItems,omitempty" yaml:"prefixItems,omitempty"`
ContainsDiff *SchemaDiff `json:"contains,omitempty" yaml:"contains,omitempty"`
MinContainsDiff *ValueDiff `json:"minContains,omitempty" yaml:"minContains,omitempty"`
MaxContainsDiff *ValueDiff `json:"maxContains,omitempty" yaml:"maxContains,omitempty"`
PatternPropertiesDiff *SchemasDiff `json:"patternProperties,omitempty" yaml:"patternProperties,omitempty"`
DependentSchemasDiff *SchemasDiff `json:"dependentSchemas,omitempty" yaml:"dependentSchemas,omitempty"`
PropertyNamesDiff *SchemaDiff `json:"propertyNames,omitempty" yaml:"propertyNames,omitempty"`
UnevaluatedItemsAllowedDiff *ValueDiff `json:"unevaluatedItemsAllowed,omitempty" yaml:"unevaluatedItemsAllowed,omitempty"`
UnevaluatedItemsDiff *SchemaDiff `json:"unevaluatedItems,omitempty" yaml:"unevaluatedItems,omitempty"`
UnevaluatedPropertiesAllowedDiff *ValueDiff `json:"unevaluatedPropertiesAllowed,omitempty" yaml:"unevaluatedPropertiesAllowed,omitempty"`
UnevaluatedPropertiesDiff *SchemaDiff `json:"unevaluatedProperties,omitempty" yaml:"unevaluatedProperties,omitempty"`
IfDiff *SchemaDiff `json:"if,omitempty" yaml:"if,omitempty"`
ThenDiff *SchemaDiff `json:"then,omitempty" yaml:"then,omitempty"`
ElseDiff *SchemaDiff `json:"else,omitempty" yaml:"else,omitempty"`
DependentRequiredDiff *DependentRequiredDiff `json:"dependentRequired,omitempty" yaml:"dependentRequired,omitempty"`
SchemaIDDiff *ValueDiff `json:"$id,omitempty" yaml:"$id,omitempty"`
AnchorDiff *ValueDiff `json:"$anchor,omitempty" yaml:"$anchor,omitempty"`
DynamicRefDiff *ValueDiff `json:"$dynamicRef,omitempty" yaml:"$dynamicRef,omitempty"`
DynamicAnchorDiff *ValueDiff `json:"$dynamicAnchor,omitempty" yaml:"$dynamicAnchor,omitempty"`
ContentMediaTypeDiff *ValueDiff `json:"contentMediaType,omitempty" yaml:"contentMediaType,omitempty"`
ContentEncodingDiff *ValueDiff `json:"contentEncoding,omitempty" yaml:"contentEncoding,omitempty"`
ContentSchemaDiff *SchemaDiff `json:"contentSchema,omitempty" yaml:"contentSchema,omitempty"`
DefsDiff *SchemasDiff `json:"$defs,omitempty" yaml:"$defs,omitempty"`
SchemaDialectDiff *ValueDiff `json:"$schema,omitempty" yaml:"$schema,omitempty"`
CommentDiff *ValueDiff `json:"$comment,omitempty" yaml:"$comment,omitempty"`
// Derived pattern recognitions, not OpenAPI keywords. They reinterpret the
// type/oneOf/properties/required changes above for the checker so it can
// avoid field-level false positives on single<->oneOf and
// object<->oneOf-wrapping transitions. Additive: the raw shape change is
// still reported in the real fields; these only add the interpretation the
// checker reads.
ListOfTypesDiff *ListOfTypesDiff `json:"listOfTypes,omitempty" yaml:"listOfTypes,omitempty"`
OneOfWrappingDiff *OneOfWrappingDiff `json:"oneOfWrapping,omitempty" yaml:"oneOfWrapping,omitempty"`
NullableWrappingDiff *NullableWrappingDiff `json:"nullableWrapping,omitempty" yaml:"nullableWrapping,omitempty"`
// Base and Revision point to the compared schema objects for reference in checkers
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 ¶
func (diff *SchemaDiff) Empty() bool
Empty indicates whether a change was found in this element
type SchemasDiff ¶
type SchemasDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (schemasDiff *SchemasDiff) Empty() bool
Empty indicates whether a change was found in this element
type SecurityAlternative ¶ added in v1.20.1
type SecurityAlternative struct {
Index int `json:"index" yaml:"index"` // zero-based index in the security list
Schemes map[string][]string `json:"schemes" yaml:"schemes"` // scheme name -> scopes
}
SecurityAlternative is one alternative (one security requirement object) in a security list, identified by its index plus its schemes and their scopes.
func (SecurityAlternative) SchemeNames ¶ added in v1.20.1
func (a SecurityAlternative) SchemeNames() string
SchemeNames returns the alternative's scheme names, sorted and AND-joined (e.g. "apiKey AND oauth"). It labels a scope modification, where the changed scopes are reported separately, so it omits the scopes that String() carries.
func (SecurityAlternative) String ¶ added in v1.20.1
func (a SecurityAlternative) String() string
String renders an alternative by its schemes and scopes. The index is kept in the structured data but left out of the human-readable form, since it is positional rather than a meaningful identity. Schemes and scopes are sorted so the output is deterministic. A scheme with no scopes (API key, bearer) shows as its bare name; an empty requirement (`{}`, this alternative requires no authentication) shows as "{}".
type SecurityAlternatives ¶ added in v1.20.1
type SecurityAlternatives []SecurityAlternative
SecurityAlternatives is a list of security alternatives.
type SecurityRequirementsDiff ¶
type SecurityRequirementsDiff struct {
Added SecurityAlternatives `json:"added,omitempty" yaml:"added,omitempty"`
Deleted SecurityAlternatives `json:"deleted,omitempty" yaml:"deleted,omitempty"`
Modified ModifiedSecurityRequirements `json:"modified,omitempty" yaml:"modified,omitempty"`
// Origins of the documents whose root "security" field changed, used to
// report the source location of global security changes. Set only on the
// root-level diff (see diff.go), not the per-operation one, and kept out of
// the diff output.
BaseOrigin *openapi3.Origin `json:"-" yaml:"-"`
RevisionOrigin *openapi3.Origin `json:"-" yaml:"-"`
}
SecurityRequirementsDiff describes the changes between a pair of lists of security requirement objects: https://swagger.io/specification/#security-requirement-object
Semantics, which drive the modeling below:
- the list is an OR: a request is authorized if it satisfies any one item;
- the schemes within one item are AND-ed: all of them must be satisfied;
- the scopes within a scheme are AND-ed too.
So an OR of scopes for a single scheme can only be written by repeating the scheme across items (- petstore_auth: [read] / - petstore_auth: [write]), and a single item may carry several schemes AND-ed together (both an oauth and an apiKey key).
An alternative therefore has no identity of its own to key on: its scheme names aren't unique (the repeated-scheme case above) and there may be several of them. The scheme name is only a reference into components.securitySchemes, an author-chosen label; the scheme's actual meaning (type, flows) is diffed separately in SecuritySchemesDiff. So alternatives cannot be keyed by a string; like SubschemasDiff, they are identified by index and carried as structured values.
func (*SecurityRequirementsDiff) Empty ¶
func (diff *SecurityRequirementsDiff) Empty() bool
Empty indicates whether a change was found in this element
type SecuritySchemeDiff ¶
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 ¶
func (diff *SecuritySchemeDiff) Empty() bool
Empty indicates whether a change was found in this element
type SecuritySchemesDiff ¶
type SecuritySchemesDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `json:"deleted,omitempty" yaml:"deleted,omitempty"`
Modified ModifiedSecuritySchemes `json:"modified,omitempty" yaml:"modified,omitempty"`
Base openapi3.SecuritySchemes `json:"-" yaml:"-"`
Revision openapi3.SecuritySchemes `json:"-" yaml:"-"`
}
SecuritySchemesDiff describes the changes between a pair of sets of security scheme objects: https://swagger.io/specification/#security-scheme-object
func (*SecuritySchemesDiff) Empty ¶
func (diff *SecuritySchemesDiff) Empty() bool
Empty indicates whether a change was found in this element
type SecurityScopesDiff ¶
type SecurityScopesDiff map[string]*StringsDiff
SecurityScopesDiff is a map of security schemes to their respective scope diffs
func (SecurityScopesDiff) Empty ¶
func (diff SecurityScopesDiff) Empty() bool
Empty indicates whether a change was found in this element
type ServerDiff ¶
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 ¶
func (diff *ServerDiff) Empty() bool
Empty indicates whether a change was found in this element
type ServersDiff ¶
type ServersDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *ServersDiff) Empty() bool
Empty indicates whether a change was found in this element
type StringMapDiff ¶
type StringMapDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *StringMapDiff) Empty() bool
Empty indicates whether a change was found in this element
type StringsDiff ¶
type StringsDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `json:"deleted,omitempty" yaml:"deleted,omitempty"`
}
StringsDiff describes the changes between a pair of lists of strings
func (*StringsDiff) Empty ¶
func (stringsDiff *StringsDiff) Empty() bool
Empty indicates whether a change was found in this element
func (*StringsDiff) Reverse ¶ added in v1.20.0
func (stringsDiff *StringsDiff) Reverse() *StringsDiff
Reverse returns the diff with base and revision swapped (Added<->Deleted). A nil diff has no direction to reverse and is returned nil.
type Subschema ¶
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
type Subschemas ¶
type Subschemas []Subschema
Subschemas is a list of subschemas
func (Subschemas) String ¶
func (schemas Subschemas) String() string
String returns a string representation of the subschemas
type SubschemasDiff ¶
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 three diffs:
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
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
Reconciliation of inline/$ref refactors (AnyOf and OneOf only, when Config.MatchInlineRefs is true): after passes 1 and 2, any unmatched Added/Deleted pair that crosses the inline/$ref boundary and is validation-equivalent (annotation-only differences ignored) is paired and removed from Added and Deleted. Matching is pair-based: each Deleted matches at most one Added.
Special case (in pass 2): 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 ¶
func NewSubschemasDiff() *SubschemasDiff
NewSubschemasDiff creates a new SubschemasDiff
func (*SubschemasDiff) Empty ¶
func (diff *SubschemasDiff) Empty() bool
Empty indicates whether a change was found in this element
type Summary ¶
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 ¶
func (summary *Summary) GetSummaryDetails(name DetailName) SummaryDetails
GetSummaryDetails returns the summary for a specific part
type SummaryDetails ¶
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 ¶
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
type TagsDiff ¶
type TagsDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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
type ValueDiff ¶
ValueDiff describes the changes between a pair of values
type VariableDiff ¶
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 ¶
func (diff *VariableDiff) Empty() bool
Empty indicates whether a change was found in this element
type VariablesDiff ¶
type VariablesDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `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 ¶
func (diff *VariablesDiff) Empty() bool
Empty indicates whether a change was found in this element
type WebhooksDiff ¶ added in v1.15.0
type WebhooksDiff struct {
Added []string `json:"added,omitempty" yaml:"added,omitempty"`
Deleted []string `json:"deleted,omitempty" yaml:"deleted,omitempty"`
Modified ModifiedWebhooks `json:"modified,omitempty" yaml:"modified,omitempty"`
Base map[string]*openapi3.PathItem `json:"-" yaml:"-"`
Revision map[string]*openapi3.PathItem `json:"-" yaml:"-"`
}
WebhooksDiff describes the changes between a pair of Webhooks objects (OpenAPI 3.1)
func (*WebhooksDiff) Empty ¶ added in v1.15.0
func (webhooksDiff *WebhooksDiff) Empty() bool
Empty indicates whether a change was found in this element
Source Files
¶
- callbacks_diff.go
- components_diff.go
- config.go
- contact.go
- content_diff.go
- dependent_required_diff.go
- diff.go
- diff_interface.go
- directional_schema_diff_cache.go
- discriminator_diff.go
- doc.go
- encoding_diff.go
- encodings_diff.go
- endpoints.go
- endpoints_diff.go
- enum_diff.go
- example_diff.go
- examples_diff.go
- extensions_diff.go
- external_docs_diff.go
- header_diff.go
- headers_diff.go
- info_diff.go
- interface_map_diff.go
- json_diff.go
- license_diff.go
- link_diff.go
- links_diff.go
- list_of_types_diff.go
- media_type_diff.go
- media_type_name.go
- media_type_name_diff.go
- method_diff.go
- modified_endpoints.go
- modified_interfaces.go
- modified_paths.go
- modified_subschemas.go
- nullable_wrapping_diff.go
- oauth_flow.go
- oauth_flows.go
- one_of_wrapping_diff.go
- operations_diff.go
- parameter_diff.go
- parameters_diff.go
- parameters_diff_by_location.go
- path.go
- path_diff.go
- path_items_diff.go
- path_params_map.go
- paths_diff.go
- prefix_items_diff.go
- prefix_items_equivalence.go
- request_bodies_diff.go
- request_body_diff.go
- required_diff.go
- response_diff.go
- responses_diff.go
- schema_circular_refs.go
- schema_diff.go
- schema_diff_cache.go
- schema_ref_map.go
- schema_validation_equivalence.go
- schemas_diff.go
- security_requirements_diff.go
- security_scheme.go
- security_schemes.go
- security_scopes_diff.go
- server_diff.go
- servers_diff.go
- state.go
- string_list_diff.go
- string_map_diff.go
- subschemas_diff.go
- summary.go
- tag_diff.go
- tags_diff.go
- type_diff.go
- value_diff.go
- variable_diff.go
- variables_diff.go
- webhooks_diff.go