-
Notifications
You must be signed in to change notification settings - Fork 161
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
[SCHEMA] Apply schema rules to entity values #792
Conversation
By using the same tools, we can also use things like `enum` to limit values.
The current solution is a bit of a hack but it's easy to adjust. Basically, when `format` is missing from the schema, default to "label".
I'm thinking it might also be a good idea to create a new label:
description: |
Freeform labels without special characters.
pattern: ^[0-9a-zA-Z]+$
index:
description: |
Non-negative, non-zero integers, optionally prefixed with leading zeros for sortability.
pattern: ^[0-9]+$
unit:
description: |
A unit.
pattern: ^[0-9a-zA-Z]+$ Unfortunately, I don't actually know how most of those patterns would look. Units, for example, can be freeform text if necessary, but optimally they should be valid combinations of the values in the Units appendix. Plus we have relative paths of multiple flavors, along with URIs. I think |
I think the leading zeros is recommended for each index-format entity ... to make sorting more reasonable: That's nothing int("0001") # 1
float("0001") # 1.0
float("0001a") # ValueError, could not convert string to float: '0001a' |
Sounds good. I'll leave it as string then. EDIT: With the potential for an index-specific format, of course. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Co-authored-by: Chris Markiewicz <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For future reviewers, you can look at:
Thanks! The second approval triggers the five-day waiting period and I'll merge next Thursday if no one raises any concerns. Regarding |
Closes #809.
The goal of this PR is to move toward applying the rules that govern metadata values (in #774) to entity values as well. Those rules support a wide range of possible values and restrictions, but the most important one right now is
type: string
combined withenum
, which lets us list specific acceptable values for thepart
andmt
entities.Changes proposed:
type: string
to all entity definitions in the schema.format: label
withenum: <list>
for the part and mt entities.format = label
when format is not defined in entity schema definitions (just to work around the new enums).Pending questions:
type: integer
for any of theindex
-format entities? I kepttype: string
because of the leading zeros issue, although I'm not sure if that applies to all entities or just run.