Fix/boxlang ref parse cycles - #27
Open
DiscountDarcy wants to merge 5 commits into
Open
Conversation
Break infinite $ref inheritance walks with request-scoped caches and identity visited sets, avoid isStruct(cfc) on BoxLang, and resolve absolute filesystem $refs via expandPath. Add regression fixtures. Co-authored-by: Cursor <cursoragent@cursor.com>
The fork is only a vehicle for the fix; package identity stays Ortus upstream. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop getMetadata name checks and broad catch-all swallowing; prefer isInstanceOf with a getDocumentObject/getNormalizedDocument fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
Production BoxLang often has server.boxlang set without bx-yaml installed, so yamlDeserialize fails on every YAML $ref. Prefer bx-yaml when present; otherwise use the shipped SnakeYAML jar. Co-authored-by: Cursor <cursoragent@cursor.com>
CF fileExists accepts /resources/... paths, but FileInputStream does not. Prefer expandPath for those refs and parse YAML from fileRead strings. Co-authored-by: Cursor <cursoragent@cursor.com>
Open
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We found that our swagger generator was hanging after our cutover to boxlang. Could be there's a boxlang fix for this, but since we needed to get it working ASAP, this is the fix we used. There is a corresponding fix in cbSwagger itself (separate PR)
Details:
Parsing OpenAPI docs with cross-file $refs can hang on BoxLang (infinite $ref/$extend walks; isStruct(cfc) / StructCasterLoose) and can resolve absolute $refs by concatenating onto the base dir (//resources/..., .../auth//resources/...).
Solution: Cycle-safe walks (request-scoped cache + identity visited sets), use isObject/isInstanceOf instead of isStruct on CFCs, resolve absolute paths with expandPath, and add regression specs for shared, circular, and absolute $refs.
Also added plumbing to leverage bx-yaml if it's present or else fall back to snakeYaml. Tests pass on Boxlang 1.15, Lucee 6, and ACF 2025.