github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/cmd/swagger/commands/diff/difference_location.go (about)

     1  package diff
     2  
     3  // DifferenceLocation indicates where the difference occurs
     4  type DifferenceLocation struct {
     5  	URL      string `json:"url"`
     6  	Method   string `json:"method,omitempty"`
     7  	Response int    `json:"response,omitempty"`
     8  	Node     *Node  `json:"node,omitempty"`
     9  }
    10  
    11  // AddNode returns a copy of this location with the leaf node added
    12  func (dl DifferenceLocation) AddNode(node *Node) DifferenceLocation {
    13  	newLoc := dl
    14  
    15  	if newLoc.Node != nil {
    16  		newLoc.Node = newLoc.Node.Copy()
    17  		newLoc.Node.AddLeafNode(node)
    18  	} else {
    19  		newLoc.Node = node
    20  	}
    21  	return newLoc
    22  }