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

chore: add schema for typst.toml #559

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sjfhsjfh
Copy link
Contributor

Maybe create a schema also here?

@laurmaedje
Copy link
Member

There are a few more fields. You can find the list here: https://github.com/typst/packages/blob/main/bundler/src/model.rs

The required fields vary between Typst Universe and the local compiler, not sure how to handle that.

Is the filename package.schema.json standard? Do you have some link where I can read up on how things work with these schemas?

@sjfhsjfh
Copy link
Contributor Author

sjfhsjfh commented Apr 18, 2024

The required fields vary between Typst Universe and the local compiler, not sure how to handle that.

My purpose for adding this is simple: I can use completion and check in VSCode using Even Better TOML, which searches schema from schemastore. Also there's GitHub Action Support, so I think it depens on what requirements you want users to submit packages that meet I guess, and providing the schema file respectively for Universe and local compiler

Is the filename package.schema.json standard?

To be honest, I'm not quite familiar with this, usually a name like schema.json or version.schema.json is used, and the name is not quite important since schemastore allows self-hosted schema, see here

Do you have some link where I can read up on how things work with these schemas?

@laurmaedje laurmaedje added the meta A PR that is not for a package, but for the package system itself. label Apr 30, 2024
@elegaanz
Copy link
Contributor

From what I understand, it would be better to contribute this file to the schemastore repository directly, so that VSCode
extensions (and maybe other tools) pick it up automatically, without needing to point it to the self-hosted file.

I think the schema should follow what universe does, not what the local compiler does, if we consider that this schema is useful to get editor completions and diagnostics: I think that most of the time when you edit a typst.toml it will be submitted to Universe at some point. Maybe another schema file with only compiler-required fields marked as such could still exist alongside the main one, to make it possible to run lighter checks by giving an explicit schema path (I believe this is something you can do with most tools that work with JSON schemas).

If you open a PR on the schemastore repository, you can ping me in the discussion over there, I will happily give it a look.

@reknih reknih force-pushed the main branch 6 times, most recently from 92aab43 to d06d87c Compare May 15, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta A PR that is not for a package, but for the package system itself.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants