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 ContentDiff
- type Diff
- type EnumDiff
- type EnumValues
- type HeaderDiff
- type HeadersDiff
- type MethodDiff
- type ModifiedCallbacks
- type ModifiedHeaders
- type ModifiedOperations
- type ModifiedPaths
- type ModifiedResponses
- type ModifiedSchemas
- type ModifiedTags
- type Operations
- type ParamDiffByLocation
- type ParamDiffs
- type ParamNames
- type ParamNamesByLocation
- type ParameterDiff
- type ParametersDiff
- type PathDiff
- type PathsDiff
- type ResponseDiff
- type ResponsesDiff
- type SchemaDiff
- type SchemasDiff
- 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 two sets of callbacks
type ContentDiff ¶
type ContentDiff struct {
MediaTypeAdded bool `json:"mediaTypeAdded,omitempty"`
MediaTypeDeleted bool `json:"mediaTypeDeleted,omitempty"`
MediaTypeDiff bool `json:"mediaType,omitempty"`
SchemaDiff *SchemaDiff `json:"schema,omitempty"` // diff of 'schema' property
ExampleDiff *ValueDiff `json:"example,omitempty"` // diff of 'example' property
}
ContentDiff is the diff between two OAS contents
type Diff ¶
type Diff struct {
SpecDiff *SpecDiff `json:"spec,omitempty"`
Summary *Summary `json:"summary,omitempty"`
}
Diff describes changes between two OAS specs including a summary of these changes
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 OAS enums
type HeaderDiff ¶ added in v0.1.10
type HeaderDiff struct {
// ExtensionProps
DescriptionDiff *ValueDiff `json:"description,omitempty"` // diff of 'description' property
DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` // diff of 'deprecated' property
RequiredDiff *ValueDiff `json:"required,omitempty"` // diff of 'required' property
ExampleDiff *ValueDiff `json:"example,omitempty"` // diff of 'example' property
SchemaDiff *SchemaDiff `json:"schema,omitempty"` // diff of 'schema' property
ContentDiff *ContentDiff `json:"content,omitempty"` // diff of 'content' property
}
HeaderDiff is a diff between two OAS headers
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 headers
type MethodDiff ¶
type MethodDiff struct {
// ExtensionProps
TagsDiff *StringsDiff `json:"tags,omitempty"` // diff of 'tags' property
SummaryDiff *ValueDiff `json:"summary,omitempty"` // diff of 'summary' property
DescriptionDiff *ValueDiff `json:"description,omitempty"` // diff of 'description' property
OperationIDDiff *ValueDiff `json:"operationID,omitempty"` // diff of 'operationID' property
ParamDiff *ParametersDiff `json:"parameters,omitempty"` // diff of 'parameters' property
// RequestBody
ResponseDiff *ResponsesDiff `json:"responses,omitempty"` // diff of 'responses' property
CallbacksDiff *CallbacksDiff `json:"callbacks,omitempty"` // diff of 'callbacks' property
DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` // diff of 'deprecated' property
}
MethodDiff is the diff between two OAS operations (methods)
type ModifiedCallbacks ¶ added in v0.1.11
ModifiedCallbacks is map of callback names to their respective diffs
type ModifiedHeaders ¶ added in v0.1.10
type ModifiedHeaders map[string]HeaderDiff
ModifiedHeaders is map of header values 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 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 ModifiedTags ¶ added in v0.1.11
ModifiedTags is map of tag names to their respective diffs
type Operations ¶ added in v0.0.9
type Operations struct {
Added StringList `json:"added,omitempty"`
Deleted StringList `json:"deleted,omitempty"`
Modified ModifiedOperations `json:"modified,omitempty"`
}
Operations is the diff between two sets of operations (methods)
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"` // diff of 'description' property
StyleDiff *ValueDiff `json:"style,omitempty"` // diff of 'style' property
ExplodeDiff *ValueDiff `json:"explode,omitempty"` // diff of 'explode' property
AllowEmptyValueDiff *ValueDiff `json:"allowEmptyValue,omitempty"` // diff of 'allowEmptyValue' property
AllowReservedDiff *ValueDiff `json:"allowReserved,omitempty"` // diff of 'allowReserved' property
DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` // diff of 'deprecated' property
RequiredDiff *ValueDiff `json:"required,omitempty"` // diff of 'required' property
SchemaDiff *SchemaDiff `json:"schema,omitempty"` // diff of 'schema' property
ExampleDiff *ValueDiff `json:"example,omitempty"` // diff of 'example' property
ContentDiff *ContentDiff `json:"content,omitempty"` // diff of 'content' property
}
ParameterDiff is a diff between two OAS parameters
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 the diff between two sets of parameters
type PathDiff ¶
type PathDiff struct {
Operations `json:"operations,omitempty"`
}
PathDiff is the diff between two OAS paths
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 paths
type ResponseDiff ¶ added in v0.1.5
type ResponseDiff struct {
// ExtensionProps
DescriptionDiff *ValueDiff `json:"description,omitempty"` // diff of 'description' property
HeadersDiff *HeadersDiff `json:"headers,omitempty"` // diff of 'headers' property
ContentDiff *ContentDiff `json:"content,omitempty"` // diff of 'content' property
}
ResponseDiff is a diff between two OAS responses
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 responses
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"` // whether 'oneOf' property was modified or not
AnyOfDiff bool `json:"anyOf,omitempty"` // whether 'anyOf' property was modified or not
AllOfDiff bool `json:"allOf,omitempty"` // whether 'allOf' property was modified or not
NotDiff bool `json:"not,omitempty"` // whether 'not' property was modified or not
TypeDiff *ValueDiff `json:"type,omitempty"` // diff of 'type' property
TitleDiff *ValueDiff `json:"title,omitempty"` // diff of 'title' property
FormatDiff *ValueDiff `json:"format,omitempty"` // diff of 'format' property
DescriptionDiff *ValueDiff `json:"description,omitempty"` // diff of 'description' property
EnumDiff *EnumDiff `json:"enum,omitempty"` // diff of 'enum' property
DefaultDiff *ValueDiff `json:"default,omitempty"` // diff of 'default' property
ExampleDiff *ValueDiff `json:"example,omitempty"` // diff of 'example' property
AdditionalPropertiesAllowedDiff *ValueDiff `json:"additionalPropertiesAllowed,omitempty"` // diff of 'additionalPropertiesAllowed' property
UniqueItemsDiff *ValueDiff `json:"uniqueItems,omitempty"` // diff of 'uniqueItems' property
ExclusiveMinDiff *ValueDiff `json:"exclusiveMin,omitempty"` // diff of 'exclusiveMin' property
ExclusiveMaxDiff *ValueDiff `json:"exclusiveMax,omitempty"` // diff of 'exclusiveMax' property
NullableDiff *ValueDiff `json:"nullable,omitempty"` // diff of 'nullable' property
ReadOnlyDiff *ValueDiff `json:"readOnly,omitempty"` // diff of 'readOnly' property
WriteOnlyDiff *ValueDiff `json:"writeOnly,omitempty"` // diff of 'writeOnly' property
AllowEmptyValueDiff *ValueDiff `json:"allowEmptyValue,omitempty"` // diff of 'allowEmptyValue' property
XMLDiff *ValueDiff `json:"XML,omitempty"` // diff of 'XML' property
DeprecatedDiff *ValueDiff `json:"deprecated,omitempty"` // diff of 'deprecated' property
MinDiff *ValueDiff `json:"min,omitempty"` // diff of 'min' property
MaxDiff *ValueDiff `json:"max,omitempty"` // diff of 'max' property
MultipleOf *ValueDiff `json:"multipleOf,omitempty"` // diff of 'multipleOf' property
MinLength *ValueDiff `json:"minLength,omitempty"` // diff of 'minLength' property
MaxLength *ValueDiff `json:"maxLength,omitempty"` // diff of 'maxLength' property
Pattern *ValueDiff `json:"pattern,omitempty"` // diff of 'pattern' property
MinItems *ValueDiff `json:"minItems,omitempty"` // diff of 'minItems' property
MaxItems *ValueDiff `json:"maxItems,omitempty"` // diff of 'maxItems' property
Items bool `json:"items,omitempty"` // whether 'items' property was modified or not
Required *StringsDiff `json:"required,omitempty"` // diff of 'required' property
PropertiesDiff *SchemasDiff `json:"properties,omitempty"` // diff of 'properties' property
MinProps *ValueDiff `json:"minProps,omitempty"` // diff of 'minProps' property
MaxProps *ValueDiff `json:"maxProps,omitempty"` // diff of 'maxProps' property
AdditionalProperties bool `json:"additionalProperties,omitempty"` // whether 'additionalProperties' property was modified or not
}
SchemaDiff is a diff between two OAS schemas
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 schemas
type SpecDiff ¶ added in v0.1.9
type SpecDiff struct {
PathsDiff *PathsDiff `json:"paths,omitempty"` // deep diff of paths including their schemas, parameters, responses etc.
TagsDiff *TagsDiff `json:"tags,omitempty"` // diff of tags
SchemasDiff *SchemasDiff `json:"schemas,omitempty"` // diff of top-level schemas (under components)
ParametersDiff *ParametersDiff `json:"parameters,omitempty"` // diff of top-level parameters (under components)
HeadersDiff *HeadersDiff `json:"headers,omitempty"` // diff of top-level headers (under components)
ResponsesDiff *ResponsesDiff `json:"responses,omitempty"` // diff of top-level responses (under components)
CallbacksDiff *CallbacksDiff `json:"callbacks,omitempty"` // diff of top-level callbacks (under components)
}
SpecDiff describes the changes between two OAS specs
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[string]*SummaryDetails `json:"components,omitempty"`
}
Summary summarizes the changes between two OAS specs
type SummaryDetails ¶ added in v0.1.8
type SummaryDetails struct {
Added int `json:"added,omitempty"` // how many items were added
Deleted int `json:"deleted,omitempty"` // how many items were deleted
Modified int `json:"modified,omitempty"` // how many items were modified
}
SummaryDetails summarizes the changes between equivalent parts of the two OAS spec: paths, schemas, parameters, headers, responses etc.
type TagDiff ¶ added in v0.1.11
type TagDiff struct {
NameDiff *ValueDiff `json:"name,omitempty"` // diff of 'name' property
DescriptionDiff *ValueDiff `json:"description,omitempty"` // diff of 'description' property
}
TagDiff is a diff between two top-level OAS tags
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 sets of global OAS tags
Source Files
¶
- callbacks_diff.go
- content_diff.go
- diff.go
- diff_endpoints.go
- doc.go
- enum_diff.go
- header_diff.go
- headers_diff.go
- method_diff.go
- modified_operations.go
- modified_paths.go
- modified_schemas.go
- parameter_diff.go
- parameters_aux.go
- parameters_diff.go
- path_diff.go
- paths_diff.go
- response_diff.go
- responses_diff.go
- schema_diff.go
- schemas_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