feat: Enhance reference validation and add support for Handle URLs
Some checks failed
CI Pipeline / japa-tests (push) Failing after 51s
Some checks failed
CI Pipeline / japa-tests (push) Failing after 51s
- Updated reference validation to handle various identifier types including DOI, ISBN, ISSN, URN, and Handle. - Improved regex patterns for DOI and Handle validation to correctly extract and validate identifiers from URLs. - Added asynchronous checks to verify the existence of DOI and Handle URLs. - Added asynchronous checks to verify the existence of ISBNs - Included detailed comments explaining the regex patterns and validation logic. - Adjusted the validation logic to handle any URL prefix for Handle identifiers. - Ensured that the Handle format `handle/20.500.12854/36478` is correctly validated. - Updated the CI workflow to trigger on push and pull request events.
This commit is contained in:
parent
537c6fd81a
commit
2c4f51be68
12 changed files with 538 additions and 162 deletions
|
@ -363,7 +363,8 @@ export default class DatasetController {
|
|||
references: vine
|
||||
.array(
|
||||
vine.object({
|
||||
value: vine.string().trim().minLength(3).maxLength(255),
|
||||
// value: vine.string().trim().minLength(3).maxLength(255),
|
||||
value: vine.string().trim().minLength(3).maxLength(255).validateReference({ typeField: 'type' }),
|
||||
type: vine.enum(Object.values(ReferenceIdentifierTypes)),
|
||||
relation: vine.enum(Object.values(RelationTypes)),
|
||||
label: vine.string().trim().minLength(2).maxLength(255),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import vine, { SimpleMessagesProvider } from '@vinejs/vine';
|
||||
import { TitleTypes, DescriptionTypes, ContributorTypes, ReferenceIdentifierTypes, RelationTypes } from '#contracts/enums';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
// import MimeType from '#models/mime_type';
|
||||
|
||||
// const enabledExtensions = await MimeType.query().select('file_extension').where('enabled', true).exec();
|
||||
|
@ -125,7 +126,7 @@ export const createDatasetValidator = vine.compile(
|
|||
references: vine
|
||||
.array(
|
||||
vine.object({
|
||||
value: vine.string().trim().minLength(3).maxLength(255),
|
||||
value: vine.string().trim().minLength(3).maxLength(255).validateReference({ typeField: 'type' }),
|
||||
type: vine.enum(Object.values(ReferenceIdentifierTypes)),
|
||||
relation: vine.enum(Object.values(RelationTypes)),
|
||||
label: vine.string().trim().minLength(2).maxLength(255),
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue