@foxglove/schemas 0.6.0 → 0.6.1

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.
@@ -18,10 +18,10 @@ describe("generateTypeScript", () => {
18
18
  expect(generateTypeScript(exampleMessage)).toMatchInlineSnapshot(`
19
19
  "// Generated by https://github.com/foxglove/schemas
20
20
 
21
- import { Duration } from \\"./Duration\\";
22
- import { ExampleEnum } from \\"./ExampleEnum\\";
23
- import { NestedMessage } from \\"./NestedMessage\\";
24
- import { Time } from \\"./Time\\";
21
+ import { Duration } from "./Duration";
22
+ import { ExampleEnum } from "./ExampleEnum";
23
+ import { NestedMessage } from "./NestedMessage";
24
+ import { Time } from "./Time";
25
25
 
26
26
  /** An example type */
27
27
  export type ExampleMessage = {
@@ -32,7 +32,7 @@ export declare type FoxgloveMessageSchema = {
32
32
  type: "message";
33
33
  name: string;
34
34
  description: string;
35
- rosEquivalent?: keyof typeof import("@foxglove/rosmsg-msgs-common").definitions;
35
+ rosEquivalent?: keyof typeof import("@foxglove/rosmsg-msgs-common").ros1;
36
36
  fields: ReadonlyArray<FoxgloveMessageField>;
37
37
  };
38
38
  export declare type FoxgloveSchema = FoxgloveMessageSchema | FoxgloveEnumSchema;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB,GACzB,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,SAAS,GACT,OAAO,GACP,MAAM,GACN,UAAU,CAAC;AAEf,oBAAY,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,EAAE,MAAM,CAAC;IAClC,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,aAAa,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CA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K,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,iBAAiB,CAAA;KAAE,GAC9C;QAAE,IAAI,EAAE,QAAQ,CAAC;QAAC,MAAM,EAAE,qBAAqB,CAAA;KAAE,GACjD;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,kBAAkB,CAAA;KAAE,CAAC;IAC/C,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,oBAAY,qBAAqB,GAAG;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,cAAc,8BAA8B,EAAE,IAAI,CAAC;IACzE,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC7C,CAAC;AAEF,oBAAY,cAAc,GAAG,qBAAqB,GAAG,kBAAkB,CAAC"}
package/jest.config.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "testMatch": ["<rootDir>/src/**/*.test.ts"],
3
3
  "transform": {
4
- "^.+\\.ts$": "ts-jest"
5
- },
6
- "globals": {
7
- "ts-jest": {
8
- "diagnostics": {
9
- "//": "add 6133 (unused variables) to default ignore codes",
10
- "ignoreCodes": [6059, 18002, 18003, 6133]
4
+ "^.+\\.ts$": [
5
+ "ts-jest",
6
+ {
7
+ "diagnostics": {
8
+ "//": "add 6133 (unused variables) to default ignore codes",
9
+ "ignoreCodes": [6059, 18002, 18003, 6133]
10
+ }
11
11
  }
12
- }
12
+ ]
13
13
  },
14
14
  "//": "Native find is slow because it does not exclude files: https://github.com/facebook/jest/pull/11264#issuecomment-825377579",
15
15
  "haste": { "forceNodeFilesystemAPI": true }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foxglove/schemas",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Foxglove-defined message schemas for ROS, Protobuf, and JSON",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,33 +23,33 @@
23
23
  "update-generated-files": "ts-node --files --project tsconfig.cjs.json scripts/updateGeneratedFiles --out-dir schemas --ros-out-dir ros_foxglove_msgs"
24
24
  },
25
25
  "devDependencies": {
26
- "@foxglove/eslint-plugin": "0.19.0",
27
- "@foxglove/rosmsg": "^3.0.0",
26
+ "@foxglove/eslint-plugin": "0.20.0",
27
+ "@foxglove/rosmsg": "^3.1.0",
28
28
  "@foxglove/tsconfig": "1.1.0",
29
- "@types/jest": "27.5.0",
30
- "@types/node": "17.0.31",
29
+ "@types/jest": "29.0.1",
30
+ "@types/node": "18.7.16",
31
31
  "@types/rimraf": "^3.0.2",
32
- "@typescript-eslint/eslint-plugin": "5.22.0",
33
- "@typescript-eslint/parser": "5.22.0",
32
+ "@typescript-eslint/eslint-plugin": "5.37.0",
33
+ "@typescript-eslint/parser": "5.37.0",
34
34
  "ajv": "^8.11.0",
35
- "commander": "^9.2.0",
36
- "eslint": "8.14.0",
35
+ "commander": "^9.4.0",
36
+ "eslint": "8.23.1",
37
37
  "eslint-config-prettier": "8.5.0",
38
38
  "eslint-plugin-es": "4.1.0",
39
39
  "eslint-plugin-filenames": "1.3.2",
40
40
  "eslint-plugin-import": "2.26.0",
41
- "eslint-plugin-jest": "26.1.5",
42
- "eslint-plugin-prettier": "4.0.0",
43
- "jest": "28.1.0",
44
- "prettier": "2.6.2",
45
- "protobufjs": "^6.11.2",
41
+ "eslint-plugin-jest": "27.0.4",
42
+ "eslint-plugin-prettier": "4.2.1",
43
+ "jest": "29.0.3",
44
+ "prettier": "2.7.1",
45
+ "protobufjs": "^7.1.1",
46
46
  "rimraf": "^3.0.2",
47
- "ts-jest": "28.0.1",
48
- "ts-node": "10.7.0",
49
- "typescript": "4.6.4"
47
+ "ts-jest": "29.0.0",
48
+ "ts-node": "10.9.1",
49
+ "typescript": "4.8.3"
50
50
  },
51
51
  "dependencies": {
52
- "@foxglove/rosmsg-msgs-common": "^1.0.4",
52
+ "@foxglove/rosmsg-msgs-common": "^2.0.0",
53
53
  "tslib": "^2"
54
54
  }
55
55
  }
@@ -7,46 +7,46 @@ import { exampleMessage } from "./testFixtures";
7
7
  describe("generateJsonSchema", () => {
8
8
  it("generates expected JSON Schema", () => {
9
9
  expect(generateJsonSchema(exampleMessage)).toMatchInlineSnapshot(`
10
- Object {
10
+ {
11
11
  "$comment": "Generated by https://github.com/foxglove/schemas",
12
12
  "description": "An example type",
13
- "properties": Object {
14
- "field_boolean": Object {
13
+ "properties": {
14
+ "field_boolean": {
15
15
  "description": "boolean field",
16
16
  "type": "boolean",
17
17
  },
18
- "field_boolean_array": Object {
18
+ "field_boolean_array": {
19
19
  "description": "boolean array field",
20
- "items": Object {
20
+ "items": {
21
21
  "type": "boolean",
22
22
  },
23
23
  "type": "array",
24
24
  },
25
- "field_boolean_fixed_array": Object {
25
+ "field_boolean_fixed_array": {
26
26
  "description": "boolean fixed-length array field",
27
- "items": Object {
27
+ "items": {
28
28
  "type": "boolean",
29
29
  },
30
30
  "maxItems": 3,
31
31
  "minItems": 3,
32
32
  "type": "array",
33
33
  },
34
- "field_bytes": Object {
34
+ "field_bytes": {
35
35
  "contentEncoding": "base64",
36
36
  "description": "bytes field",
37
37
  "type": "string",
38
38
  },
39
- "field_bytes_array": Object {
39
+ "field_bytes_array": {
40
40
  "description": "bytes array field",
41
- "items": Object {
41
+ "items": {
42
42
  "contentEncoding": "base64",
43
43
  "type": "string",
44
44
  },
45
45
  "type": "array",
46
46
  },
47
- "field_bytes_fixed_array": Object {
47
+ "field_bytes_fixed_array": {
48
48
  "description": "bytes fixed-length array field",
49
- "items": Object {
49
+ "items": {
50
50
  "contentEncoding": "base64",
51
51
  "type": "string",
52
52
  },
@@ -54,31 +54,31 @@ describe("generateJsonSchema", () => {
54
54
  "minItems": 3,
55
55
  "type": "array",
56
56
  },
57
- "field_duration": Object {
57
+ "field_duration": {
58
58
  "description": "duration field",
59
- "properties": Object {
60
- "nsec": Object {
59
+ "properties": {
60
+ "nsec": {
61
61
  "maximum": 999999999,
62
62
  "minimum": 0,
63
63
  "type": "integer",
64
64
  },
65
- "sec": Object {
65
+ "sec": {
66
66
  "type": "integer",
67
67
  },
68
68
  },
69
69
  "title": "duration",
70
70
  "type": "object",
71
71
  },
72
- "field_duration_array": Object {
72
+ "field_duration_array": {
73
73
  "description": "duration array field",
74
- "items": Object {
75
- "properties": Object {
76
- "nsec": Object {
74
+ "items": {
75
+ "properties": {
76
+ "nsec": {
77
77
  "maximum": 999999999,
78
78
  "minimum": 0,
79
79
  "type": "integer",
80
80
  },
81
- "sec": Object {
81
+ "sec": {
82
82
  "type": "integer",
83
83
  },
84
84
  },
@@ -87,16 +87,16 @@ describe("generateJsonSchema", () => {
87
87
  },
88
88
  "type": "array",
89
89
  },
90
- "field_duration_fixed_array": Object {
90
+ "field_duration_fixed_array": {
91
91
  "description": "duration fixed-length array field",
92
- "items": Object {
93
- "properties": Object {
94
- "nsec": Object {
92
+ "items": {
93
+ "properties": {
94
+ "nsec": {
95
95
  "maximum": 999999999,
96
96
  "minimum": 0,
97
97
  "type": "integer",
98
98
  },
99
- "sec": Object {
99
+ "sec": {
100
100
  "type": "integer",
101
101
  },
102
102
  },
@@ -107,15 +107,15 @@ describe("generateJsonSchema", () => {
107
107
  "minItems": 3,
108
108
  "type": "array",
109
109
  },
110
- "field_enum": Object {
110
+ "field_enum": {
111
111
  "description": "An enum field",
112
- "oneOf": Array [
113
- Object {
112
+ "oneOf": [
113
+ {
114
114
  "const": 1,
115
115
  "description": "Value A",
116
116
  "title": "A",
117
117
  },
118
- Object {
118
+ {
119
119
  "const": 2,
120
120
  "description": "Value B",
121
121
  "title": "B",
@@ -123,17 +123,17 @@ describe("generateJsonSchema", () => {
123
123
  ],
124
124
  "title": "foxglove.ExampleEnum",
125
125
  },
126
- "field_enum_array": Object {
126
+ "field_enum_array": {
127
127
  "description": "An enum array field",
128
- "items": Object {
128
+ "items": {
129
129
  "description": "An enum array field",
130
- "oneOf": Array [
131
- Object {
130
+ "oneOf": [
131
+ {
132
132
  "const": 1,
133
133
  "description": "Value A",
134
134
  "title": "A",
135
135
  },
136
- Object {
136
+ {
137
137
  "const": 2,
138
138
  "description": "Value B",
139
139
  "title": "B",
@@ -143,30 +143,30 @@ describe("generateJsonSchema", () => {
143
143
  },
144
144
  "type": "array",
145
145
  },
146
- "field_float64": Object {
146
+ "field_float64": {
147
147
  "description": "float64 field",
148
148
  "type": "number",
149
149
  },
150
- "field_float64_array": Object {
150
+ "field_float64_array": {
151
151
  "description": "float64 array field",
152
- "items": Object {
152
+ "items": {
153
153
  "type": "number",
154
154
  },
155
155
  "type": "array",
156
156
  },
157
- "field_float64_fixed_array": Object {
157
+ "field_float64_fixed_array": {
158
158
  "description": "float64 fixed-length array field",
159
- "items": Object {
159
+ "items": {
160
160
  "type": "number",
161
161
  },
162
162
  "maxItems": 3,
163
163
  "minItems": 3,
164
164
  "type": "array",
165
165
  },
166
- "field_nested": Object {
166
+ "field_nested": {
167
167
  "description": "A nested field",
168
- "properties": Object {
169
- "field_enum": Object {
168
+ "properties": {
169
+ "field_enum": {
170
170
  "description": "An enum field",
171
171
  "minimum": 0,
172
172
  "type": "integer",
@@ -175,17 +175,17 @@ describe("generateJsonSchema", () => {
175
175
  "title": "foxglove.NestedMessage",
176
176
  "type": "object",
177
177
  },
178
- "field_nested_array": Object {
178
+ "field_nested_array": {
179
179
  "description": "A nested array field
180
180
  With
181
181
  a
182
182
  very
183
183
  long
184
184
  description",
185
- "items": Object {
185
+ "items": {
186
186
  "description": "An example nested message",
187
- "properties": Object {
188
- "field_enum": Object {
187
+ "properties": {
188
+ "field_enum": {
189
189
  "description": "An enum field",
190
190
  "minimum": 0,
191
191
  "type": "integer",
@@ -196,35 +196,35 @@ describe("generateJsonSchema", () => {
196
196
  },
197
197
  "type": "array",
198
198
  },
199
- "field_string": Object {
199
+ "field_string": {
200
200
  "description": "string field",
201
201
  "type": "string",
202
202
  },
203
- "field_string_array": Object {
203
+ "field_string_array": {
204
204
  "description": "string array field",
205
- "items": Object {
205
+ "items": {
206
206
  "type": "string",
207
207
  },
208
208
  "type": "array",
209
209
  },
210
- "field_string_fixed_array": Object {
210
+ "field_string_fixed_array": {
211
211
  "description": "string fixed-length array field",
212
- "items": Object {
212
+ "items": {
213
213
  "type": "string",
214
214
  },
215
215
  "maxItems": 3,
216
216
  "minItems": 3,
217
217
  "type": "array",
218
218
  },
219
- "field_time": Object {
219
+ "field_time": {
220
220
  "description": "time field",
221
- "properties": Object {
222
- "nsec": Object {
221
+ "properties": {
222
+ "nsec": {
223
223
  "maximum": 999999999,
224
224
  "minimum": 0,
225
225
  "type": "integer",
226
226
  },
227
- "sec": Object {
227
+ "sec": {
228
228
  "minimum": 0,
229
229
  "type": "integer",
230
230
  },
@@ -232,16 +232,16 @@ describe("generateJsonSchema", () => {
232
232
  "title": "time",
233
233
  "type": "object",
234
234
  },
235
- "field_time_array": Object {
235
+ "field_time_array": {
236
236
  "description": "time array field",
237
- "items": Object {
238
- "properties": Object {
239
- "nsec": Object {
237
+ "items": {
238
+ "properties": {
239
+ "nsec": {
240
240
  "maximum": 999999999,
241
241
  "minimum": 0,
242
242
  "type": "integer",
243
243
  },
244
- "sec": Object {
244
+ "sec": {
245
245
  "minimum": 0,
246
246
  "type": "integer",
247
247
  },
@@ -251,16 +251,16 @@ describe("generateJsonSchema", () => {
251
251
  },
252
252
  "type": "array",
253
253
  },
254
- "field_time_fixed_array": Object {
254
+ "field_time_fixed_array": {
255
255
  "description": "time fixed-length array field",
256
- "items": Object {
257
- "properties": Object {
258
- "nsec": Object {
256
+ "items": {
257
+ "properties": {
258
+ "nsec": {
259
259
  "maximum": 999999999,
260
260
  "minimum": 0,
261
261
  "type": "integer",
262
262
  },
263
- "sec": Object {
263
+ "sec": {
264
264
  "minimum": 0,
265
265
  "type": "integer",
266
266
  },
@@ -272,22 +272,22 @@ describe("generateJsonSchema", () => {
272
272
  "minItems": 3,
273
273
  "type": "array",
274
274
  },
275
- "field_uint32": Object {
275
+ "field_uint32": {
276
276
  "description": "uint32 field",
277
277
  "minimum": 0,
278
278
  "type": "integer",
279
279
  },
280
- "field_uint32_array": Object {
280
+ "field_uint32_array": {
281
281
  "description": "uint32 array field",
282
- "items": Object {
282
+ "items": {
283
283
  "minimum": 0,
284
284
  "type": "integer",
285
285
  },
286
286
  "type": "array",
287
287
  },
288
- "field_uint32_fixed_array": Object {
288
+ "field_uint32_fixed_array": {
289
289
  "description": "uint32 fixed-length array field",
290
- "items": Object {
290
+ "items": {
291
291
  "minimum": 0,
292
292
  "type": "integer",
293
293
  },
@@ -9,11 +9,11 @@ describe("generateProto", () => {
9
9
  expect(generateProto(exampleMessage, [exampleEnum])).toMatchInlineSnapshot(`
10
10
  "// Generated by https://github.com/foxglove/schemas
11
11
 
12
- syntax = \\"proto3\\";
12
+ syntax = "proto3";
13
13
 
14
- import \\"foxglove/NestedMessage.proto\\";
15
- import \\"google/protobuf/duration.proto\\";
16
- import \\"google/protobuf/timestamp.proto\\";
14
+ import "foxglove/NestedMessage.proto";
15
+ import "google/protobuf/duration.proto";
16
+ import "google/protobuf/timestamp.proto";
17
17
 
18
18
  package foxglove;
19
19