-
Notifications
You must be signed in to change notification settings - Fork 33
False positive circular-reference-invalid on external $ref schemas since v1.709.2 #1979
Copy link
Copy link
Open
Description
Description
speakeasy lint openapi incorrectly reports non-terminating circular references when validating an OpenAPI 3.1 spec that uses external $refs to split schema files. The referenced schemas do not form any cycles.
Regression
- Last passing: v1.709.1
- First failing: v1.709.2 (commit 498f86a)
Error output
ERROR validation error: [line 107:7] circular-reference-invalid - non-terminating circular reference
detected: components/schemas/Product.json -> components/schemas/Product.json
ERROR validation error: [line 120:7] circular-reference-invalid - non-terminating circular reference
detected: components/schemas/Product.json -> components/schemas/Product.json
ERROR validation error: [line 144:7] circular-reference-invalid - non-terminating circular reference
detected: components/schemas/Product.json -> components/schemas/Product.json
Reproduction
The spec uses a split-file structure where a parent schema (Product.json) references child schemas via external $refs:
Product.json
├── pricing: $ref: ./ProductPricing.json (terminal — no further $refs)
├── promotion: $ref: ./ProductPromotion.json ($refs only promotion-type schemas, all terminal)
├── bundle_items: $ref: ./ProductBundleItem.json ($refs Item.json → various terminal schemas)
├── variants: $ref: ./Variant.json (terminal)
├── images: $ref: ./ProductImage.json (terminal)
└── attributes: $ref: ./ProductAttribute.json ($refs attribute-type schemas, all terminal)
A full graph traversal confirms no schema references back to Product.json. The Product.json -> Product.json cycle reported by the linter does not exist.
Command
speakeasy lint openapi --logLevel warn --non-interactive --schema catalog.jsonwhere catalog.json is an OpenAPI 3.1 spec referencing schemas in ./components/schemas/ via external $refs like {"$ref": "./components/schemas/Product.json"}.
Expected behavior
Lint should pass (or warn), as there are no circular references in the $ref graph.
Environment
- OS: macOS (darwin arm64)
- Speakeasy CLI: fails on v1.709.2+, passes on v1.709.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels