Skip to content

Fix/boxlang ref parse cycles - #27

Open
DiscountDarcy wants to merge 5 commits into
coldbox-modules:developmentfrom
inLeague:fix/boxlang-ref-parse-cycles
Open

Fix/boxlang ref parse cycles#27
DiscountDarcy wants to merge 5 commits into
coldbox-modules:developmentfrom
inLeague:fix/boxlang-ref-parse-cycles

Conversation

@DiscountDarcy

Copy link
Copy Markdown

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.

DiscountDarcy and others added 5 commits July 25, 2026 13:05
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant