+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Conversation

leops
Copy link
Contributor

@leops leops commented Aug 8, 2022

Summary

This changes adds a build script to the Rust crate for the playground that automatically generates type definitions for the Workspace protocol. This is implemented by adding additional derives for the JsonSchema trait from the schemars crate to all serializable types. These derives macros generate JSON schema metadata for the API types at compilation time, which are used for two purposes: the most straightforward is generating a schema file for the rome.json configuration file (with the new cargo codegen-schema command) that's embedded in the VSCode extension and provides autocomplete and validation for the configuration file format. The second usage of these metadata is in the build.rs script for the playground, to generate TypeScript definitions from the schema

Test Plan

This change is only additional compile-time metadata and using it to generate TypeScript definitions, which are tested when the plyaground is built with the TypeScript Compiler

@@ -0,0 +1,336 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a killer addition! It will force us to write better documentation for each property! This further demonstrates that we can use rust to extract the rustdoc for the documentation of our website.

Base automatically changed from refactor/playground-workspace to main August 10, 2022 14:06
@leops leops force-pushed the feature/workspace-wasm-types branch from b153dbc to a6234dd Compare August 10, 2022 15:26
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 10, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: cca8142
Status: ✅  Deploy successful!
Preview URL: https://324d385d.tools-8rn.pages.dev
Branch Preview URL: https://feature-workspace-wasm-types.tools-8rn.pages.dev

View logs

@leops leops temporarily deployed to aws August 10, 2022 15:26 Inactive
@leops leops marked this pull request as ready for review August 10, 2022 15:27
@leops leops requested a review from a team August 10, 2022 15:27
@github-actions
Copy link

github-actions bot commented Aug 10, 2022

@github-actions
Copy link

Parser conformance results on ubuntu-latest

js/262

Test result main count This PR count Difference
Total 45878 45878 0
Passed 44938 44938 0
Failed 940 940 0
Panics 0 0 0
Coverage 97.95% 97.95% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 39 39 0
Passed 36 36 0
Failed 3 3 0
Panics 0 0 0
Coverage 92.31% 92.31% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5946 5946 0
Passed 395 395 0
Failed 5551 5551 0
Panics 0 0 0
Coverage 6.64% 6.64% 0.00%

ts/babel

Test result main count This PR count Difference
Total 588 588 0
Passed 519 519 0
Failed 69 69 0
Panics 0 0 0
Coverage 88.27% 88.27% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 16257 16257 0
Passed 12397 12397 0
Failed 3860 3860 0
Panics 0 0 0
Coverage 76.26% 76.26% 0.00%

Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you actually checked if VSCode provides autocomplete when typing in a rome.json file? It looks good to me. Just fixing CI and 🚢 it!

@leops leops temporarily deployed to aws August 10, 2022 16:00 Inactive
@leops
Copy link
Contributor Author

leops commented Aug 10, 2022

Have you actually checked if VSCode provides autocomplete when typing in a rome.json file?

I had to fix a packaging issue since the schema wasn't being included in the extension bundle, but otherwise it seems to work correctly:

config

@leops leops merged commit 5b51cfc into main Aug 11, 2022
@leops leops deleted the feature/workspace-wasm-types branch August 11, 2022 07:03
IWANABETHATGUY pushed a commit to IWANABETHATGUY/tools that referenced this pull request Aug 22, 2022
…lizable types (rome#3031)

* refactor(rome_service): add schemars derive attributes for most serializable types

* fix CI and extension packaging
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载