Skip to content

[Question]: Intentional cycles in structs #387

@DerekStrickland

Description

@DerekStrickland

We have a struct in our project that allows us to do recursive diffs on arbitrary objects. It is defined as this.

type ObjectDiff struct {
	Type    DiffType
	Name    string
	Fields  []*FieldDiff
	Objects []*ObjectDiff
}

This allows users to perform a dry-run type operation against the API to see what would change if they were to actually submit the operation.

When trying to use kin to generate an OpenAPI spec, this, of course, throws a CycleError. Is there any existing feature or configuration option that can allow us to detect the cycle and keep on processing without the infinite recursion?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions