Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor: add min/max keys validator on object #409

Merged
merged 1 commit into from
Jun 14, 2021

Conversation

zannkukai
Copy link
Contributor

@zannkukai zannkukai commented Jun 10, 2021

Allow to validate an array of object based on minimum or/and maximum
key/value pairs. Ex: for a document, allow to specify that a document
must have strictly one main title.

Closes rero/rero-ils#1361.

Co-Authored-by: Renaud Michotte renaud.michotte@gmail.com

Why are you opening this PR?

  • Which task/US does it implement?
  • Which issue does it fix?

How to test?

  • What command should I have to run to test your PR?
  • What should I test through the UI?

Code review check list

  • Commit message template compliance.
  • Commit message without typos.
  • File names.
  • Functions names.
  • Functions docstrings.
  • Unnecessary commited files?
  • Extracted translations?

@zannkukai zannkukai force-pushed the zan-fix-unique-value-in-array branch from 4a374b6 to 0388f32 Compare June 10, 2021 19:32
return k1.filter(k => a[k] === b[k]);
}
const min = customValidators.numberOfSpecificValuesInObject.min || 0;
const max = customValidators.numberOfSpecificValuesInObject.max || Infinity;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I learned something --> Infinity

@iGormilhit iGormilhit added f: data About data model, importation, transformation, exportation of data, specific for bibliographic data f: editor Concerns editor based on JSON schema AND custom editor labels Jun 14, 2021
@iGormilhit iGormilhit added this to the v1.3.0 milestone Jun 14, 2021
@iGormilhit iGormilhit changed the title editor: add validator min/max keys on object editor: add min/max keys validator on object Jun 14, 2021
Copy link

@iGormilhit iGormilhit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message title suggestion: editor: add min/max keys validator on object

@jma
Copy link
Contributor

jma commented Jun 14, 2021

It would be great to have an example in the demo tester.

@zannkukai zannkukai self-assigned this Jun 14, 2021
@zannkukai zannkukai force-pushed the zan-fix-unique-value-in-array branch from 0388f32 to 618de04 Compare June 14, 2021 08:32
Allow to validate an array of object based on minimum or/and maximum
key/value pairs. Ex: for a document, allow to specify that a document
must have strictly one main title.

Closes rero/rero-ils#1361.

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
@zannkukai zannkukai force-pushed the zan-fix-unique-value-in-array branch from 618de04 to 24749f2 Compare June 14, 2021 08:34
@zannkukai zannkukai merged commit c65ec5d into rero:dev Jun 14, 2021
@zannkukai zannkukai deleted the zan-fix-unique-value-in-array branch June 14, 2021 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: data About data model, importation, transformation, exportation of data, specific for bibliographic data f: editor Concerns editor based on JSON schema AND custom editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the field title.type required for value "bf:Title"
4 participants