typst-community / valkyrie

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

improve introspection of types #38

Closed JamesxX closed 3 days ago

JamesxX commented 2 weeks ago

This PR adds a description field on base-type, which serves to take the descriptive burden off name so that it can more properly be used to identify types for the purposes of rendering them.

For schema generators already in the code base where such specializations do not warrant a distinct name (string derivatives and number derivatives), the new description field is used instead.

For schema generators for more complicated types (array, either, dictionary) name is constant and description takes the burden of describing child schema.

The codebase has been reviewed for any opportunities to include information in the schema itself rather than guess what type it is (i.e., make schemas more characteristic). I think I managed to get them all, but in reviewing, I do think the choice type might be better reworked into a type more properly than through assertions.

To do: