Skip to content

Commit 3fc436d

Browse files
committed
Revert "Add warning for JSON Pointers that lack a leading /"
This reverts commit e4d5097.
1 parent 917fe74 commit 3fc436d

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

src/specmap/lib/refs.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@ const plugin = {
5555
const refPath = splitString[0]
5656
const pointer = splitString[1] || ''
5757

58-
if (pointer.length > 0 && pointer[0] !== '/') {
59-
console.warn(`WARNING: $ref '${ref}' is malformed, a leading '/' is expected after '#'`)
60-
}
61-
6258
let basePath
6359
try {
6460
basePath = (baseDoc || refPath) ? absoluteify(refPath, baseDoc) : null

test/specmap/index.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import expect, {createSpy} from 'expect'
1+
import expect from 'expect'
22
import clone from 'clone'
33
import xmock from 'xmock'
44
import traverse from 'traverse'
@@ -419,23 +419,6 @@ describe('specmap', function () {
419419
})
420420
})
421421

422-
it('should warn about malformed JSON Pointers', function () {
423-
// for https://github.com/swagger-api/swagger-editor/issues/1560
424-
const oriWarn = console.warn
425-
console.warn = createSpy().andCallThrough()
426-
return mapSpec({
427-
spec: {
428-
nested: {one: 1},
429-
another: {$ref: '#nested'}
430-
},
431-
plugins: [plugins.refs]
432-
})
433-
.then((res) => {
434-
console.warn = oriWarn
435-
expect(console.warn).toHaveBeenCalledWith('WARNING: $ref \'http://example.com/doc-a#two\' is malformed, a leading \'/\' is expected after \'#\'')
436-
})
437-
})
438-
439422
it('should resolve internal $refs in arrays', function () {
440423
return mapSpec({
441424
spec: {

0 commit comments

Comments
 (0)