Skip to content

Commit

Permalink
fix(types): update unevaluatedItems type defintion (#1295)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyfiel authored Oct 13, 2023
1 parent 4769ca5 commit be16c58
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/slow-lemons-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@redocly/cli': patch
'@redocly/openapi-core': patch
---

Updated `unevaluatedItems` type definition to resolve either boolean or object schema per JSON Schema 2019-09 specification.
8 changes: 7 additions & 1 deletion packages/core/src/types/asyncapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,13 @@ const Schema: NodeType = {
maxContains: { type: 'integer', minimum: 0 },
patternProperties: { type: 'object' },
propertyNames: 'Schema',
unevaluatedItems: 'Schema',
unevaluatedItems: (value: unknown) => {
if (typeof value === 'boolean') {
return { type: 'boolean' };
} else {
return 'Schema';
}
},
unevaluatedProperties: (value: unknown) => {
if (typeof value === 'boolean') {
return { type: 'boolean' };
Expand Down
8 changes: 7 additions & 1 deletion packages/core/src/types/oas3_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ const Schema: NodeType = {
maxContains: { type: 'integer', minimum: 0 },
patternProperties: { type: 'object' },
propertyNames: 'Schema',
unevaluatedItems: 'Schema',
unevaluatedItems: (value: unknown) => {
if (typeof value === 'boolean') {
return { type: 'boolean' };
} else {
return 'Schema';
}
},
unevaluatedProperties: (value: unknown) => {
if (typeof value === 'boolean') {
return { type: 'boolean' };
Expand Down

1 comment on commit be16c58

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 75.85% 4001/5275
🟡 Branches 65.77% 2131/3240
🟡 Functions 67.89% 649/956
🟡 Lines 76.03% 3750/4932

Test suite run success

636 tests passing in 93 suites.

Report generated by 🧪jest coverage report action from be16c58

Please sign in to comment.