Skip to content

Commit f4f787f

Browse files
authored
feat: Add validation for required fields in fbs files (#11429)
1 parent 120219a commit f4f787f

File tree

6 files changed

+9
-5
lines changed

6 files changed

+9
-5
lines changed

crates/build/re_types_builder/src/objects.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,10 @@ impl ObjectField {
961961
.unwrap();
962962
let filepath = filepath_from_declaration_file(include_dir_path, &virtpath);
963963

964+
if field.required() {
965+
reporter.error(&virtpath, &fqname, "required fields should not be used");
966+
}
967+
964968
let docs = Docs::from_raw_docs(reporter, &virtpath, field.name(), field.documentation());
965969

966970
let attrs = Attributes::from_raw_attrs(field.attributes());

crates/store/re_types/definitions/rerun/archetypes/asset_video.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ table AssetVideo (
1919
// --- Required ---
2020

2121
/// The asset's bytes.
22-
blob: rerun.components.Blob ("attr.rerun.component_required", required, order: 1000);
22+
blob: rerun.components.Blob ("attr.rerun.component_required", order: 1000);
2323

2424
// --- Recommended ---
2525

crates/store/re_types/definitions/rerun/archetypes/bar_chart.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ table BarChart (
1616
// --- Required ---
1717

1818
/// The values. Should always be a 1-dimensional tensor (i.e. a vector).
19-
values: rerun.components.TensorData ("attr.rerun.component_required", required, order: 1000);
19+
values: rerun.components.TensorData ("attr.rerun.component_required", order: 1000);
2020

2121
// --- Optional ---
2222

crates/store/re_types/definitions/rerun/archetypes/pinhole.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ table Pinhole (
1414
// --- Required ---
1515

1616
/// Camera projection, from image coordinates to view coordinates.
17-
image_from_camera: rerun.components.PinholeProjection ("attr.rerun.component_required", required, order: 1000);
17+
image_from_camera: rerun.components.PinholeProjection ("attr.rerun.component_required", order: 1000);
1818

1919
// --- Recommended ---
2020

crates/store/re_types/definitions/rerun/archetypes/video_frame_reference.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ table VideoFrameReference (
2626
/// Timestamps are relative to the start of the video, i.e. a timestamp of 0 always corresponds to the first frame.
2727
/// This is oftentimes equivalent to presentation timestamps (known as PTS), but in the presence of B-frames
2828
/// (bidirectionally predicted frames) there may be an offset on the first presentation timestamp in the video.
29-
timestamp: rerun.components.VideoTimestamp ("attr.rerun.component_required", required, order: 1000);
29+
timestamp: rerun.components.VideoTimestamp ("attr.rerun.component_required", order: 1000);
3030

3131
// --- Optional ---
3232

crates/store/re_types/definitions/rerun/archetypes/view_coordinates.fbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ table ViewCoordinates (
2424
"attr.rust.repr": "transparent"
2525
) {
2626
/// The directions of the [x, y, z] axes.
27-
xyz: rerun.components.ViewCoordinates ("attr.rerun.component_required", required, order: 1000);
27+
xyz: rerun.components.ViewCoordinates ("attr.rerun.component_required", order: 1000);
2828
}

0 commit comments

Comments
 (0)