yonaskolb / SwagGen

OpenAPI/Swagger 3.0 Parser and Swift code generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"cyclic metadata dependency detected, aborting" on Release builds with Xcode 11.2

Przytua opened this issue · comments

This code crashes on Release builds with Xcode 11.2:

extension APIResponse {
    public func asAny() -> APIResponse<AnyResponseValue> {
        return APIResponse<AnyResponseValue>(request: request.asAny(), result: result.map { $0.asAny() }, urlRequest: urlRequest, urlResponse: urlResponse, data: data, timeline: timeline)
    }
}

Exactly it crashes inside the result.map { $0.asAny() } with cyclic metadata dependency

I've looked a bit on similar issues (outside of SwagGen) and this cyclic metadata dependency bug mostly occurs, when there are generic types nested in other types (especially with multiple levels of nesting). Maybe you could consider not using nested types, but rather prefixes on type names, and flat types structure?