-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add Icon {proto,schema} and {encode,decode}-conversions * Update src/lib/decode-conversions.ts Co-authored-by: Gregor MacLennan <[email protected]> * Update proto/icon/v1.proto Co-authored-by: Gregor MacLennan <[email protected]> * reverted icon/v1.proto PixelDensity enum in protobufs, enums need to start at 0, so we can't align the numbers... * remove unnecessary type casting, add tests * call pixelDensity x1,x2,x3 on proto --------- Co-authored-by: Tomás Ciccola <[email protected]> Co-authored-by: Gregor MacLennan <[email protected]>
- Loading branch information
1 parent
01db7b3
commit dacb41e
Showing
10 changed files
with
268 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
syntax = "proto3"; | ||
package mapeo; | ||
|
||
import "common/v1.proto"; | ||
import "options.proto"; | ||
|
||
message Icon_1 { | ||
// **DO NOT CHANGE dataTypeId** generated with `openssl rand -hex 6` | ||
option (dataTypeId) = "97e8cd9f0854"; | ||
option (schemaName) = "icon"; | ||
|
||
Common_1 common = 1; | ||
string name = 2 [(required) = true]; | ||
|
||
message IconVariant { | ||
|
||
enum Size { | ||
small = 0; | ||
medium = 1; | ||
large = 2; | ||
} | ||
|
||
enum PixelDensity { | ||
x1 = 0; | ||
x2 = 1; | ||
x3 = 2; | ||
} | ||
|
||
enum MimeType { | ||
svg = 0; | ||
png = 1; | ||
} | ||
|
||
Size size = 1 [(required) = true]; | ||
PixelDensity pixelDensity = 2 [(required) = true]; | ||
bytes blobVersionId = 3 [(required) = true]; | ||
MimeType mimeType = 4 [(required) = true]; | ||
} | ||
|
||
repeated IconVariant variants = 3; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"$id": "http://mapeo.world/schemas/icon/v2.json", | ||
"title": "Icon", | ||
"description": "An Icon represents metadata to retrieve an Icon blob", | ||
"type": "object", | ||
"properties": { | ||
"schemaName": { | ||
"description": "Must be `icon`", | ||
"type": "string", | ||
"const": "icon" | ||
}, | ||
"name": { | ||
"type": "string" | ||
}, | ||
"variants" :{ | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"size": { | ||
"type": "string", | ||
"enum": ["small", "medium", "large"] | ||
}, | ||
"pixelDensity": { | ||
"type": "number", | ||
"enum": [1,2,3] | ||
}, | ||
"blobVersionId": { | ||
"type": "string" | ||
}, | ||
"mimeType": { | ||
"type": "string", | ||
"enum": ["image/svg+xml", "image/png"] | ||
} | ||
}, | ||
"required": ["size", "pixelDensity", "blobVersionId", "mimeType"] | ||
} | ||
} | ||
}, | ||
"required": ["schemaName", "name", "variants"], | ||
"additionalProperties": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ type SupportedSchemaNames = | |
| 'field' | ||
| 'preset' | ||
| 'role' | ||
| 'icon' | ||
| 'deviceInfo' | ||
| 'coreOwnership' | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters