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

Support $schema in JSON structures #974

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Rojo Changelog

## Unreleased Changes
* Support for a `$schema` field in all special JSON files (`.project.json`, `.model.json`, and `.meta.json`) ([#974])
* Projects may now manually link `Ref` properties together using `Attributes`. ([#843])
This has two parts: using `id` or `$id` in JSON files or a `Rojo_Target` attribute, an Instance
is given an ID. Then, that ID may be used elsewhere in the project to point to an Instance
Expand Down Expand Up @@ -85,6 +86,7 @@
[#886]: https://github.com/rojo-rbx/rojo/pull/886
[#911]: https://github.com/rojo-rbx/rojo/pull/911
[#915]: https://github.com/rojo-rbx/rojo/pull/915
[#974]: https://github.com/rojo-rbx/rojo/pull/974

## [7.4.3] - August 6th, 2024
* Fixed issue with building binary files introduced in 7.4.2
Expand Down
3 changes: 3 additions & 0 deletions src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ enum Error {
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct Project {
#[serde(rename = "$schema", skip_serializing_if = "Option::is_none")]
schema: Option<String>,

/// The name of the top-level instance described by the project.
pub name: Option<String>,

Expand Down
3 changes: 3 additions & 0 deletions src/snapshot_middleware/json_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ pub fn snapshot_json_model(
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
struct JsonModel {
#[serde(rename = "$schema", skip_serializing_if = "Option::is_none")]
schema: Option<String>,

#[serde(alias = "Name")]
name: Option<String>,

Expand Down
6 changes: 6 additions & 0 deletions src/snapshot_middleware/meta_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use crate::{resolution::UnresolvedValue, snapshot::InstanceSnapshot, RojoRef};
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AdjacentMetadata {
#[serde(rename = "$schema", skip_serializing_if = "Option::is_none")]
schema: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,

Expand Down Expand Up @@ -104,6 +107,9 @@ impl AdjacentMetadata {
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct DirectoryMetadata {
#[serde(rename = "$schema", skip_serializing_if = "Option::is_none")]
schema: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
pub id: Option<String>,

Expand Down
Loading