Files
libopenapi/index/circular_reference_result.go
quobix 55b6e13bb5 Some housekeeping I noticed.
Signed-off-by: quobix <dave@quobix.com>
2023-10-08 12:27:52 -04:00

29 lines
914 B
Go

package index
import "strings"
// CircularReferenceResult contains a circular reference found when traversing the graph.
type CircularReferenceResult struct {
Journey []*Reference
Start *Reference
LoopIndex int
LoopPoint *Reference
IsArrayResult bool // if this result comes from an array loop.
PolymorphicType string // which type of polymorphic loop is this? (oneOf, anyOf, allOf)
IsPolymorphicResult bool // if this result comes from a polymorphic loop.
IsInfiniteLoop bool // if all the definitions in the reference loop are marked as required, this is an infinite circular reference, thus is not allowed.
}
func (c *CircularReferenceResult) GenerateJourneyPath() string {
buf := strings.Builder{}
for i, ref := range c.Journey {
if i > 0 {
buf.WriteString(" -> ")
}
buf.WriteString(ref.Name)
}
return buf.String()
}