Skip to content

Commit

Permalink
Issue 1441
Browse files Browse the repository at this point in the history
  • Loading branch information
teq0 committed Feb 13, 2021
1 parent 5b715aa commit 6bd9c45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ function getLogger(logger?: Partial<Logger> | false): Logger {
throw new Error("logger must implement log, warn and error methods")
}

const KEYWORD_NAME = /^[a-z_$][a-z0-9_$-:]*$/i
const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i

function checkKeyword(this: Ajv, keyword: string | string[], def?: KeywordDefinition): void {
const {RULES} = this
Expand Down
4 changes: 4 additions & 0 deletions spec/keyword.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,10 @@ describe("User-defined keywords", () => {
ajv.addKeyword("colons:are-valid")
})

should.throw(() => {
ajv.addKeyword("single-'quote-not-valid")
}, /invalid name/)

should.throw(() => {
ajv.addKeyword("3-start-with-number-not-valid")
}, /invalid name/)
Expand Down

0 comments on commit 6bd9c45

Please sign in to comment.