-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: properly handle circular regressions to prevent call stack excep…
…tions (#253) A regression was recently introduced to the validator in the circular references utility that prevented such references from being caught and sanitized. This resulted in "call stack exceeded" expections for certain patterns using circular references. The regression came in the form of checking for only "plain" objects, rather than all "objects" (which include arrays). This happened in a recent community PR and I didn't realize the consequences when I reviewed and merged. I went back and double checked every instance of this change in that PR and believe this is the only one that is problematic. I fixed it and added a new test case that would've caught this regression had it been there.
- Loading branch information
Showing
3 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
openapi: '3.0.2' | ||
info: | ||
title: Repro "call stack" error | ||
description: Reproduce the "Maximum call stack size exceeded" error with Composite-pattern schemas | ||
version: '0.1.0' | ||
paths: | ||
/example: | ||
post: | ||
summary: Just an example path | ||
description: Just an example path to make this a valid spec | ||
operationId: postExample | ||
components: | ||
schemas: | ||
Pair: | ||
description: A pair of two elements or pairs or both | ||
type: object | ||
properties: | ||
a: | ||
oneOf: | ||
- $ref: "#/components/schemas/Element" | ||
- $ref: "#/components/schemas/Pair" | ||
b: | ||
oneOf: | ||
- $ref: "#/components/schemas/Element" | ||
- $ref: "#/components/schemas/Pair" | ||
Element: | ||
description: An elemental numeric value | ||
type: number | ||
example: 42 |
This file contains 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