diff

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentDiff

type ContentDiff struct {
	MediaTypeAdded   bool `json:"mediaTypeAdded,omitempty"`
	MediaTypeDeleted bool `json:"mediaTypeDeleted,omitempty"`
	MediaTypeDiff    bool `json:"mediaTypeDiff,omitempty"`

	SchemaDiff *SchemaDiff `json:"schemaDiff,omitempty"`
}

type DiffResponse

type DiffResponse struct {
	DiffResult  *DiffResult  `json:"diffResult,omitempty"`
	DiffSummary *DiffSummary `json:"diffSummary,omitempty"`
}

func GetDiffResponse

func GetDiffResponse(s1 *openapi3.Swagger, s2 *openapi3.Swagger, prefix string, filter string) DiffResponse

GetDiffResponse returns the diff between two OAS (swagger) specs including a diff summary

type DiffResult

type DiffResult struct {
	PathDiff   *PathDiff             `json:"pathDiff,omitempty"`
	SchemaDiff *SchemaCollectionDiff `json:"schemaDiff,omitempty"`
}

func Diff

func Diff(s1 *openapi3.Swagger, s2 *openapi3.Swagger, prefix string) *DiffResult

Diff returns the diff between two OAS (swagger) specs

func (*DiffResult) FilterByRegex

func (diffResult *DiffResult) FilterByRegex(filter string)

FilterByRegex filters diff endpoints by regex

type DiffSummary

type DiffSummary struct {
	Diff bool `json:"diff"`
	PathDiffSummary
	SchemaDiffSummary
}

type EndpointDiff

type EndpointDiff struct {
	AddedOperations    OperationMap       `json:"addedMethods,omitempty"`
	DeletedOperations  OperationMap       `json:"deletedMethods,omitempty"`
	ModifiedOperations ModifiedOperations `json:"modifiedMethods,omitempty"`
}

type MethodDiff

type MethodDiff struct {
	AddedParams    map[string]ParamNames `json:"addedParams,omitempty"`    // key is param location (path, query, header or cookie)
	DeletedParams  map[string]ParamNames `json:"deletedParams,omitempty"`  // key is param location
	ModifiedParams map[string]ParamDiffs `json:"modifiedParams,omitempty"` // key is param location
}

type ModifiedEndpoints

type ModifiedEndpoints map[string]*EndpointDiff // key is endpoint (path)

type ModifiedOperations

type ModifiedOperations map[string]*MethodDiff // key is HTTP method

type ModifiedSchemas

type ModifiedSchemas map[string]*SchemaDiff

type OperationMap

type OperationMap map[string]struct{}

type ParamDiff

type ParamDiff struct {
	DescriptionDiff     *ValueDiff   `json:"descriptionDiff,omitempty"`
	StyleDiff           *ValueDiff   `json:"styleDiff,omitempty"`
	ExplodeDiff         *ValueDiff   `json:"explodeDiff,omitempty"`
	AllowEmptyValueDiff *ValueDiff   `json:"allow_empty_valueDiff,omitempty"`
	AllowReservedDiff   *ValueDiff   `json:"allow_reservedDiff,omitempty"`
	DeprecatedDiff      *ValueDiff   `json:"deprecatedDiff,omitempty"`
	RequiredDiff        *ValueDiff   `json:"requiredDiff,omitempty"`
	SchemaDiff          *SchemaDiff  `json:"schemaDiff,omitempty"`
	ContentDiff         *ContentDiff `json:"contentDiff,omitempty"`
}

type ParamDiffs

type ParamDiffs map[string]ParamDiff // key is param name

type ParamNames

type ParamNames map[string]struct{} // key is param name

type PathDiff

type PathDiff struct {
	AddedEndpoints    []string          `json:"addedEndpoints,omitempty"`
	DeletedEndpoints  []string          `json:"deletedEndpoints,omitempty"`
	ModifiedEndpoints ModifiedEndpoints `json:"modifiedEndpoints,omitempty"`
}

type PathDiffSummary

type PathDiffSummary struct {
	AddedEndpoints    int `json:"addedEndpoints"`
	DeletedEndpoints  int `json:"deletedEndpoints"`
	ModifiedEndpoints int `json:"modifiedEndpoints"`
}

type SchemaCollectionDiff

type SchemaCollectionDiff struct {
	AddedSchemas    []string        `json:"addedSchemas,omitempty"`
	DeletedSchemas  []string        `json:"deletedSchemas,omitempty"`
	ModifiedSchemas ModifiedSchemas `json:"modifiedSchemas,omitempty"`
}

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:"oneOfDiff,omitempty"`
	AnyOfDiff                       bool       `json:"anyOfDiff,omitempty"`
	AllOfDiff                       bool       `json:"allOfDiff,omitempty"`
	NotDiff                         bool       `json:"notDiff,omitempty"`
	TypeDiff                        *ValueDiff `json:"typeDiff,omitempty"`
	TitleDiff                       *ValueDiff `json:"titleDiff,omitempty"`
	FormatDiff                      *ValueDiff `json:"formatDiff,omitempty"`
	DescriptionDiff                 *ValueDiff `json:"descriptionDiff,omitempty"`
	EnumDiff                        bool       `json:"enumDiff,omitempty"`
	AdditionalPropertiesAllowedDiff *ValueDiff `json:"additionalPropertiesAllowedDiff,omitempty"`
	UniqueItemsDiff                 *ValueDiff `json:"uniqueItemsDiff,omitempty"`
	ExclusiveMinDiff                *ValueDiff `json:"exclusiveMinDiff,omitempty"`
	ExclusiveMaxDiff                *ValueDiff `json:"exclusiveMaxDiff,omitempty"`
	NullableDiff                    *ValueDiff `json:"nullableDiff,omitempty"`
	ReadOnlyDiff                    *ValueDiff `json:"readOnlyDiffDiff,omitempty"`
	WriteOnlyDiff                   *ValueDiff `json:"writeOnlyDiffDiff,omitempty"`
	AllowEmptyValueDiff             *ValueDiff `json:"allowEmptyValueDiff,omitempty"`
	DeprecatedDiff                  *ValueDiff `json:"deprecatedDiff,omitempty"`
	MinDiff                         *ValueDiff `json:"minDiff,omitempty"`
	MaxDiff                         *ValueDiff `json:"maxDiff,omitempty"`
	MultipleOf                      *ValueDiff `json:"multipleOfDiff,omitempty"`
	PropertiesDiff                  bool       `json:"propertiesDiff,omitempty"`
}

type SchemaDiffSummary

type SchemaDiffSummary struct {
	AddedSchemas    int `json:"addedSchemas"`
	DeletedSchemas  int `json:"deletedSchemas"`
	ModifiedSchemas int `json:"modifiedSchemas"`
}

type ValueDiff

type ValueDiff struct {
	OldValue interface{} `json:"oldValue"`
	NewValue interface{} `json:"newValue"`
}

Jump to

Keyboard shortcuts

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