@@ -30,37 +30,7 @@ const defaultMatcher: Comparator = (error, query) => {
3030 return true
3131}
3232
33- export const duplicateAuthorMatcher = ( index : number ) => {
34- return ( error : ErrorObject ) => {
35- if ( error . instancePath !== '/authors' ) {
36- return false
37- }
38- if ( error . schemaPath !== '#/properties/authors/uniqueItems' ) {
39- return false
40- }
41- if ( error . params . i !== index && error . params . j !== index ) {
42- return false
43- }
44- return true
45- }
46- }
47-
48- export const duplicateIdentifierMatcher = ( index : number ) => {
49- return ( error : ErrorObject ) => {
50- if ( error . instancePath !== '/identifiers' ) {
51- return false
52- }
53- if ( error . schemaPath !== '#/properties/identifiers/uniqueItems' ) {
54- return false
55- }
56- if ( error . params . i !== index && error . params . j !== index ) {
57- return false
58- }
59- return true
60- }
61- }
62-
63- export const duplicateKeywordMatcher = ( index : number ) => {
33+ export const duplicateMatcher = ( index : number ) => {
6434 return ( error : ErrorObject ) => error . params . i === index || error . params . j === index
6535}
6636
@@ -100,14 +70,20 @@ export const dateReleasedQueries: ErrorQuery[] = [{
10070} ]
10171
10272export const duplicateAuthorQueries : ErrorQuery [ ] = [ {
103- find : { } ,
73+ find : {
74+ instancePath : '/authors' ,
75+ schemaPath : '#/properties/authors/uniqueItems'
76+ } ,
10477 replace : {
10578 message : 'This author is a duplicate.'
10679 }
10780} ]
10881
10982export const duplicateIdentifierQueries : ErrorQuery [ ] = [ {
110- find : { } ,
83+ find : {
84+ instancePath : '/identifiers' ,
85+ schemaPath : '#/properties/identifiers/uniqueItems'
86+ } ,
11187 replace : {
11288 message : 'This identifier is a duplicate.'
11389 }
0 commit comments