From 67d81daf28f611aaf02d0a395505160b06c3ebf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ro=C5=BCek?= Date: Fri, 5 Mar 2021 23:32:21 +0100 Subject: [PATCH] fix: empty $refs should not be ignored (#1540) --- package.json | 2 +- src/__tests__/spectral.jest.test.ts | 17 +++++++++++++++++ yarn.lock | 8 ++++---- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 094c32f88..277a3e88e 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@stoplight/better-ajv-errors": "0.0.4", "@stoplight/json": "3.10.2", "@stoplight/json-ref-readers": "1.2.2", - "@stoplight/json-ref-resolver": "3.1.1", + "@stoplight/json-ref-resolver": "3.1.2", "@stoplight/lifecycle": "2.3.2", "@stoplight/path": "1.3.2", "@stoplight/types": "11.9.0", diff --git a/src/__tests__/spectral.jest.test.ts b/src/__tests__/spectral.jest.test.ts index 14764b8b1..27a6313de 100644 --- a/src/__tests__/spectral.jest.test.ts +++ b/src/__tests__/spectral.jest.test.ts @@ -129,6 +129,23 @@ describe('Spectral', () => { severity: DiagnosticSeverity.Warning, source: documentUri, }, + { + code: 'invalid-ref', + message: 'EISDIR: illegal operation on a directory, read', + path: ['empty', '$ref'], + range: { + end: { + character: 14, + line: 5, + }, + start: { + character: 12, + line: 5, + }, + }, + severity: DiagnosticSeverity.Error, + source: documentUri, + }, { code: 'requires-type', message: '`allOf.type` property is not truthy', diff --git a/yarn.lock b/yarn.lock index eb933f159..1fa1ee3b8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1186,10 +1186,10 @@ node-fetch "^2.6.0" tslib "^1.14.1" -"@stoplight/json-ref-resolver@3.1.1": - version "3.1.1" - resolved "https://registry.yarnpkg.com/@stoplight/json-ref-resolver/-/json-ref-resolver-3.1.1.tgz#c450b71ff8c8ed25eeb547244c0c4e7646fc9991" - integrity sha512-FUOu3nPwbX2COczcCwvUz1EpqRNYlw7Ng8keOWGiwKmlXVz4OKdRw4hi2HUg9QNSX1CyFVJ3A3pPtpkizfKqlg== +"@stoplight/json-ref-resolver@3.1.2": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@stoplight/json-ref-resolver/-/json-ref-resolver-3.1.2.tgz#ae218cf6062d6be490c135603478415e700b52ba" + integrity sha512-SwSvhQ1jNDDLrmKSc17cEx2zZxjzF1tB4nmzaD5fn/r0oI77CNL0Rts4tAVodXVFKrWnaNWZuZmlla6x8y7eFA== dependencies: "@stoplight/json" "^3.10.2" "@stoplight/path" "^1.3.2"