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

Best practices validator #2025

Open
rly opened this issue Mar 26, 2024 · 2 comments
Open

Best practices validator #2025

rly opened this issue Mar 26, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@rly
Copy link
Contributor

rly commented Mar 26, 2024

Is your feature request related to a problem? Please describe.
In LinkML there are sometimes multiple equivalent ways of specifying a schema, e.g., due to syntactic sugar. While I think LinkML should allow users to express schema however they want within the language, I think it would be nice to have an additional layer of standardization of schema that follows an opinionated set of best practices, and a validator that checks for that.

For example, the Simple Implicit Scalar Pattern for modeling quantities and units of measurement is marked as an anti-pattern and could be flagged in a best practices validator.

This is inspired by some of our work on linkml arrays: #1887 (comment)
Here:

array:
  minimum_number_dimensions: 3
  maximum_number_dimensions: False
  dimensions:
    - alias: time

is equivalent to:

array:
  minimum_number_dimensions: 3
  maximum_number_dimensions: False
  dimensions:
    - alias: time
    - {}
    - {}

but the second example more explicitly shows that the second and third required dimensions are left unspecified.

array:
  minimum_number_dimensions: 3
  maximum_number_dimensions: 3

is equivalent to:

array:
  exact_number_dimensions: 3

but I prefer the second example because even though min/max is more explicit, it suggests a range. Perhaps that is a controversial example, but I am sure there are other examples of good patterns / best practices to follow.

Related:

How important is this feature?
• Low - it's an enhancement but not crucial for work

When will use cases depending on this become relevant?
• Long-term - 6 months - 1 year

@cmungall
Copy link
Member

Should this be folded into https://linkml.io/linkml/schemas/linter.html?

@rly
Copy link
Contributor Author

rly commented Mar 26, 2024

Oh! I totally missed that. I think folding it into the linter would work great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants