Documentation
¶
Overview ¶
Package diff provides a diff function for OpenAPI Spec 3. Work to enhance the diff with additional aspects of OAS is in-progress.
Index ¶
- type CallbacksDiff
- type ComponentName
- type ContentDiff
- type Diff
- type EncodingDiff
- type EncodingsDiff
- type EnumDiff
- type EnumValues
- type HeaderDiff
- type HeadersDiff
- type MethodDiff
- type ModifiedCallbacks
- type ModifiedEncodings
- type ModifiedHeaders
- type ModifiedOperations
- type ModifiedPaths
- type ModifiedRequestBodies
- type ModifiedResponses
- type ModifiedSchemas
- type ModifiedServers
- type ModifiedTags
- type OperationsDiff
- type ParamDiffByLocation
- type ParamDiffs
- type ParamNames
- type ParamNamesByLocation
- type ParameterDiff
- type ParametersDiff
- type PathDiff
- type PathsDiff
- type RequestBodiesDiff
- type RequestBodyDiff
- type ResponseDiff
- type ResponsesDiff
- type SchemaDiff
- type SchemasDiff
- type ServerDiff
- type ServersDiff
- type SpecDiff
- type StringList
- type StringSet
- type StringsDiff
- type Summary
- type SummaryDetails
- type TagDiff
- type TagsDiff
- type ValueDiff
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbacksDiff ¶ added in v0.1.11
type CallbacksDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedCallbacks `json:"modified,omitempty"` }
CallbacksDiff is a diff between callback objects: https://swagger.io/specification/#callback-object
type ComponentName ¶ added in v0.1.16
type ComponentName string
ComponentName is used as a key in the summary map
const ( PathsComponent ComponentName = "paths" TagsComponent ComponentName = "tags" SchemasComponent ComponentName = "schemas" ParametersComponent ComponentName = "parameters" HeadersComponent ComponentName = "headers" RequestBodiesComponent ComponentName = "requestBodies" ResponsesComponent ComponentName = "responses" CallbacksComponent ComponentName = "callbacks" )
Components in the summary map
type ContentDiff ¶
type ContentDiff struct { MediaTypeAdded bool `json:"mediaTypeAdded,omitempty"` MediaTypeDeleted bool `json:"mediaTypeDeleted,omitempty"` MediaTypeDiff bool `json:"mediaType,omitempty"` // ExtensionProps SchemaDiff *SchemaDiff `json:"schema,omitempty"` ExampleDiff *ValueDiff `json:"example,omitempty"` EncodingsDiff *EncodingsDiff `json:"encoding,omitempty"` }
ContentDiff is the diff between two content objects each containing a media type object: https://swagger.io/specification/#media-type-object
type Diff ¶
type Diff struct { SpecDiff *SpecDiff `json:"spec,omitempty"` Summary *Summary `json:"summary,omitempty"` }
Diff describes changes between two OpenAPI specifications including a summary of the changes
func Get ¶ added in v0.1.9
Get calculates the diff between two OpenAPI specifications. Prefix is an optional path prefix that exists in s1 paths but not in s2. If filter isn't empty, the diff will only include paths that match this regex. The diff is "deep" in the sense that it compares the contents of properties recursivly.
type EncodingDiff ¶ added in v0.1.17
type EncodingDiff struct { ContentTypeDiff *ValueDiff `json:"contentType,omitempty"` HeadersDiff *HeadersDiff `json:"headers,omitempty"` StyleDiff *ValueDiff `json:"styleDiff,omitempty"` ExplodeDiff *ValueDiff `json:"explode,omitempty"` AllowReservedDiff *ValueDiff `json:"allowReservedDiff,omitempty"` }
EncodingDiff is a diff between encoding objects: https://swagger.io/specification/#encoding-object
type EncodingsDiff ¶ added in v0.1.17
type EncodingsDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedEncodings `json:"modified,omitempty"` }
EncodingsDiff is a diff between two sets of encoding objects: https://swagger.io/specification/#encoding-object
type EnumDiff ¶ added in v0.1.3
type EnumDiff struct { Added EnumValues `json:"added,omitempty"` Deleted EnumValues `json:"deleted,omitempty"` }
EnumDiff is the diff between two enums
type HeaderDiff ¶ added in v0.1.10
type HeaderDiff struct { // ExtensionProps DescriptionDiff *ValueDiff `json:"description,omitempty"` DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` RequiredDiff *ValueDiff `json:"required,omitempty"` ExampleDiff *ValueDiff `json:"example,omitempty"` SchemaDiff *SchemaDiff `json:"schema,omitempty"` ContentDiff *ContentDiff `json:"content,omitempty"` }
HeaderDiff is a diff between header objects: https://swagger.io/specification/#header-object
type HeadersDiff ¶ added in v0.1.10
type HeadersDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedHeaders `json:"modified,omitempty"` }
HeadersDiff is a diff between two sets of header objects: https://swagger.io/specification/#header-object
type MethodDiff ¶
type MethodDiff struct { // ExtensionProps TagsDiff *StringsDiff `json:"tags,omitempty"` SummaryDiff *ValueDiff `json:"summary,omitempty"` DescriptionDiff *ValueDiff `json:"description,omitempty"` OperationIDDiff *ValueDiff `json:"operationID,omitempty"` ParametersDiff *ParametersDiff `json:"parameters,omitempty"` RequestBodyDiff *RequestBodyDiff `json:"requestBody,omitempty"` ResponseDiff *ResponsesDiff `json:"responses,omitempty"` CallbacksDiff *CallbacksDiff `json:"callbacks,omitempty"` DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` // Security ServersDiff *ServersDiff `json:"servers,omitempty"` }
MethodDiff is the diff between two operation objects: https://swagger.io/specification/#operation-object
type ModifiedCallbacks ¶ added in v0.1.11
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 ModifiedHeaders ¶ added in v0.1.10
type ModifiedHeaders map[string]HeaderDiff
ModifiedHeaders is map of header 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
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 ModifiedSchemas ¶
type ModifiedSchemas map[string]*SchemaDiff
ModifiedSchemas is map of schema names 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 ModifiedTags ¶ added in v0.1.11
ModifiedTags is map of tag names to their respective diffs
type OperationsDiff ¶ added in v0.1.17
type OperationsDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedOperations `json:"modified,omitempty"` }
OperationsDiff is a diff between the operation objects (https://swagger.io/specification/#operation-object) of two path item objects
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
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]ParamNames
ParamNamesByLocation maps param location (path, query, header or cookie) to the params in this location
type ParameterDiff ¶ added in v0.1.5
type ParameterDiff struct { DescriptionDiff *ValueDiff `json:"description,omitempty"` StyleDiff *ValueDiff `json:"style,omitempty"` ExplodeDiff *ValueDiff `json:"explode,omitempty"` AllowEmptyValueDiff *ValueDiff `json:"allowEmptyValue,omitempty"` AllowReservedDiff *ValueDiff `json:"allowReserved,omitempty"` DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` RequiredDiff *ValueDiff `json:"required,omitempty"` SchemaDiff *SchemaDiff `json:"schema,omitempty"` ExampleDiff *ValueDiff `json:"example,omitempty"` ContentDiff *ContentDiff `json:"content,omitempty"` }
ParameterDiff is a diff between parameter objects: https://swagger.io/specification/#parameter-object
type ParametersDiff ¶ added in v0.1.5
type ParametersDiff struct { Added ParamNamesByLocation `json:"added,omitempty"` Deleted ParamNamesByLocation `json:"deleted,omitempty"` Modified ParamDiffByLocation `json:"modified,omitempty"` }
ParametersDiff is a diff between two lists of parameter objects: https://swagger.io/specification/#parameter-object
type PathDiff ¶
type PathDiff struct { SummaryDiff *ValueDiff `json:"summary,omitempty"` DescriptionDiff *ValueDiff `json:"description,omitempty"` OperationsDiff *OperationsDiff `json:"operations,omitempty"` ServersDiff *ServersDiff `json:"servers,omitempty"` ParametersDiff *ParametersDiff `json:"parameters,omitempty"` }
PathDiff is a diff between path item objects: https://swagger.io/specification/#path-item-object
type PathsDiff ¶ added in v0.1.5
type PathsDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedPaths `json:"modified,omitempty"` }
PathsDiff is a diff between two sets of path item objects: https://swagger.io/specification/#path-item-object
type RequestBodiesDiff ¶ added in v0.1.14
type RequestBodiesDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedRequestBodies `json:"modified,omitempty"` }
RequestBodiesDiff is a diff between two sets of request body objects: https://swagger.io/specification/#request-body-object
type RequestBodyDiff ¶ added in v0.1.14
type RequestBodyDiff struct { DescriptionDiff *ValueDiff `json:"description,omitempty"` ContentDiff *ContentDiff `json:"content,omitempty"` }
RequestBodyDiff is a diff between request body objects: https://swagger.io/specification/#request-body-object
type ResponseDiff ¶ added in v0.1.5
type ResponseDiff struct { // ExtensionProps DescriptionDiff *ValueDiff `json:"description,omitempty"` HeadersDiff *HeadersDiff `json:"headers,omitempty"` ContentDiff *ContentDiff `json:"content,omitempty"` }
ResponseDiff is a diff between response objects: https://swagger.io/specification/#response-object
type ResponsesDiff ¶ added in v0.1.5
type ResponsesDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedResponses `json:"modified,omitempty"` }
ResponsesDiff is a diff between two sets of response objects: https://swagger.io/specification/#responses-object
type SchemaDiff ¶
type SchemaDiff struct { SchemaAdded bool `json:"schemaAdded,omitempty"` SchemaDeleted bool `json:"schemaDeleted,omitempty"` ValueAdded bool `json:"valueAdded,omitempty"` ValueDeleted bool `json:"valueDeleted,omitempty"` OneOfDiff bool `json:"oneOf,omitempty"` AnyOfDiff bool `json:"anyOf,omitempty"` AllOfDiff bool `json:"allOf,omitempty"` NotDiff bool `json:"not,omitempty"` TypeDiff *ValueDiff `json:"type,omitempty"` TitleDiff *ValueDiff `json:"title,omitempty"` FormatDiff *ValueDiff `json:"format,omitempty"` DescriptionDiff *ValueDiff `json:"description,omitempty"` EnumDiff *EnumDiff `json:"enum,omitempty"` DefaultDiff *ValueDiff `json:"default,omitempty"` ExampleDiff *ValueDiff `json:"example,omitempty"` AdditionalPropertiesAllowedDiff *ValueDiff `json:"additionalPropertiesAllowed,omitempty"` UniqueItemsDiff *ValueDiff `json:"uniqueItems,omitempty"` ExclusiveMinDiff *ValueDiff `json:"exclusiveMin,omitempty"` ExclusiveMaxDiff *ValueDiff `json:"exclusiveMax,omitempty"` NullableDiff *ValueDiff `json:"nullable,omitempty"` ReadOnlyDiff *ValueDiff `json:"readOnly,omitempty"` WriteOnlyDiff *ValueDiff `json:"writeOnly,omitempty"` AllowEmptyValueDiff *ValueDiff `json:"allowEmptyValue,omitempty"` XMLDiff *ValueDiff `json:"XML,omitempty"` DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` MinDiff *ValueDiff `json:"min,omitempty"` MaxDiff *ValueDiff `json:"max,omitempty"` MultipleOf *ValueDiff `json:"multipleOf,omitempty"` MinLength *ValueDiff `json:"minLength,omitempty"` MaxLength *ValueDiff `json:"maxLength,omitempty"` Pattern *ValueDiff `json:"pattern,omitempty"` MinItems *ValueDiff `json:"minItems,omitempty"` MaxItems *ValueDiff `json:"maxItems,omitempty"` Items bool `json:"items,omitempty"` Required *StringsDiff `json:"required,omitempty"` PropertiesDiff *SchemasDiff `json:"properties,omitempty"` MinProps *ValueDiff `json:"minProps,omitempty"` MaxProps *ValueDiff `json:"maxProps,omitempty"` AdditionalProperties bool `json:"additionalProperties,omitempty"` }
SchemaDiff is a diff between schema objects: https://swagger.io/specification/#schema-object. Boolean fields specify whether the property in question was changed between the two versions. Pointer fields specify not only the presence of a change but also the old and new values of the property.
type SchemasDiff ¶ added in v0.1.5
type SchemasDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedSchemas `json:"modified,omitempty"` }
SchemasDiff is a diff between two sets of schema objects: https://swagger.io/specification/#schema-object
type ServerDiff ¶ added in v0.1.18
type ServerDiff struct { URLDiff *ValueDiff `json:"urlType,omitempty"` DescriptionDiff *ValueDiff `json:"description,omitempty"` }
ServerDiff is a diff between server objects: https://swagger.io/specification/#server-object
type ServersDiff ¶ added in v0.1.18
type ServersDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedServers `json:"modified,omitempty"` }
ServersDiff is a diff between two sets of encoding objects: https://swagger.io/specification/#server-object
type SpecDiff ¶ added in v0.1.9
type SpecDiff struct { PathsDiff *PathsDiff `json:"paths,omitempty"` TagsDiff *TagsDiff `json:"tags,omitempty"` // Components SchemasDiff *SchemasDiff `json:"schemas,omitempty"` ParametersDiff *ParametersDiff `json:"parameters,omitempty"` HeadersDiff *HeadersDiff `json:"headers,omitempty"` RequestBodiesDiff *RequestBodiesDiff `json:"requestBodies,omitempty"` ResponsesDiff *ResponsesDiff `json:"responses,omitempty"` CallbacksDiff *CallbacksDiff `json:"callbacks,omitempty"` }
SpecDiff describes the changes between two OpenAPI specifications: https://swagger.io/specification/#specification
type StringSet ¶ added in v0.1.11
type StringSet map[string]struct{}
StringSet is a set of string values
type StringsDiff ¶ added in v0.1.11
type StringsDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` }
StringsDiff is the diff between two lists of strings
type Summary ¶ added in v0.0.9
type Summary struct { Diff bool `json:"diff"` Components map[ComponentName]*SummaryDetails `json:"components,omitempty"` }
Summary summarizes the changes between two OpenAPI specifications
func (*Summary) GetSummaryDetails ¶ added in v0.1.13
func (summary *Summary) GetSummaryDetails(component ComponentName) SummaryDetails
GetSummaryDetails returns the summary for a specific component
type SummaryDetails ¶ added in v0.1.8
type SummaryDetails struct { Added int `json:"added,omitempty"` // number of added items Deleted int `json:"deleted,omitempty"` // number of deleted items Modified int `json:"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"` DescriptionDiff *ValueDiff `json:"description,omitempty"` }
TagDiff is a diff between tag objects: https://swagger.io/specification/#tag-object
type TagsDiff ¶ added in v0.1.11
type TagsDiff struct { Added StringList `json:"added,omitempty"` Deleted StringList `json:"deleted,omitempty"` Modified ModifiedTags `json:"modified,omitempty"` }
TagsDiff is a diff between two lists of tag objects: https://swagger.io/specification/#tag-object
Source Files
¶
- callbacks_diff.go
- content_diff.go
- diff.go
- diff_endpoints.go
- doc.go
- encoding_diff.go
- encodings_diff.go
- enum_diff.go
- header_diff.go
- headers_diff.go
- method_diff.go
- modified_paths.go
- modified_schemas.go
- operations_diff.go
- parameter_diff.go
- parameters_aux.go
- parameters_diff.go
- path_diff.go
- paths_diff.go
- request_bodies_diff.go
- request_body_diff.go
- response_diff.go
- responses_diff.go
- schema_diff.go
- schemas_diff.go
- server_diff.go
- servers_diff.go
- spec_diff.go
- string_list.go
- string_set.go
- strings_diff.go
- summary.go
- tag_diff.go
- tags_diff.go
- value_diff.go