mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-07 20:47:45 +00:00
Refactored what-changed core code to be ready for buildout.
The designs and patterns are set, the way forward for low-level models is clear. Documentation and cleanliness will now be a side by side process as the rest is built out. Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
@@ -8,11 +8,13 @@ import (
|
||||
lowv3 "github.com/pb33f/libopenapi/datamodel/low/v3"
|
||||
)
|
||||
|
||||
// ExternalDocChanges represents changes made to any ExternalDoc object from an OpenAPI document.
|
||||
type ExternalDocChanges struct {
|
||||
PropertyChanges[*lowbase.ExternalDoc]
|
||||
ExtensionChanges *ExtensionChanges
|
||||
}
|
||||
|
||||
// TotalChanges returns a count of everything that changed
|
||||
func (e *ExternalDocChanges) TotalChanges() int {
|
||||
c := len(e.Changes)
|
||||
if e.ExtensionChanges != nil {
|
||||
@@ -21,6 +23,9 @@ func (e *ExternalDocChanges) TotalChanges() int {
|
||||
return c
|
||||
}
|
||||
|
||||
// CompareExternalDocs will compare a left (original) and a right (new) slice of ValueReference
|
||||
// nodes for any changes between them. If there are changes, then a pointer to ExternalDocChanges
|
||||
// is returned, otherwise if nothing changed - then nil is returned.
|
||||
func CompareExternalDocs(l, r *lowbase.ExternalDoc) *ExternalDocChanges {
|
||||
var changes []*Change[*lowbase.ExternalDoc]
|
||||
var props []*PropertyCheck[*lowbase.ExternalDoc]
|
||||
|
||||
Reference in New Issue
Block a user