diff --git a/proto/deviceInfo/v1.proto b/proto/deviceInfo/v1.proto index 196764d..6113bd2 100644 --- a/proto/deviceInfo/v1.proto +++ b/proto/deviceInfo/v1.proto @@ -22,5 +22,5 @@ message DeviceInfo_1 { } string name = 5 [(required) = true]; - optional DeviceType deviceType = 6; + DeviceType deviceType = 6; } diff --git a/src/lib/encode-conversions.ts b/src/lib/encode-conversions.ts index a2cd415..c0dd189 100644 --- a/src/lib/encode-conversions.ts +++ b/src/lib/encode-conversions.ts @@ -128,6 +128,7 @@ export const convertDeviceInfo: ConvertFunction<'deviceInfo'> = (mapeoDoc) => { return { common: convertCommon(mapeoDoc), ...mapeoDoc, + deviceType: mapeoDoc.deviceType ?? 'device_type_unspecified', } } diff --git a/test/fixtures/good-docs-minimal.js b/test/fixtures/good-docs-minimal.js index 7175d84..b748e98 100644 --- a/test/fixtures/good-docs-minimal.js +++ b/test/fixtures/good-docs-minimal.js @@ -118,7 +118,7 @@ export const goodDocsMinimal = [ name: 'my device name', deleted: false, }, - expected: {}, + expected: { deviceType: 'device_type_unspecified' }, }, { doc: {