@@ -40,6 +40,10 @@ export const byError = (errors: ErrorObject[], matcher: Comparator = defaultMatc
4040 }
4141}
4242
43+ export const unique = ( message : string , index : number , self : string [ ] ) => {
44+ return self . indexOf ( message ) === index
45+ }
46+
4347export const authorsQueries : ErrorQuery [ ] = [ {
4448 find : {
4549 instancePath : '/authors' ,
@@ -112,44 +116,58 @@ export const emailQueries = (index: number) => {
112116}
113117
114118export const identifierValueQueries = ( index : number , typeIndex : number ) => {
115- return [ [
116- {
117- find : {
118- instancePath : `/identifiers/${ index } /value` ,
119- schemaPath : '#/definitions/doi/pattern'
120- } ,
121- replace : {
122- message : 'e.g. \'10.5281/zenodo.1003149\' or \'10.7717/peerj-cs.86\'. Does not include the resolver URL.'
119+ return [
120+ [
121+ {
122+ find : {
123+ instancePath : `/identifiers/${ index } /value` ,
124+ schemaPath : '#/definitions/doi/pattern'
125+ } ,
126+ replace : {
127+ message : 'e.g. \'10.5281/zenodo.1003149\' or \'10.7717/peerj-cs.86\'. Does not include the resolver URL.'
128+ }
123129 }
124- } ,
125- {
126- find : {
127- instancePath : `/identifiers/${ index } /value` ,
128- schemaPath : '#/definitions/url/pattern'
130+ ] , [
131+ {
132+ find : {
133+ instancePath : `/identifiers/${ index } /value` ,
134+ schemaPath : '#/definitions/url/pattern'
135+ } ,
136+ replace : {
137+ message : 'e.g. \'https://www.example.com\' (http, ftp, sftp hyperlinks are also supported)'
138+ }
129139 } ,
130- replace : {
131- message : 'e.g. \'https://www.example.com\' (http, ftp, sftp hyperlinks are also supported)'
140+ {
141+ find : {
142+ instancePath : `/identifiers/${ index } /value` ,
143+ schemaPath : '#/definitions/url/format'
144+ } ,
145+ replace : {
146+ message : 'e.g. \'https://www.example.com\' (http, ftp, sftp hyperlinks are also supported)'
147+ }
132148 }
133- } ,
134- {
135- find : {
136- instancePath : `/identifiers/${ index } /value` ,
137- schemaPath : '#/definitions/swh-identifier/pattern'
138- } ,
139- replace : {
140- message : 'e.g. \'swh:1:rev:309cf2674ee7a0749978cf8265ab91a60aea0f7d\'. Besides \'rev\', other allowed values are: \'snp\', \'rel\', \'dir\', and \'cnt\'.'
149+ ] , [
150+ {
151+ find : {
152+ instancePath : `/identifiers/${ index } /value` ,
153+ schemaPath : '#/definitions/swh-identifier/pattern'
154+ } ,
155+ replace : {
156+ message : 'e.g. \'swh:1:rev:309cf2674ee7a0749978cf8265ab91a60aea0f7d\'. Besides \'rev\', other allowed values are: \'snp\', \'rel\', \'dir\', and \'cnt\'.'
157+ }
141158 }
142- } ,
143- {
144- find : {
145- instancePath : `/identifiers/${ index } /value` ,
146- schemaPath : '#/anyOf/3/properties/value/minLength'
147- } ,
148- replace : {
149- message : 'Zero-length identifier values are not allowed. Please type an identifier value or remove the identifier entirely.'
159+ ] , [
160+ {
161+ find : {
162+ instancePath : `/identifiers/${ index } /value` ,
163+ schemaPath : '#/anyOf/3/properties/value/minLength'
164+ } ,
165+ replace : {
166+ message : 'Zero-length identifier values are not allowed. Please type an identifier value or remove the identifier entirely.'
167+ }
150168 }
151- }
152- ] [ typeIndex ] ] as ErrorQuery [ ]
169+ ]
170+ ] [ typeIndex ] as ErrorQuery [ ]
153171}
154172
155173export const identifiersQueries : ErrorQuery [ ] = [ {
@@ -223,6 +241,14 @@ export const repositoryArtifactQueries: ErrorQuery[] = [{
223241 replace : {
224242 message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
225243 }
244+ } , {
245+ find : {
246+ instancePath : '/repository-artifact' ,
247+ schemaPath : '#/definitions/url/format'
248+ } ,
249+ replace : {
250+ message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
251+ }
226252} ]
227253
228254export const repositoryCodeQueries : ErrorQuery [ ] = [ {
@@ -233,6 +259,14 @@ export const repositoryCodeQueries: ErrorQuery[] = [{
233259 replace : {
234260 message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
235261 }
262+ } , {
263+ find : {
264+ instancePath : '/repository-code' ,
265+ schemaPath : '#/definitions/url/format'
266+ } ,
267+ replace : {
268+ message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
269+ }
236270} ]
237271
238272export const repositoryQueries : ErrorQuery [ ] = [ {
@@ -243,6 +277,14 @@ export const repositoryQueries: ErrorQuery[] = [{
243277 replace : {
244278 message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
245279 }
280+ } , {
281+ find : {
282+ instancePath : '/repository' ,
283+ schemaPath : '#/definitions/url/format'
284+ } ,
285+ replace : {
286+ message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
287+ }
246288} ]
247289
248290export const titleQueries : ErrorQuery [ ] = [ {
@@ -272,4 +314,12 @@ export const urlQueries: ErrorQuery[] = [{
272314 replace : {
273315 message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
274316 }
317+ } , {
318+ find : {
319+ instancePath : '/url' ,
320+ schemaPath : '#/definitions/url/format'
321+ } ,
322+ replace : {
323+ message : 'Format: https://www.example.com (http, ftp, sftp hyperlinks are also supported)'
324+ }
275325} ]
0 commit comments