Refactoring the what-changed again

I cannot pull these models apart, they are too inter-connected and imports will cycle.
This commit is contained in:
Dave Shanley
2022-10-23 12:14:31 -04:00
parent 1197562438
commit fcd4a0f57d
36 changed files with 407 additions and 372 deletions

View File

@@ -4,10 +4,12 @@
package v3
import (
"crypto/sha256"
"github.com/pb33f/libopenapi/datamodel/low"
"github.com/pb33f/libopenapi/index"
"github.com/pb33f/libopenapi/utils"
"gopkg.in/yaml.v3"
"strings"
)
// SecurityScheme represents a low-level OpenAPI 3+ SecurityScheme object.
@@ -68,6 +70,11 @@ func (ss *SecurityScheme) Build(root *yaml.Node, idx *index.SpecIndex) error {
return nil
}
func (ss *SecurityScheme) Hash() [32]byte {
var f []string
return sha256.Sum256([]byte(strings.Join(f, "|")))
}
// FindRequirement will attempt to locate a security requirement string from a supplied name.
func (sr *SecurityRequirement) FindRequirement(name string) []low.ValueReference[string] {
for _, r := range sr.ValueRequirements {