mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-10 04:20:24 +00:00
Added what-changed documentation to methods and structs.
Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
@@ -8,11 +8,13 @@ import (
|
||||
"github.com/pb33f/libopenapi/datamodel/low/v3"
|
||||
)
|
||||
|
||||
// ServerChanges represents changes found between two OpenAPI Server Objects
|
||||
type ServerChanges struct {
|
||||
PropertyChanges
|
||||
ServerVariableChanges map[string]*ServerVariableChanges `json:"serverVariables,omitempty" yaml:"serverVariables,omitempty"`
|
||||
}
|
||||
|
||||
// TotalChanges returns total changes found between two OpenAPI Server Objects
|
||||
func (s *ServerChanges) TotalChanges() int {
|
||||
c := s.PropertyChanges.TotalChanges()
|
||||
for k := range s.ServerVariableChanges {
|
||||
@@ -21,6 +23,7 @@ func (s *ServerChanges) TotalChanges() int {
|
||||
return c
|
||||
}
|
||||
|
||||
// TotalBreakingChanges returns the total number of breaking changes found between two OpenAPI Server objects.
|
||||
func (s *ServerChanges) TotalBreakingChanges() int {
|
||||
c := s.PropertyChanges.TotalBreakingChanges()
|
||||
for k := range s.ServerVariableChanges {
|
||||
@@ -29,6 +32,8 @@ func (s *ServerChanges) TotalBreakingChanges() int {
|
||||
return c
|
||||
}
|
||||
|
||||
// CompareServers compares two OpenAPI Server objects for any changes. If anything is found, returns a pointer
|
||||
// to a ServerChanges instance, or returns nil if nothing is found.
|
||||
func CompareServers(l, r *v3.Server) *ServerChanges {
|
||||
if low.AreEqual(l, r) {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user