typst-community / valkyrie

Type safe type safety for Typst
Other
25 stars 2 forks source link

Add named schemas for missing built-in types #13

Closed tingerrr closed 1 month ago

tingerrr commented 1 month ago

Some types, such as gradient, stroke, or even simpler ones like label or selector do not yet have schemas.

Some others which are more complex deserve getting dedicated schemas like validation for queryable element functions, countable element functions etc. (what is internally tracked using traits on elements) should likely be included as choice schemas.

JamesxX commented 1 month ago

Gradient, Stroke, and Version are now implemented by #18. I'm having a tough time thinking of potential use cases or applications of label and selector (mostly because I've never really needed to use them myself so they are still a bit alien to me), so I'm having a tough time thinking about what exactly needs to be implemented for these, for the job to have been done properly.

tingerrr commented 1 month ago

Regarding labels and selectors, they are relevant to, for example, hydra. While they are only a subset of the type queryable, they are part of building such a schema and definitely important for packages which implement introspection heavy packages.

I think for the base types it's fine if they simply check the type as the other regular ones do, see my review comment on the PR which lists the built-in types. I think we should provide all of those by default, even if they are simple.