question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enhancement: Support metadata validation for numeric types

See original GitHub issue

Is your feature request related to a problem? Please describe.

I’ve been working to define the metadata keys for a theme I’m developing in Front Matter. Today, I was defining the settings for general content pages based on the work I’ve done to develop JSON schemas for site configuration and metadata.

While updating the content type definition in Front Matter for the Platen.TableOfContents.MinimumLevel and Platen.TableOfContents.MaximumLevel fields, I realized that while I can require the values be numbers, I can’t require that they be within a specific range. In this case, I would like to set the minimum as 1 and maximum as 6.

Describe the solution you’d like

I’d like additional keys for defining fields with a type of number:

  • minimum: The minimum value the number can be, inclusive. For a value of 3:
    • 2 is invalid
    • 3 is valid
    • 4 is valid
  • maximum: The maximum value the number can be, inclusive. For a value of 3:
    • 2 is valid
    • 3 is valid
    • 4 is invalid
  • exlusiveMinimum: The minimum value the number can be, exclusive. For a value of 3:
    • 2 is invalid
    • 3 is invalid
    • 4 is valid
  • exclusiveMaximum: The maximum value the number can be, exclusive. For a value of 3:
    • 2 is invalid
    • 3 is valid
    • 4 is valid

Describe alternatives you’ve considered

I’m not sure I see another way to handle metadata validation without transitioning towards a semi-unified model between metadata definitions and data-type definitions, which can take advantage of JSON Schema functionality but are more complex to write.

Additional context

Similar to the newly implemented when functionality, I think there’s a lot of utility in being able to define a validation field that allows a configuration author to opt-in for more complex configuration definition to provide a better UX for end users.

For example, even with the described additional keys above, there’s no way to also validate that the specified value for the MinimumLevel field on a page is less than or equal to the MaximumLevel field’s value.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
estruyfcommented, Dec 9, 2022

@michaeltlombardi it might have been me. Think I confused it with the conditional UI functionality and its operators 🫣

1reaction
estruyfcommented, Dec 2, 2022

@dennisl68-castra first, there is a need for a simple way to validate metadata/fields to define when they are allowed to appear and when not. Once that is implemented, we can start thinking about custom scripts.

@michaeltlombardi, these extra operators make sense.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enhance data validation for EF Database First with ASP.NET ...
This tutorial focuses on adding data annotations to the data model to specify validation requirements and display formatting.
Read more >
Proposal For Metadata Enhancement - LYRASIS Wiki
This table will be utilized to directly map any specified schema as a validation target for any existing DSpace Item. One, or more...
Read more >
Use Custom Metadata Types in Formulas, Default Values, and ...
Validation rules verify that the data that a user enters in a record meets the standards you specify before the user can save...
Read more >
5. Validation, Data Binding, and Type Conversion - Spring
Spring 3 introduces several enhancements to its validation support. First, the JSR-303 Bean Validation API is now fully supported. Second, when used ...
Read more >
Resource Management - June 2016 Enhancements
Call Number Duplication Validation Check ... Click Metadata Configuration in the Cataloging section of Resource Management configuration ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found