From d661153e8017041ab951eb03e7cc6b05e38a01fe Mon Sep 17 00:00:00 2001 From: Emilien Puget Date: Sat, 15 Jun 2024 09:35:10 +0200 Subject: [PATCH] removed golang x package in favour of the std lib --- datamodel/high/base/schema.go | 1 + datamodel/high/base/schema_test.go | 1 - datamodel/high/base/security_requirement.go | 6 +++--- datamodel/low/extraction_functions_test.go | 4 ++-- datamodel/low/reference_test.go | 3 +-- datamodel/low/v3/create_document.go | 2 +- datamodel/spec_info.go | 5 +++-- document_iteration_test.go | 2 +- go.mod | 2 -- go.sum | 4 ---- index/extract_refs.go | 2 +- index/index_model.go | 9 ++++----- index/resolver.go | 3 +-- index/rolodex_file_loader.go | 6 +++--- index/rolodex_remote_loader.go | 10 +++++----- index/spec_index.go | 3 +-- index/spec_index_test.go | 4 ++-- renderer/mock_generator_test.go | 5 +++-- renderer/schema_renderer.go | 2 +- what-changed/model/callback_test.go | 3 ++- what-changed/model/change_types.go | 1 + what-changed/model/comparison_functions.go | 3 +-- what-changed/model/components_test.go | 3 ++- what-changed/model/contact_test.go | 3 ++- what-changed/model/discriminator_test.go | 3 ++- what-changed/model/example.go | 3 +-- what-changed/model/example_test.go | 5 ++--- what-changed/model/external_docs_test.go | 3 ++- what-changed/model/header.go | 3 ++- what-changed/model/header_test.go | 3 ++- what-changed/model/items_test.go | 3 ++- what-changed/model/license_test.go | 3 ++- what-changed/model/link_test.go | 3 ++- what-changed/model/media_type_test.go | 3 ++- what-changed/model/oauth_flows_test.go | 3 ++- what-changed/model/parameter_test.go | 3 ++- what-changed/model/paths_test.go | 3 ++- what-changed/model/schema.go | 3 +-- what-changed/model/schema_test.go | 3 +-- what-changed/model/security_requirement_test.go | 3 ++- what-changed/model/security_scheme.go | 3 ++- what-changed/model/security_scheme_test.go | 3 ++- what-changed/model/server_test.go | 3 ++- what-changed/model/tags_test.go | 3 ++- 44 files changed, 78 insertions(+), 71 deletions(-) diff --git a/datamodel/high/base/schema.go b/datamodel/high/base/schema.go index 4a02ae7d..f0b13d98 100644 --- a/datamodel/high/base/schema.go +++ b/datamodel/high/base/schema.go @@ -5,6 +5,7 @@ package base import ( "encoding/json" + "github.com/pb33f/libopenapi/datamodel/high" lowmodel "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/base" diff --git a/datamodel/high/base/schema_test.go b/datamodel/high/base/schema_test.go index 99a7651c..a075914b 100644 --- a/datamodel/high/base/schema_test.go +++ b/datamodel/high/base/schema_test.go @@ -10,7 +10,6 @@ import ( "testing" "github.com/pb33f/libopenapi/datamodel" - "github.com/pb33f/libopenapi/datamodel/low" lowbase "github.com/pb33f/libopenapi/datamodel/low/base" "github.com/pb33f/libopenapi/index" diff --git a/datamodel/high/base/security_requirement.go b/datamodel/high/base/security_requirement.go index 9e0881c9..3b346583 100644 --- a/datamodel/high/base/security_requirement.go +++ b/datamodel/high/base/security_requirement.go @@ -21,9 +21,9 @@ import ( // The name used for each property MUST correspond to a security scheme declared in the Security Definitions // - https://swagger.io/specification/v2/#securityDefinitionsObject type SecurityRequirement struct { - Requirements *orderedmap.Map[string, []string] `json:"-" yaml:"-"` - ContainsEmptyRequirement bool // if a requirement is empty (this means it's optional) - low *base.SecurityRequirement + Requirements *orderedmap.Map[string, []string] `json:"-" yaml:"-"` + ContainsEmptyRequirement bool // if a requirement is empty (this means it's optional) + low *base.SecurityRequirement } // NewSecurityRequirement creates a new high-level SecurityRequirement from a low-level one. diff --git a/datamodel/low/extraction_functions_test.go b/datamodel/low/extraction_functions_test.go index d5685ccd..9ade2896 100644 --- a/datamodel/low/extraction_functions_test.go +++ b/datamodel/low/extraction_functions_test.go @@ -12,9 +12,9 @@ import ( "path/filepath" "runtime" "strings" + "sync" "testing" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" "github.com/pb33f/libopenapi/index" @@ -1901,7 +1901,7 @@ func TestLocateRefNode_DoARealLookup(t *testing.T) { idx := index.NewSpecIndexWithConfig(&rootNode, cf) // fake cache to a lookup for a file that does not exist will work. - fakeCache := new(syncmap.Map) + fakeCache := new(sync.Map) fakeCache.Store(lookup, &index.Reference{Node: &no, Index: idx}) idx.SetCache(fakeCache) diff --git a/datamodel/low/reference_test.go b/datamodel/low/reference_test.go index e80436aa..b7853fb0 100644 --- a/datamodel/low/reference_test.go +++ b/datamodel/low/reference_test.go @@ -9,9 +9,8 @@ import ( "strings" "testing" - "github.com/pb33f/libopenapi/utils" - "github.com/pb33f/libopenapi/index" + "github.com/pb33f/libopenapi/utils" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" diff --git a/datamodel/low/v3/create_document.go b/datamodel/low/v3/create_document.go index 3ccd6495..0f68d399 100644 --- a/datamodel/low/v3/create_document.go +++ b/datamodel/low/v3/create_document.go @@ -5,6 +5,7 @@ import ( "errors" "path/filepath" "sync" + "time" "github.com/pb33f/libopenapi/datamodel" "github.com/pb33f/libopenapi/datamodel/low" @@ -12,7 +13,6 @@ import ( "github.com/pb33f/libopenapi/index" "github.com/pb33f/libopenapi/orderedmap" "github.com/pb33f/libopenapi/utils" - "time" ) // CreateDocument will create a new Document instance from the provided SpecInfo. diff --git a/datamodel/spec_info.go b/datamodel/spec_info.go index 904cbd5a..e801becd 100644 --- a/datamodel/spec_info.go +++ b/datamodel/spec_info.go @@ -7,10 +7,11 @@ import ( "encoding/json" "errors" "fmt" - "github.com/pb33f/libopenapi/utils" - "gopkg.in/yaml.v3" "strings" "time" + + "github.com/pb33f/libopenapi/utils" + "gopkg.in/yaml.v3" ) const ( diff --git a/document_iteration_test.go b/document_iteration_test.go index 500225bb..ccd0535c 100644 --- a/document_iteration_test.go +++ b/document_iteration_test.go @@ -10,7 +10,7 @@ import ( v3 "github.com/pb33f/libopenapi/datamodel/high/v3" "github.com/pb33f/libopenapi/orderedmap" "github.com/stretchr/testify/require" - "golang.org/x/exp/slices" + "slices" ) type loopFrame struct { diff --git a/go.mod b/go.mod index a1e259fd..eaab11e5 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,6 @@ require ( github.com/stretchr/testify v1.8.4 github.com/vmware-labs/yaml-jsonpath v0.3.2 github.com/wk8/go-ordered-map/v2 v2.1.8 - golang.org/x/exp v0.0.0-20240213143201-ec583247a57a - golang.org/x/sync v0.6.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 55377f93..3734334e 100644 --- a/go.sum +++ b/go.sum @@ -73,8 +73,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= -golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -87,8 +85,6 @@ golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/index/extract_refs.go b/index/extract_refs.go index deddc1ef..d769da08 100644 --- a/index/extract_refs.go +++ b/index/extract_refs.go @@ -12,8 +12,8 @@ import ( "strings" "github.com/pb33f/libopenapi/utils" - "golang.org/x/exp/slices" "gopkg.in/yaml.v3" + "slices" ) // ExtractRefs will return a deduplicated slice of references for every unique ref found in the document. diff --git a/index/index_model.go b/index/index_model.go index d42c6075..623262bc 100644 --- a/index/index_model.go +++ b/index/index_model.go @@ -11,7 +11,6 @@ import ( "sync" "github.com/pb33f/libopenapi/datamodel" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" ) @@ -236,7 +235,7 @@ type SpecIndex struct { allRefSchemaDefinitions []*Reference // all schemas found that are references. allInlineSchemaDefinitions []*Reference // all schemas found in document outside of components (openapi) or definitions (swagger). allInlineSchemaObjectDefinitions []*Reference // all schemas that are objects found in document outside of components (openapi) or definitions (swagger). - allComponentSchemaDefinitions *syncmap.Map // all schemas found in components (openapi) or definitions (swagger). + allComponentSchemaDefinitions *sync.Map // all schemas found in components (openapi) or definitions (swagger). securitySchemesNode *yaml.Node // components/securitySchemes node allSecuritySchemes map[string]*Reference // all security schemes / definitions. requestBodiesNode *yaml.Node // components/requestBodies node @@ -273,7 +272,7 @@ type SpecIndex struct { componentIndexChan chan bool polyComponentIndexChan chan bool resolver *Resolver - cache *syncmap.Map + cache *sync.Map built bool uri []string logger *slog.Logger @@ -292,7 +291,7 @@ func (index *SpecIndex) GetConfig() *SpecIndexConfig { return index.config } -func (index *SpecIndex) SetCache(sync *syncmap.Map) { +func (index *SpecIndex) SetCache(sync *sync.Map) { index.cache = sync } @@ -300,7 +299,7 @@ func (index *SpecIndex) GetNodeMap() map[int]map[int]*yaml.Node { return index.nodeMap } -func (index *SpecIndex) GetCache() *syncmap.Map { +func (index *SpecIndex) GetCache() *sync.Map { return index.cache } diff --git a/index/resolver.go b/index/resolver.go index 022d80cf..139227ff 100644 --- a/index/resolver.go +++ b/index/resolver.go @@ -11,8 +11,8 @@ import ( "strings" "github.com/pb33f/libopenapi/utils" - "golang.org/x/exp/slices" "gopkg.in/yaml.v3" + "slices" ) // ResolvingError represents an issue the resolver had trying to stitch the tree together. @@ -521,7 +521,6 @@ func (resolver *Resolver) extractRelatives(ref *Reference, node, parent *yaml.No continue } - value := node.Content[i+1].Value value = strings.ReplaceAll(value, "\\\\", "\\") var locatedRef *Reference diff --git a/index/rolodex_file_loader.go b/index/rolodex_file_loader.go index 3ded3e5e..9b106168 100644 --- a/index/rolodex_file_loader.go +++ b/index/rolodex_file_loader.go @@ -13,9 +13,9 @@ import ( "slices" "strings" "time" + "sync" "github.com/pb33f/libopenapi/datamodel" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" ) @@ -25,12 +25,12 @@ type LocalFS struct { indexConfig *SpecIndexConfig entryPointDirectory string baseDirectory string - Files syncmap.Map + Files sync.Map extractedFiles map[string]RolodexFile logger *slog.Logger readingErrors []error rolodex *Rolodex - processingFiles syncmap.Map + processingFiles sync.Map } // GetFiles returns the files that have been indexed. A map of RolodexFile objects keyed by the full path of the file. diff --git a/index/rolodex_remote_loader.go b/index/rolodex_remote_loader.go index 7d109c04..ab6a8e65 100644 --- a/index/rolodex_remote_loader.go +++ b/index/rolodex_remote_loader.go @@ -18,8 +18,8 @@ import ( "github.com/pb33f/libopenapi/datamodel" "github.com/pb33f/libopenapi/utils" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" + "sync" ) const ( @@ -38,8 +38,8 @@ type RemoteFS struct { rootURL string rootURLParsed *url.URL RemoteHandlerFunc utils.RemoteURLHandler - Files syncmap.Map - ProcessingFiles syncmap.Map + Files sync.Map + ProcessingFiles sync.Map FetchTime int64 FetchChannel chan *RemoteFile remoteErrors []error @@ -344,10 +344,10 @@ func (i *RemoteFS) Open(remoteURL string) (fs.File, error) { remoteParsedURL.Host = i.rootURLParsed.Host remoteParsedURL.Scheme = i.rootURLParsed.Scheme // this has been disabled, because I don't think it has value, it causes more problems than it solves currently. - //if !strings.HasPrefix(remoteParsedURL.Path, "/") { + // if !strings.HasPrefix(remoteParsedURL.Path, "/") { // remoteParsedURL.Path = filepath.Join(i.rootURLParsed.Path, remoteParsedURL.Path) // remoteParsedURL.Path = strings.ReplaceAll(remoteParsedURL.Path, "\\", "/") - //} + // } } if remoteParsedURL.Scheme == "" { diff --git a/index/spec_index.go b/index/spec_index.go index 75cbcda5..7a74222f 100644 --- a/index/spec_index.go +++ b/index/spec_index.go @@ -22,7 +22,6 @@ import ( "github.com/pb33f/libopenapi/utils" "github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath" - "golang.org/x/sync/syncmap" "gopkg.in/yaml.v3" ) @@ -73,7 +72,7 @@ func createNewIndex(rootNode *yaml.Node, index *SpecIndex, avoidBuildOut bool) * index.nodeMap = make(map[int]map[int]*yaml.Node) go index.MapNodes(rootNode) // this can run async. - index.cache = new(syncmap.Map) + index.cache = new(sync.Map) // boot index. results := index.ExtractRefs(index.root.Content[0], index.root, []string{}, 0, false, "") diff --git a/index/spec_index_test.go b/index/spec_index_test.go index 062f8699..e99dd609 100644 --- a/index/spec_index_test.go +++ b/index/spec_index_test.go @@ -19,10 +19,10 @@ import ( "time" "github.com/pb33f/libopenapi/utils" - "golang.org/x/sync/syncmap" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" + "sync" ) const ( @@ -44,7 +44,7 @@ func TestSpecIndex_GetCache(t *testing.T) { assert.True(t, ok) // create a new cache - newCache := new(syncmap.Map) + newCache := new(sync.Map) index.SetCache(newCache) // check that the cache has been set. diff --git a/renderer/mock_generator_test.go b/renderer/mock_generator_test.go index db97d65d..efe03f53 100644 --- a/renderer/mock_generator_test.go +++ b/renderer/mock_generator_test.go @@ -6,6 +6,9 @@ package renderer import ( "context" "encoding/json" + "strings" + "testing" + "github.com/pb33f/libopenapi/datamodel/high/base" "github.com/pb33f/libopenapi/datamodel/low" lowbase "github.com/pb33f/libopenapi/datamodel/low/base" @@ -14,8 +17,6 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" - "strings" - "testing" ) type fakeMockable struct { diff --git a/renderer/schema_renderer.go b/renderer/schema_renderer.go index 7ceebb99..2a63bdcb 100644 --- a/renderer/schema_renderer.go +++ b/renderer/schema_renderer.go @@ -10,13 +10,13 @@ import ( "io" "math/rand" "os" + "slices" "strings" "time" "github.com/lucasjones/reggen" "github.com/pb33f/libopenapi/datamodel/high/base" "github.com/pb33f/libopenapi/orderedmap" - "golang.org/x/exp/slices" ) const ( diff --git a/what-changed/model/callback_test.go b/what-changed/model/callback_test.go index efa64f41..1936ad2a 100644 --- a/what-changed/model/callback_test.go +++ b/what-changed/model/callback_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareCallback(t *testing.T) { diff --git a/what-changed/model/change_types.go b/what-changed/model/change_types.go index c9c12dbb..7a0da924 100644 --- a/what-changed/model/change_types.go +++ b/what-changed/model/change_types.go @@ -5,6 +5,7 @@ package model import ( "encoding/json" + "gopkg.in/yaml.v3" ) diff --git a/what-changed/model/comparison_functions.go b/what-changed/model/comparison_functions.go index a83ead2f..9717730f 100644 --- a/what-changed/model/comparison_functions.go +++ b/what-changed/model/comparison_functions.go @@ -9,10 +9,9 @@ import ( "strings" "sync" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/orderedmap" "github.com/pb33f/libopenapi/utils" - - "github.com/pb33f/libopenapi/datamodel/low" "gopkg.in/yaml.v3" ) diff --git a/what-changed/model/components_test.go b/what-changed/model/components_test.go index fb793013..a903d9b4 100644 --- a/what-changed/model/components_test.go +++ b/what-changed/model/components_test.go @@ -5,13 +5,14 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" v2 "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/pb33f/libopenapi/index" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareComponents_Swagger_Definitions_Equal(t *testing.T) { diff --git a/what-changed/model/contact_test.go b/what-changed/model/contact_test.go index 1f77dcd9..57b4f0e8 100644 --- a/what-changed/model/contact_test.go +++ b/what-changed/model/contact_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" lowbase "github.com/pb33f/libopenapi/datamodel/low/base" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareContact_URLAdded(t *testing.T) { diff --git a/what-changed/model/discriminator_test.go b/what-changed/model/discriminator_test.go index 085007dd..74bbf43f 100644 --- a/what-changed/model/discriminator_test.go +++ b/what-changed/model/discriminator_test.go @@ -4,11 +4,12 @@ package model import ( + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/base" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareDiscriminator_PropertyNameChanged(t *testing.T) { diff --git a/what-changed/model/example.go b/what-changed/model/example.go index cf0839c7..ab010869 100644 --- a/what-changed/model/example.go +++ b/what-changed/model/example.go @@ -8,11 +8,10 @@ import ( "fmt" "sort" - "gopkg.in/yaml.v3" - "github.com/pb33f/libopenapi/datamodel/low/base" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/pb33f/libopenapi/utils" + "gopkg.in/yaml.v3" ) // ExampleChanges represent changes to an Example object, part of an OpenAPI specification. diff --git a/what-changed/model/example_test.go b/what-changed/model/example_test.go index e97f819a..a0aa64f8 100644 --- a/what-changed/model/example_test.go +++ b/what-changed/model/example_test.go @@ -7,12 +7,11 @@ import ( "context" "testing" - "github.com/stretchr/testify/assert" - "gopkg.in/yaml.v3" - "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/base" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" + "github.com/stretchr/testify/assert" + "gopkg.in/yaml.v3" ) func TestCompareExamples_SummaryModified(t *testing.T) { diff --git a/what-changed/model/external_docs_test.go b/what-changed/model/external_docs_test.go index df2fa4bb..58dc13f5 100644 --- a/what-changed/model/external_docs_test.go +++ b/what-changed/model/external_docs_test.go @@ -5,12 +5,13 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" lowbase "github.com/pb33f/libopenapi/datamodel/low/base" lowv3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareExternalDocs(t *testing.T) { diff --git a/what-changed/model/header.go b/what-changed/model/header.go index c2a63d28..3690a19a 100644 --- a/what-changed/model/header.go +++ b/what-changed/model/header.go @@ -4,10 +4,11 @@ package model import ( + "reflect" + "github.com/pb33f/libopenapi/datamodel/low" v2 "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" - "reflect" ) // HeaderChanges represents changes made between two Header objects. Supports both Swagger and OpenAPI header diff --git a/what-changed/model/header_test.go b/what-changed/model/header_test.go index c6d6a4bd..b387644c 100644 --- a/what-changed/model/header_test.go +++ b/what-changed/model/header_test.go @@ -5,12 +5,13 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func test_buildUltraGlobOfHeaders() string { diff --git a/what-changed/model/items_test.go b/what-changed/model/items_test.go index 3f2b09b0..a07d9655 100644 --- a/what-changed/model/items_test.go +++ b/what-changed/model/items_test.go @@ -5,12 +5,13 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareItems(t *testing.T) { diff --git a/what-changed/model/license_test.go b/what-changed/model/license_test.go index 56ced0d0..bd2f5c9f 100644 --- a/what-changed/model/license_test.go +++ b/what-changed/model/license_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" lowbase "github.com/pb33f/libopenapi/datamodel/low/base" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareLicense_URLAdded(t *testing.T) { diff --git a/what-changed/model/link_test.go b/what-changed/model/link_test.go index 4723fecf..d4d7fa5f 100644 --- a/what-changed/model/link_test.go +++ b/what-changed/model/link_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareLinks(t *testing.T) { diff --git a/what-changed/model/media_type_test.go b/what-changed/model/media_type_test.go index eb98ad39..8e569e3f 100644 --- a/what-changed/model/media_type_test.go +++ b/what-changed/model/media_type_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareMediaTypes(t *testing.T) { diff --git a/what-changed/model/oauth_flows_test.go b/what-changed/model/oauth_flows_test.go index 12c1fb5a..e73af21f 100644 --- a/what-changed/model/oauth_flows_test.go +++ b/what-changed/model/oauth_flows_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareOAuthFlow(t *testing.T) { diff --git a/what-changed/model/parameter_test.go b/what-changed/model/parameter_test.go index f569f468..01f2a15e 100644 --- a/what-changed/model/parameter_test.go +++ b/what-changed/model/parameter_test.go @@ -5,12 +5,13 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareParameters(t *testing.T) { diff --git a/what-changed/model/paths_test.go b/what-changed/model/paths_test.go index deda4d72..05014f01 100644 --- a/what-changed/model/paths_test.go +++ b/what-changed/model/paths_test.go @@ -5,12 +5,13 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestComparePaths_v2(t *testing.T) { diff --git a/what-changed/model/schema.go b/what-changed/model/schema.go index 0c481deb..a0310ee8 100644 --- a/what-changed/model/schema.go +++ b/what-changed/model/schema.go @@ -5,11 +5,10 @@ package model import ( "fmt" + "slices" "sort" "sync" - "golang.org/x/exp/slices" - "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/base" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" diff --git a/what-changed/model/schema_test.go b/what-changed/model/schema_test.go index 4c00ac93..6127a866 100644 --- a/what-changed/model/schema_test.go +++ b/what-changed/model/schema_test.go @@ -7,13 +7,12 @@ import ( "fmt" "testing" - "github.com/pb33f/libopenapi/utils" - "github.com/pb33f/libopenapi/datamodel" "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/base" v2 "github.com/pb33f/libopenapi/datamodel/low/v2" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" + "github.com/pb33f/libopenapi/utils" "github.com/stretchr/testify/assert" ) diff --git a/what-changed/model/security_requirement_test.go b/what-changed/model/security_requirement_test.go index 39b1e646..eaabee79 100644 --- a/what-changed/model/security_requirement_test.go +++ b/what-changed/model/security_requirement_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/base" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareSecurityRequirement_V2(t *testing.T) { diff --git a/what-changed/model/security_scheme.go b/what-changed/model/security_scheme.go index fb24b71b..8ab38ea5 100644 --- a/what-changed/model/security_scheme.go +++ b/what-changed/model/security_scheme.go @@ -4,10 +4,11 @@ package model import ( + "reflect" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" - "reflect" ) // SecuritySchemeChanges represents changes made between Swagger or OpenAPI SecurityScheme Objects. diff --git a/what-changed/model/security_scheme_test.go b/what-changed/model/security_scheme_test.go index 989ae282..7b6fefaa 100644 --- a/what-changed/model/security_scheme_test.go +++ b/what-changed/model/security_scheme_test.go @@ -5,12 +5,13 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" "github.com/pb33f/libopenapi/datamodel/low/v2" "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareSecuritySchemes_v2(t *testing.T) { diff --git a/what-changed/model/server_test.go b/what-changed/model/server_test.go index 8e83be9c..b89423e9 100644 --- a/what-changed/model/server_test.go +++ b/what-changed/model/server_test.go @@ -5,11 +5,12 @@ package model import ( "context" + "testing" + "github.com/pb33f/libopenapi/datamodel/low" v3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" "gopkg.in/yaml.v3" - "testing" ) func TestCompareServers(t *testing.T) { diff --git a/what-changed/model/tags_test.go b/what-changed/model/tags_test.go index c84cebfd..19fdc4e8 100644 --- a/what-changed/model/tags_test.go +++ b/what-changed/model/tags_test.go @@ -4,10 +4,11 @@ package model import ( + "testing" + "github.com/pb33f/libopenapi/datamodel" lowv3 "github.com/pb33f/libopenapi/datamodel/low/v3" "github.com/stretchr/testify/assert" - "testing" ) func TestCompareTags(t *testing.T) {