This repository was archived by the owner on Aug 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 650
refactor(rome_service): add schemars derive attributes for most serializable types #3031
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ematipico
reviewed
Aug 8, 2022
@@ -0,0 +1,336 @@ | |||
{ |
There was a problem hiding this comment.
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.
b153dbc
to
a6234dd
Compare
Deploying with
|
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 |
Parser conformance results on ubuntu-latestjs/262
jsx/babel
symbols/microsoft
ts/babel
ts/microsoft
|
ematipico
approved these changes
Aug 10, 2022
There was a problem hiding this 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!
MichaReiser
approved these changes
Aug 11, 2022
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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