@foxglove/schemas 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/internal/generatePyclass.d.ts +3 -3
- package/dist/internal/generatePyclass.d.ts.map +1 -1
- package/dist/internal/generatePyclass.js +119 -32
- package/dist/internal/generatePyclass.js.map +1 -1
- package/dist/internal/generatePyclass.test.js +147 -140
- package/dist/internal/generatePyclass.test.js.map +1 -1
- package/dist/internal/generateSdkCpp.d.ts +4 -0
- package/dist/internal/generateSdkCpp.d.ts.map +1 -0
- package/dist/internal/generateSdkCpp.js +359 -0
- package/dist/internal/generateSdkCpp.js.map +1 -0
- package/dist/internal/generateSdkRustCTypes.d.ts +3 -0
- package/dist/internal/generateSdkRustCTypes.d.ts.map +1 -0
- package/dist/internal/generateSdkRustCTypes.js +253 -0
- package/dist/internal/generateSdkRustCTypes.js.map +1 -0
- package/dist/internal/schemas.d.ts.map +1 -1
- package/dist/internal/schemas.js +28 -24
- package/dist/internal/schemas.js.map +1 -1
- package/dist/jsonschema/index.d.ts +9 -12
- package/dist/jsonschema/index.d.ts.map +1 -1
- package/dist/jsonschema/index.js +80 -41
- package/dist/jsonschema/index.js.map +1 -1
- package/dist/types/CameraCalibration.d.ts +1 -1
- package/dist/types/CompressedImage.d.ts +1 -1
- package/dist/types/LogLevel.d.ts +6 -0
- package/dist/types/LogLevel.d.ts.map +1 -1
- package/dist/types/LogLevel.js +6 -0
- package/dist/types/LogLevel.js.map +1 -1
- package/dist/types/NumericType.d.ts +9 -0
- package/dist/types/NumericType.d.ts.map +1 -1
- package/dist/types/NumericType.js +9 -0
- package/dist/types/NumericType.js.map +1 -1
- package/dist/types/PointsAnnotationType.d.ts +1 -0
- package/dist/types/PointsAnnotationType.d.ts.map +1 -1
- package/dist/types/PointsAnnotationType.js +1 -0
- package/dist/types/PointsAnnotationType.js.map +1 -1
- package/dist/types/PositionCovarianceType.d.ts +4 -0
- package/dist/types/PositionCovarianceType.d.ts.map +1 -1
- package/dist/types/PositionCovarianceType.js +4 -0
- package/dist/types/PositionCovarianceType.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,18 +5,20 @@ const testFixtures_1 = require("./testFixtures");
|
|
|
5
5
|
describe("generatePyclass", () => {
|
|
6
6
|
it("generates module header", () => {
|
|
7
7
|
expect((0, generatePyclass_1.generateSchemaPrelude)()).toMatchInlineSnapshot(`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
"//! Definitions for well-known Foxglove schemas
|
|
9
|
+
//! Generated by https://github.com/foxglove/foxglove-sdk
|
|
10
|
+
#![allow(clippy::too_many_arguments)]
|
|
11
|
+
#![allow(clippy::enum_variant_names)]
|
|
12
|
+
#![allow(non_snake_case)]
|
|
13
|
+
use crate::PySchema;
|
|
14
|
+
use crate::schemas_wkt::{Duration, Timestamp};
|
|
15
|
+
use bytes::Bytes;
|
|
16
|
+
use foxglove::Encode;
|
|
17
|
+
use pyo3::prelude::*;
|
|
18
|
+
use pyo3::types::PyBytes;
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
"
|
|
21
|
+
`);
|
|
20
22
|
});
|
|
21
23
|
it("generates an enum", () => {
|
|
22
24
|
expect((0, generatePyclass_1.generatePyclass)(testFixtures_1.exampleEnum)).toMatchInlineSnapshot(`
|
|
@@ -33,138 +35,143 @@ describe("generatePyclass", () => {
|
|
|
33
35
|
});
|
|
34
36
|
it("generates a struct from a message", () => {
|
|
35
37
|
expect((0, generatePyclass_1.generatePyclass)(testFixtures_1.exampleMessage)).toMatchInlineSnapshot(`
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
38
|
+
"/// An example type
|
|
39
|
+
///
|
|
40
|
+
/// :param field_duration: duration field
|
|
41
|
+
/// :param field_time: time field
|
|
42
|
+
/// :param field_boolean: boolean field
|
|
43
|
+
/// :param field_bytes: bytes field
|
|
44
|
+
/// :param field_float64: float64 field
|
|
45
|
+
/// :param field_uint32: uint32 field
|
|
46
|
+
/// :param field_string: string field
|
|
47
|
+
/// :param field_duration_array: duration array field
|
|
48
|
+
/// :param field_time_array: time array field
|
|
49
|
+
/// :param field_boolean_array: boolean array field
|
|
50
|
+
/// :param field_bytes_array: bytes array field
|
|
51
|
+
/// :param field_float64_array: float64 array field
|
|
52
|
+
/// :param field_uint32_array: uint32 array field
|
|
53
|
+
/// :param field_string_array: string array field
|
|
54
|
+
/// :param field_duration_fixed_array: duration fixed-length array field
|
|
55
|
+
/// :param field_time_fixed_array: time fixed-length array field
|
|
56
|
+
/// :param field_boolean_fixed_array: boolean fixed-length array field
|
|
57
|
+
/// :param field_bytes_fixed_array: bytes fixed-length array field
|
|
58
|
+
/// :param field_float64_fixed_array: float64 fixed-length array field
|
|
59
|
+
/// :param field_uint32_fixed_array: uint32 fixed-length array field
|
|
60
|
+
/// :param field_string_fixed_array: string fixed-length array field
|
|
61
|
+
/// :param field_enum: An enum field
|
|
62
|
+
/// :param field_enum_array: An enum array field
|
|
63
|
+
/// :param field_nested: A nested field
|
|
64
|
+
/// :param field_nested_array: A nested array field
|
|
65
|
+
///
|
|
66
|
+
/// See https://docs.foxglove.dev/docs/visualization/message-schemas/example-message
|
|
67
|
+
#[pyclass(module = "foxglove.schemas")]
|
|
68
|
+
#[derive(Clone)]
|
|
69
|
+
pub(crate) struct ExampleMessage(pub(crate) foxglove::schemas::ExampleMessage);
|
|
70
|
+
#[pymethods]
|
|
71
|
+
impl ExampleMessage {
|
|
72
|
+
#[new]
|
|
73
|
+
#[pyo3(signature = (*, field_duration=None, field_time=None, field_boolean=false, field_bytes=None, field_float64=0.0, field_uint32=0, field_string="".to_string(), field_duration_array=vec![], field_time_array=vec![], field_boolean_array=vec![], field_bytes_array=None, field_float64_array=vec![], field_uint32_array=vec![], field_string_array=vec![], field_duration_fixed_array=vec![], field_time_fixed_array=vec![], field_boolean_fixed_array=vec![], field_bytes_fixed_array=None, field_float64_fixed_array=vec![], field_uint32_fixed_array=vec![], field_string_fixed_array=vec![], field_enum=ExampleMessageExampleEnum::A, field_enum_array=vec![], field_nested=None, field_nested_array=vec![]) )]
|
|
74
|
+
fn new(
|
|
75
|
+
field_duration: Option<Duration>,
|
|
76
|
+
field_time: Option<Timestamp>,
|
|
77
|
+
field_boolean: bool,
|
|
78
|
+
field_bytes: Option<Bound<'_, PyBytes>>,
|
|
79
|
+
field_float64: f64,
|
|
80
|
+
field_uint32: u32,
|
|
81
|
+
field_string: String,
|
|
82
|
+
field_duration_array: Vec<Option<Duration>>,
|
|
83
|
+
field_time_array: Vec<Option<Timestamp>>,
|
|
84
|
+
field_boolean_array: Vec<bool>,
|
|
85
|
+
field_bytes_array: Option<Bound<'_, PyBytes>>,
|
|
86
|
+
field_float64_array: Vec<f64>,
|
|
87
|
+
field_uint32_array: Vec<u32>,
|
|
88
|
+
field_string_array: Vec<String>,
|
|
89
|
+
field_duration_fixed_array: Vec<Option<Duration>>,
|
|
90
|
+
field_time_fixed_array: Vec<Option<Timestamp>>,
|
|
91
|
+
field_boolean_fixed_array: Vec<bool>,
|
|
92
|
+
field_bytes_fixed_array: Option<Bound<'_, PyBytes>>,
|
|
93
|
+
field_float64_fixed_array: Vec<f64>,
|
|
94
|
+
field_uint32_fixed_array: Vec<u32>,
|
|
95
|
+
field_string_fixed_array: Vec<String>,
|
|
96
|
+
field_enum: ExampleMessageExampleEnum,
|
|
97
|
+
field_enum_array: Vec<ExampleMessageExampleEnum>,
|
|
98
|
+
field_nested: Option<NestedMessage>,
|
|
99
|
+
field_nested_array: Vec<NestedMessage>,
|
|
100
|
+
) -> Self {
|
|
101
|
+
Self(foxglove::schemas::ExampleMessage {
|
|
102
|
+
field_duration: field_duration.map(Into::into),
|
|
103
|
+
field_time: field_time.map(Into::into),
|
|
104
|
+
field_boolean,
|
|
105
|
+
field_bytes: field_bytes.map(|x| Bytes::copy_from_slice(x.as_bytes())).unwrap_or_default(),
|
|
106
|
+
field_float64,
|
|
107
|
+
field_uint32,
|
|
108
|
+
field_string,
|
|
109
|
+
field_duration_array: field_duration_array.map(Into::into),
|
|
110
|
+
field_time_array: field_time_array.map(Into::into),
|
|
111
|
+
field_boolean_array,
|
|
112
|
+
field_bytes_array: field_bytes_array.map(|x| Bytes::copy_from_slice(x.as_bytes())).unwrap_or_default(),
|
|
113
|
+
field_float64_array,
|
|
114
|
+
field_uint32_array,
|
|
115
|
+
field_string_array,
|
|
116
|
+
field_duration_fixed_array: field_duration_fixed_array.map(Into::into),
|
|
117
|
+
field_time_fixed_array: field_time_fixed_array.map(Into::into),
|
|
118
|
+
field_boolean_fixed_array,
|
|
119
|
+
field_bytes_fixed_array: field_bytes_fixed_array.map(|x| Bytes::copy_from_slice(x.as_bytes())).unwrap_or_default(),
|
|
120
|
+
field_float64_fixed_array,
|
|
121
|
+
field_uint32_fixed_array,
|
|
122
|
+
field_string_fixed_array,
|
|
123
|
+
field_enum: field_enum as i32,
|
|
124
|
+
field_enum_array: field_enum_array as i32,
|
|
125
|
+
field_nested: field_nested.map(Into::into),
|
|
126
|
+
field_nested_array: field_nested_array.into_iter().map(|x| x.into()).collect(),
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
fn __repr__(&self) -> String {
|
|
130
|
+
format!(
|
|
131
|
+
"ExampleMessage(field_duration={:?}, field_time={:?}, field_boolean={:?}, field_bytes={:?}, field_float64={:?}, field_uint32={:?}, field_string={:?}, field_duration_array={:?}, field_time_array={:?}, field_boolean_array={:?}, field_bytes_array={:?}, field_float64_array={:?}, field_uint32_array={:?}, field_string_array={:?}, field_duration_fixed_array={:?}, field_time_fixed_array={:?}, field_boolean_fixed_array={:?}, field_bytes_fixed_array={:?}, field_float64_fixed_array={:?}, field_uint32_fixed_array={:?}, field_string_fixed_array={:?}, field_enum={:?}, field_enum_array={:?}, field_nested={:?}, field_nested_array={:?})",
|
|
132
|
+
self.0.field_duration,
|
|
133
|
+
self.0.field_time,
|
|
134
|
+
self.0.field_boolean,
|
|
135
|
+
self.0.field_bytes,
|
|
136
|
+
self.0.field_float64,
|
|
137
|
+
self.0.field_uint32,
|
|
138
|
+
self.0.field_string,
|
|
139
|
+
self.0.field_duration_array,
|
|
140
|
+
self.0.field_time_array,
|
|
141
|
+
self.0.field_boolean_array,
|
|
142
|
+
self.0.field_bytes_array,
|
|
143
|
+
self.0.field_float64_array,
|
|
144
|
+
self.0.field_uint32_array,
|
|
145
|
+
self.0.field_string_array,
|
|
146
|
+
self.0.field_duration_fixed_array,
|
|
147
|
+
self.0.field_time_fixed_array,
|
|
148
|
+
self.0.field_boolean_fixed_array,
|
|
149
|
+
self.0.field_bytes_fixed_array,
|
|
150
|
+
self.0.field_float64_fixed_array,
|
|
151
|
+
self.0.field_uint32_fixed_array,
|
|
152
|
+
self.0.field_string_fixed_array,
|
|
153
|
+
self.0.field_enum,
|
|
154
|
+
self.0.field_enum_array,
|
|
155
|
+
self.0.field_nested,
|
|
156
|
+
self.0.field_nested_array,
|
|
157
|
+
)
|
|
158
|
+
}
|
|
159
|
+
/// Returns the ExampleMessage schema.
|
|
160
|
+
#[staticmethod]
|
|
161
|
+
fn get_schema() -> PySchema {
|
|
162
|
+
foxglove::schemas::ExampleMessage::get_schema().unwrap().into()
|
|
163
|
+
}
|
|
164
|
+
}
|
|
158
165
|
|
|
159
166
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
167
|
+
impl From<ExampleMessage> for foxglove::schemas::ExampleMessage {
|
|
168
|
+
fn from(value: ExampleMessage) -> Self {
|
|
169
|
+
value.0
|
|
170
|
+
}
|
|
171
|
+
}
|
|
165
172
|
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
"
|
|
174
|
+
`);
|
|
168
175
|
});
|
|
169
176
|
});
|
|
170
177
|
//# sourceMappingURL=generatePyclass.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePyclass.test.js","sourceRoot":"","sources":["../../src/internal/generatePyclass.test.ts"],"names":[],"mappings":";;AAAA,uDAA2E;AAC3E,iDAA6D;AAE7D,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,IAAA,uCAAqB,GAAE,CAAC,CAAC,qBAAqB,CAAC
|
|
1
|
+
{"version":3,"file":"generatePyclass.test.js","sourceRoot":"","sources":["../../src/internal/generatePyclass.test.ts"],"names":[],"mappings":";;AAAA,uDAA2E;AAC3E,iDAA6D;AAE7D,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,IAAA,uCAAqB,GAAE,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;KAcrD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC3B,MAAM,CAAC,IAAA,iCAAe,EAAC,0BAAW,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;SAUtD,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,CAAC,IAAA,iCAAe,EAAC,6BAAc,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyI7D,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FoxgloveEnumSchema, FoxgloveMessageSchema } from "./types";
|
|
2
|
+
export declare function generateHppSchemas(schemas: readonly FoxgloveMessageSchema[], enums: readonly FoxgloveEnumSchema[]): string;
|
|
3
|
+
export declare function generateCppSchemas(schemas: FoxgloveMessageSchema[]): string;
|
|
4
|
+
//# sourceMappingURL=generateSdkCpp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateSdkCpp.d.ts","sourceRoot":"","sources":["../../src/internal/generateSdkCpp.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAqB,MAAM,SAAS,CAAC;AAwFvF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,qBAAqB,EAAE,EACzC,KAAK,EAAE,SAAS,kBAAkB,EAAE,GACnC,MAAM,CA8JR;AAiDD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAM,CAwG3E"}
|