-
Notifications
You must be signed in to change notification settings - Fork 18
feat(data): create a schema for definitions #93
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
base: main
Are you sure you want to change the base?
Conversation
CZDanol
left a comment
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.
I'm sorry, I don't have enough time to do a proper review. The idea sounds good, found some nitpicks on a quick skim.
data/schema/config.yaml
Outdated
| # this pattern enables vendored and versioned mime types, e.g., | ||
| # - application/vnd.openprinttag.v2 | ||
| # - application/vnd.openprinttag+cool-feature | ||
| pattern: "^application/vnd\\.openprinttag(\\.[a-z0-9]+|\\+[a-z0-9]+)*$" |
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.
Let's restrict this to only application/. Even us (Prusa) are using this format for some other things than just openprinttag ;)
Plus, vnd.openprinttag vendor tree is now registered by us, so it's not something anyone can use for their own spinoffs.
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.
You mean "application/vnd.openprinttag" strictly and no sub-vendoring stuff, correct?
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.
(potentially) Fixed in johnlettman@7067d2a
(squashed)
No worries at all.
Will fix all, thank you! |
This commit creates several schemas covering all definition YAML files in the OpenPrintTag standard. These schemas can be useful in enforcing certain standards and criteria for valid information in the definitions while also instructing editors and IDEs as to the valid fields, their contents, and their type information. Further, many editors can use these schemas to provide contextual information about each field -- of note, descriptions and hints. A small, but nice feature, is the ability to enforce certain naming schemes. For example, all tags use the format of `my_tag_name` with lowercase characters an underscores separating each word. A simple regular expression ensures a stand-out, such as `MyTAG--NAME` would not be considered valid. Additionally, the schemas formalize the structure of each file. They can provide a source of truth as to what is considered valid and required for a definition. Lastly, tools such as `pre-commit` can use these schemas to check whether an addition fits the conventions prior to a commit or within a pull request. fix(schema): make `mime_type` const "application/vnd.openprinttag" Fix for prusa3d#93 (comment) fix(schema): use "Identifier" verbiage for `key` across schemas Fix for prusa3d#93 (comment) fix(schema): drop `required: required` from `fields` Fix for prusa3d#93 (comment)
7067d2a to
6fa48cc
Compare
|
Rebasing to resolve conflicts. |
This commit adds the `color_rgba` type, a simple alias to `bytes` with a `max_length` of 4. The more explicit use of `color_rgba` as a type can signal to implementing libraries that the data within the field could be interpreted as a color. This can enable features such as encoding or displaying the color in a different format, performing color operations, and so on.
Maximum allowed value is 320.
BFW-8077
BFW-8092
Authored by MartinPoupa, I've just tweaked the wording a little. BFW-8092 Co-Authored-By: MartinPoupa <[email protected]>
This PR creates several schemas covering all definition YAML files in the OpenPrintTag standard.
These schemas can be useful for enforcing standards and criteria for valid information in the definitions, while also instructing editors and IDEs about the valid fields, their contents, and their type information. Further, many editors can use these schemas to provide contextual information for each field -- notably, descriptions and hints.
A small but nice feature is the ability to enforce certain naming schemes. For example, all tags use the format of
my_tag_namewith lowercase characters and underscores separating each word. A simple regular expression ensures a stand-out, such asMyTAG--NAMEwould not be considered valid.Additionally, the schemas formalize the structure of each file. They can serve as a source of truth for what is considered valid and required for a definition.
Lastly, tools such as
pre-commitcan use these schemas to check whether an addition adheres to the conventions before a commit or within a pull request.Currently, the schemas are namespaced to
https://specs.openprinttag.org/schema/. The PR usesgenerate.pyto insert the schemas intodocs, which appear to push tospecs.openprinttag.org:OpenPrintTag/docs_src/generate.py
Lines 90 to 91 in 7db85ec
In each
datadefinition, theyaml-language-serverused by most editors and IDEs to perform YAML inspections is configured to use a relative path to reference the schemas. This could theoretically be changed to use the namespace URL; however, since they are packaged with the repository, it seems more sensible to keep them relative.