-
Notifications
You must be signed in to change notification settings - Fork 135
Description
Description
Glad to hear that. Just FYI for anyone else following up, I did find a scenario under which the cycle detector doesn't work correctly in a complex graph and am investigating it. If you hit an issue where the generated code doesn't compile, complaining about "infinite size" structs, please let me know here.
Hey @czechboy0 👋, encountering this now with Square's API specification, here's the OpenAPI doc and minimal config I'm trying to use: https://gist.github.com/johnbona/dd0fc8b8b1cbf0f25f76ac3328ef67ff
The CatalogObject and CatalogItem schemas reference one another and I get this error:
Error: Encountered a JSON Schema $ref cycle that prevents fully dereferencing document at '#/components/schemas/CatalogObject'. This type of reference cycle is not inherently problematic for JSON Schemas, but it does mean OpenAPIKit cannot fully resolve references because attempting to do so results in an infinite loop over any reference cycles. You should still be able to parse the document, just avoid requesting a `locallyDereferenced()` copy.
Oddly enough, it's generating Swift code just fine with their older Swagger 2.0 docs that has these circular references (included an example OpenAPI doc in the gist). Would it be better if I create a new issue?
Originally posted by @johnbona in #70
Reproduction
OpenAPI document and configuration available in gist: https://gist.github.com/johnbona/dd0fc8b8b1cbf0f25f76ac3328ef67ff
Package Versions
├── swift-openapi-async-http-client<https://github.com/swift-server/[email protected]>
│ ├── swift-nio<https://github.com/apple/[email protected]>
│ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ ├── swift-collections<https://github.com/apple/[email protected]>
│ │ └── swift-system<https://github.com/apple/[email protected]>
│ ├── async-http-client<https://github.com/swift-server/[email protected]>
│ │ ├── swift-nio<https://github.com/apple/[email protected]>
│ │ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ ├── swift-collections<https://github.com/apple/[email protected]>
│ │ │ └── swift-system<https://github.com/apple/[email protected]>
│ │ ├── swift-nio-ssl<https://github.com/apple/[email protected]>
│ │ │ └── swift-nio<https://github.com/apple/[email protected]>
│ │ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ ├── swift-collections<https://github.com/apple/[email protected]>
│ │ │ └── swift-system<https://github.com/apple/[email protected]>
│ │ ├── swift-nio-http2<https://github.com/apple/[email protected]>
│ │ │ ├── swift-nio<https://github.com/apple/[email protected]>
│ │ │ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ │ ├── swift-collections<https://github.com/apple/[email protected]>
│ │ │ │ └── swift-system<https://github.com/apple/[email protected]>
│ │ │ └── swift-atomics<https://github.com/apple/[email protected]>
│ │ ├── swift-nio-extras<https://github.com/apple/[email protected]>
│ │ │ ├── swift-nio<https://github.com/apple/[email protected]>
│ │ │ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ │ ├── swift-collections<https://github.com/apple/[email protected]>
│ │ │ │ └── swift-system<https://github.com/apple/[email protected]>
│ │ │ ├── swift-nio-http2<https://github.com/apple/[email protected]>
│ │ │ │ ├── swift-nio<https://github.com/apple/[email protected]>
│ │ │ │ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ │ │ ├── swift-collections<https://github.com/apple/[email protected]>
│ │ │ │ │ └── swift-system<https://github.com/apple/[email protected]>
│ │ │ │ └── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ ├── swift-http-types<https://github.com/apple/[email protected]>
│ │ │ ├── swift-http-structured-headers<https://github.com/apple/[email protected]>
│ │ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ └── swift-algorithms<https://github.com/apple/[email protected]>
│ │ │ └── swift-numerics<https://github.com/apple/[email protected]>
│ │ ├── swift-nio-transport-services<https://github.com/apple/[email protected]>
│ │ │ ├── swift-nio<https://github.com/apple/[email protected]>
│ │ │ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ │ │ ├── swift-collections<https://github.com/apple/[email protected]>
│ │ │ │ └── swift-system<https://github.com/apple/[email protected]>
│ │ │ └── swift-atomics<https://github.com/apple/[email protected]>
│ │ ├── swift-log<https://github.com/apple/[email protected]>
│ │ ├── swift-atomics<https://github.com/apple/[email protected]>
│ │ └── swift-algorithms<https://github.com/apple/[email protected]>
│ │ └── swift-numerics<https://github.com/apple/[email protected]>
│ ├── swift-openapi-runtime<https://github.com/apple/[email protected]>
│ │ └── swift-http-types<https://github.com/apple/[email protected]>
│ └── swift-http-types<https://github.com/apple/[email protected]>
├── swift-openapi-generator<https://github.com/apple/[email protected]>
│ ├── swift-algorithms<https://github.com/apple/[email protected]>
│ │ └── swift-numerics<https://github.com/apple/[email protected]>
│ ├── swift-collections<https://github.com/apple/[email protected]>
│ ├── openapikit<https://github.com/mattpolzin/[email protected]>
│ │ └── yams<https://github.com/jpsim/[email protected]>
│ ├── yams<https://github.com/jpsim/[email protected]>
│ └── swift-argument-parser<https://github.com/apple/[email protected]>
└── swift-openapi-runtime<https://github.com/apple/[email protected]>
└── swift-http-types<https://github.com/apple/[email protected]>
Expected Behavior
Create the client and types, previously functioning OpenAPI document available in gist: https://gist.github.com/johnbona/dd0fc8b8b1cbf0f25f76ac3328ef67ff
Environment
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.110.21 clang-1700.0.13.3)
Target: arm64-apple-macosx15.0