Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"999999",
"--colors",
"-g",
"dialog:merge.*missing schema.*"
"dialog:merge.*"
],
"cwd": "${workspaceFolder}/packages/dialog",
"internalConsoleOptions": "openOnSessionStart",
Expand Down
16 changes: 10 additions & 6 deletions 16 packages/dialog/src/library/schemaMerger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export class SchemaMerger {
this.log('')
imports = await this.copyAssets()
} catch (e) {
this.mergingError(e)
this.mergingError((e as string | Error))
}
if (this.failed) {
this.error('*** Could not merge components ***')
Expand Down Expand Up @@ -629,7 +629,7 @@ export class SchemaMerger {
this.definitions[kind] = component
}
} catch (e) {
this.parsingError(e)
this.parsingError((e as string | Error))
}
}
this.currentFile = ''
Expand Down Expand Up @@ -752,7 +752,7 @@ export class SchemaMerger {
delete component.$schema
locale[kindName] = mergeObjects(locale[kindName], component)
} catch (e) {
this.parsingError(e)
this.parsingError((e as string | Error))
}
}

Expand Down Expand Up @@ -861,7 +861,7 @@ export class SchemaMerger {
if (msg) {
this.log(msg)
}
this.mergingError(e)
this.mergingError((e as string | Error))
}
}

Expand Down Expand Up @@ -1178,7 +1178,7 @@ export class SchemaMerger {
this.parsingWarning('Missing package')
}
} catch (e) {
this.parsingWarning(e.message)
this.parsingWarning((e as Error).message)
} finally {
this.currentFile = this.currentParent().metadata.path
}
Expand Down Expand Up @@ -1830,7 +1830,11 @@ export class SchemaMerger {
// New source
this.currentFile = path
this.vlog(`Bundling ${path}`)
schema.definitions[name] = await getJSON(path)
const definition = await getJSON(path)
if (typeof (definition) !== 'object') {
throw new Error(`Error ${val} did not resolve to JSON Schema object ${definition}`)
}
schema.definitions[name] = definition
sources.push(name)
}
const ref = `#/definitions/${name}${pointer}`
Expand Down
12 changes: 12 additions & 0 deletions 12 packages/dialog/test/commands/dialog/merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,18 @@ describe('dialog:merge', async () => {
scope.done()
nock.cleanAll()
})

it('non-object ref', async() => {
const scope = nock('http://json-schema.org')
.get(/draft-07/)
.reply(200, '<xml></xml>')
.persist()
const [merged, lines] = await merge(['nuget/nuget3/1.0.0/*.schema'], 'app.schema')
assert(!merged, 'Merging should fail')
assert(countMatches(/did not resolve to JSON Schema/i, lines) === 1, 'Did not detect bad definition')
scope.done()
nock.cleanAll()
})
})

/* TODO: These tests are related to verify and need to be updated and moved there.
Expand Down
3 changes: 0 additions & 3 deletions 3 packages/orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@
"typescript": "^4.0.3",
"sinon": "^9.0.2"
},
"engines": {
"node": ">=8.0.0"
},
"files": [
"/lib",
"/npm-shrinkwrap.json",
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.