cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Publish `.cargo/config.toml` jsonschema to `schemastore.org` for editor

Open loynoir opened this issue 8 months ago • 4 comments

Problem

.cargo/config.toml does not have jsonshema.

So editor can not use schemastore to support tab-completion and validation.

Proposed Solution

cargo team implement jsonschema, publish and maintain related jsonschema in https://github.com/SchemaStore/schemastore.

So editor can use schemastore to support tab-completion and validation.

Notes

  • doc

https://doc.rust-lang.org/cargo/reference/config.html

  • vcpkg

https://github.com/microsoft/vcpkg/issues/34706

loynoir avatar Oct 27 '23 09:10 loynoir

In my use-cases, i use vscode with the plugins Even Better TOML and crates, it is support completion and validation. In my opinion, the most of Rust configuration written in toml format, may be it is not a easy-cake to support another format.

linyihai avatar Oct 27 '23 11:10 linyihai

Although its name is jsonschema, but actually, it can also provide for yaml and toml

https://github.com/SchemaStore/schemastore/blob/24a1f6e5e134d1f2dddf9d781fb5717a308c2822/src/api/json/catalog.json#L19

loynoir avatar Oct 27 '23 12:10 loynoir

Thank you for the proposal. This is quite a cool idea!

It seems that SchemaStore is a collective effort from the community, and unfortunately the Cargo team does not have the capacity to maintain such a JSON schema at this time. I would recommend people communicating and contributing to SchemaStore directly. Look closely into it. The community already done one for Cargo.toml : https://github.com/SchemaStore/schemastore/pull/2368. It uses taplo, which is the engine behind Even Better TOML, to export JSON schema. That looks pretty straightforward if people want to give it a try.

weihanglo avatar Oct 27 '23 12:10 weihanglo

We could have a feature to enable https://crates.io/crates/schemars/0.8.15 on our types with a xtask to update the file checked in. There would be bugs in it but it can serve as a basis for community members to then update the schemastore based off of it.

epage avatar Oct 27 '23 13:10 epage